Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Commit

Permalink
run-drc-for-cell-gds-using-magic: Testing container locally.
Browse files Browse the repository at this point in the history
Signed-off-by: Tim 'mithro' Ansell <tansell@google.com>
  • Loading branch information
mithro committed Jun 3, 2021
1 parent 11ccc4b commit 562172e
Show file tree
Hide file tree
Showing 16 changed files with 205 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
name: Test Docker Image for Run DRC for cell GDS (using Magic) Action

on:
workflow_dispatch:
push:
pull_request:


permissions:
contents: read


jobs:

test:
name: Basic Test

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2

- name: Check tests/action-local/action.yml is up to date
run: |
cd run-drc-for-cell-gds-using-magic
make ./tests/action-local/action.yml
git diff --exit-code --color=always ./tests/action-local/action.yml
- uses: ./run-drc-for-cell-gds-using-magic/tests/action-local
name: Clean cells should pass.
with:
top: ./run-drc-for-cell-gds-using-magic/tests/clean

- uses: ./run-drc-for-cell-gds-using-magic/tests/action-local
name: Broken cells is filtered (--known-bad).
with:
top: ./run-drc-for-cell-gds-using-magic/tests/broken
known-bad: sky130_fd_sc_hd__clkdlybuf4s15_1

- uses: ./run-drc-for-cell-gds-using-magic/tests/action-local
name: Broken cells is filtered (--match-cells).
with:
top: ./run-drc-for-cell-gds-using-magic/tests/broken
match-cells: clean_cell

- uses: ./run-drc-for-cell-gds-using-magic/tests/action-local
name: Broken cells should fail.
id: broken-should-fail
continue-on-error: true
with:
top: ./run-drc-for-cell-gds-using-magic/tests/broken

- name: Error on success
if: steps.broken-should-fail.outcome != 'failure'
run:
echo "The action should have failed!"
exit 1
48 changes: 48 additions & 0 deletions run-drc-for-cell-gds-using-magic/.update-test-action-local.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 SkyWater PDK Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

import pathlib

__dir__ = pathlib.Path(__file__).parent.resolve()

src_action_yml = __dir__ / 'action.yml'
dst_action_yml = (__dir__ / 'tests' / 'action-local' / 'action.yml').resolve()

print('Base action.yml file at:', src_action_yml)
print('Test action.yml file at:', dst_action_yml)

with open(src_action_yml) as f:
action_data = f.read()

name = 'run-drc-for-cell-gds-using-magic'
action_data = action_data.replace(
f'image: docker://gcr.io/skywater-pdk/actions/{name}:main',
'image: ../../Dockerfile',
)

action_data = action_data.replace(
'\nname:',
"""
# WARNING! Don't modify this file, modify the base `action.yml` file and then
# run `make tests/action-local/action.yml`.
name:""")

with open(dst_action_yml, 'w') as f:
f.write(action_data)
9 changes: 8 additions & 1 deletion run-drc-for-cell-gds-using-magic/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,15 @@

TOP_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))/..)

NAME := run-drc-for-cell-gds-using-magic

tests/action-local/action.yml: action.yml .update-test-action-local.py
$(TOP_DIR)/$(NAME)/.update-test-action-local.py

.PHONY: tests/action-local/action.yml

README.rst: README.src.rst $(TOP_DIR)/docs/*.rst $(TOP_DIR)/Makefile
make -C $(TOP_DIR) run-drc-for-cell-gds-using-magic/README.rst
make -C $(TOP_DIR) $(NAME)/README.rst

# Redirect everything to the top directory by default.
%:
Expand Down
4 changes: 2 additions & 2 deletions run-drc-for-cell-gds-using-magic/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ inputs:
default: ^.*$
known-bad:
description: >-
List of known bad cells that should be ignored.
Common separated list of known bad cells that should be ignored.
default:


Expand All @@ -49,4 +49,4 @@ runs:
- --match-cell-directories
- ${{ inputs.match-cell-directories }}
- --known-bad
- ${{ join(inputs.known-bad, ',') }}
- ${{ inputs.known-bad }}
14 changes: 11 additions & 3 deletions run-drc-for-cell-gds-using-magic/run_all_drc.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,22 @@ def run_all_drc(
os.getcwd(), match_cell_directories))

global acceptable_errors
acceptable_errors_str = open(acceptable_errors_file).read()
acceptable_errors = acceptable_errors_str.split("\n")
acceptable_errors = []
with open(acceptable_errors_file) as f:
acceptable_errors += f.read().split("\n")

cells_dir = "./cells"
lib_acceptable_errors_file = os.path.join(cells_dir, 'allowed_drc_errors')
if os.path.exists(lib_acceptable_errors_file):
with open(lib_acceptable_errors_file) as f:
acceptable_errors += f.read().split("\n")

known_bad_list = known_bad.split(",")

nproc = os.cpu_count()
with futures.ThreadPoolExecutor(max_workers=nproc) as executor:
future_list = []

cells_dir = "./cells"
cells = os.listdir(cells_dir)

for cell in cells:
Expand All @@ -194,6 +200,8 @@ def run_all_drc(
continue

cell_dir = os.path.join(cells_dir, cell)
if not os.path.isdir(cell_dir):
continue

gds_list = list(
filter(lambda x: x.endswith(".gds"), os.listdir(cell_dir))
Expand Down
59 changes: 59 additions & 0 deletions run-drc-for-cell-gds-using-magic/tests/action-local/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright 2020 SkyWater PDK Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

# WARNING! Don't modify this file, modify the base `action.yml` file and then
# run `make tests/action-local/action.yml`.

name: run-drc-for-cell-gds-using-magic
description: >-
This GitHub action runs Design Rule Checks on all GDS files inside the /cells
directory.
inputs:
top:
description: >-
What directory to run the check inside.
default: .
acceptable-errors-file:
description: >-
A file containing a list of newline-delimited acceptable DRC errors.
default: /dev/null
match-cell-directories:
description: >-
A regex that will match cell names to be checked.
default: ^.*$
known-bad:
description: >-
Common separated list of known bad cells that should be ignored.
default:


runs:
using: 'docker'
image: ../../Dockerfile
args:
- --top
- ${{ inputs.top }}
- --acceptable-errors-file
- ${{ inputs.acceptable-errors-file }}
- --match-cell-directories
- ${{ inputs.match-cell-directories }}
- --known-bad
- ${{ inputs.known-bad }}




Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
All nwells must contain metal-connected N+ taps (nwell.4)
P-diff distance to N-tap must be < 15.0um (LU.3)
N-diff distance to P-tap must be < 15.0um (LU.2)

0 comments on commit 562172e

Please sign in to comment.