Skip to content

Commit

Permalink
Updating some LVS devices, Adding makefile for regression, Adding act…
Browse files Browse the repository at this point in the history
…ions

Signed-off-by: FaragElsayed2 <farag_agoor@mabrains.com>
  • Loading branch information
FaragElsayed2 committed Apr 23, 2024
1 parent 78e25cc commit 599ba51
Show file tree
Hide file tree
Showing 35 changed files with 388 additions and 144 deletions.
34 changes: 15 additions & 19 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
; ==========================================================================
; Copyright 2024 IHP 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
; Copyright 2024 IHP 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
; ==========================================================================

[flake8]
max-line-length = 100
max-complexity = 18
; select = B,C,E,F,W,T4,B9
; ignore = E203, E266, E501, W503, F403, F401

exclude =
# No need to traverse our git directory
.git,
# There's no value in checking cache directories
__pycache__,
# Ignore python init files
__init__.py,
# The conf file is mostly autogenerated, ignore it
docs/source/conf.py,
# The old directory contains Flake8 2.0
Expand All @@ -42,4 +38,4 @@ exclude =
deprecated,
env,
*_env,
*.egg-info
*_venv,
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Environment

- Klayout Version:
- OS/Platform:

## Expected Behavior


## Actual Behavior


## Steps to Reproduce the Problem

1.
2.
3.
4 changes: 4 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Fixes #<issue_number_goes_here>

- [ ] Tests pass
- [ ] Appropriate changes to README are included in PR
33 changes: 33 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#==========================================================================
# Copyright 2024 IHP 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
#==========================================================================

name: code linting
on:
pull_request:
# push:
workflow_dispatch:

jobs:
lint_python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Lint with flake8
run: |
make lint_python
82 changes: 82 additions & 0 deletions .github/workflows/lvs_regression.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#==========================================================================
# Copyright 2024 IHP 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
#==========================================================================

name: LVS regression testing

# Prevent keeping resources busy when a branch/PR is updated
# https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
# push:
pull_request:
workflow_dispatch:

jobs:
lvs_switch:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { tool: klayout, part: lvs, test: switch }

name: ${{ matrix.part }} | ${{ matrix.test }}

steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Testing ${{ matrix.part }} for ${{ matrix.test }}
run: |
make test-"$(python -c 'print("${{ matrix.part }}".upper())')"-${{ matrix.test }}
build_lvs-matrix:
runs-on: ubuntu-latest
outputs:
lvs_table: ${{ steps.set-matrix.outputs.lvs_table }}
steps:
- uses: actions/checkout@v3
- id: set-matrix
run: |
cd ihp-sg13g2/libs.tech/klayout/tech/lvs/rule_decks/
lvs_table=`echo '[' ; find -iname '*_extraction.lvs' | awk -F_ '{print $1}' | awk -F/ '{print $2}' | tr '[:lower:]' '[:upper:]' | tr '\n' ','|sed -e 's/^/\"/'| sed -e 's/,$/\"]/'|sed -e 's/,/\", \"/g'`;
lvs_table=`echo $lvs_table | jq -c .`
echo $lvs_table
echo "lvs_table=$lvs_table" >>$GITHUB_OUTPUT
lvs_regression:
needs: build_lvs-matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
part: [lvs]
test: ${{ fromJson(needs.build_lvs-matrix.outputs.lvs_table) }}

name: ${{ matrix.part }} | ${{ matrix.test }}

steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Testing ${{ matrix.part }} for ${{ matrix.test }}
run: |
make test-"$(python -c 'print("${{ matrix.part }}".upper())')"-${{ matrix.test }}
69 changes: 69 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#==========================================================================
# Copyright 2024 IHP 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
#==========================================================================

# The top directory where environment will be created.
TOP_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
VENV_RUN_COMMAND = $(TOP_DIR)/actions_venv/bin/activate

# Path to regression
KLAYOUT_LVS_TESTS := ihp-sg13g2/libs.tech/klayout/tech/lvs/testing

# A pip `requirements.txt` file.
# https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format
REQUIREMENTS_FILE := requirements.txt

# =======================
# ------ ENV SETUP ------
# =======================

$(TOP_DIR)/actions_venv:
@python3 -m venv $(TOP_DIR)/actions_venv

# Install requirements
env: $(TOP_DIR)/actions_venv
@. $(VENV_RUN_COMMAND); pip install -r $(REQUIREMENTS_FILE)

# ========================
# ----- LINTING TEST -----
# ========================

# Lint python code
lint_python: env
@echo "Running python linting for Klayout-tech directory"
@. $(VENV_RUN_COMMAND); flake8 ihp-sg13g2/libs.tech/klayout/tech/

#=================================
# ----- test-LVS_regression ------
#=================================

.ONESHELL:
test-LVS-main: env
@. $(VENV_RUN_COMMAND); echo "Running Klayout-LVS regression for all devices"
@. $(VENV_RUN_COMMAND); cd $(KLAYOUT_LVS_TESTS) && make test-LVS-main

.ONESHELL:
test-LVS-% : env
@. $(VENV_RUN_COMMAND); echo "Running Klayout-LVS regression for $* device"
@. $(VENV_RUN_COMMAND); cd $(KLAYOUT_LVS_TESTS) && make test-LVS-$*

#=================================
# -------- test-LVS-switch -------
#=================================

test-LVS-switch: env
@. $(VENV_RUN_COMMAND); echo "Running Klayout-LVS switch test"
@. $(VENV_RUN_COMMAND); cd $(KLAYOUT_LVS_TESTS) && make test-LVS-switch
5 changes: 4 additions & 1 deletion ihp-sg13g2/libs.tech/klayout/tech/lvs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,12 @@ The SG13G2 also facilitates LVS execution via Klayout menus as depicted below:
First, you need to add the LVS menus to your `KLAYOUT_PATH`, you could do that by executing the following command:

```bash
KLAYOUT_PATH=$PWD/../:$PWD/../.. klayout -e
KLAYOUT_PATH=$PDKPATH/libs.tech/klayout:$PDKPATH/libs.tech/klayout/tech/ klayout -e
```

> **_NOTE:_** In this context, `PDKPATH` refers to the path leading to the IHP-Open-PDK/ihp-sg13g2 directory within the current repository.

Then, you will get the LVS menus for SG13G2, you could set your desired options as shown below:

> **_NOTE:_** You need to select the path of the netlist will be used in the LVS run. If no path is specified, the tool will automatically search for the netlist file in the same directory as the layout file, considering files with the extensions .cdl, .spice, or .cir and has same name of the layout file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ logger.info('Starting LVS BJT CONNECTIONS')
# =============

# General
connect(npn_sub, pwell_con)
connect(npn_sub, pwell)

# npn13G2 nodes connections
connect(npn13G2_te, npn13G2_e_pin)
Expand All @@ -37,7 +37,7 @@ connect(npn13G2_tb, npn13G2_b_pin)
connect(npn13G2_e_pin, cont_drw)
connect(npn13G2_c_pin, cont_drw)
connect(npn13G2_b_pin, cont_drw)
connect(npn_sub, pwell_con)
connect(npn_sub, pwell)
connect(npn13G2_e_pin, emwind_drw)
connect(emwind_drw, metal1_con)

Expand All @@ -48,7 +48,7 @@ connect(npn13G2l_tb, npn13G2l_b_pin)
connect(npn13G2l_e_pin, cont_drw)
connect(npn13G2l_c_pin, cont_drw)
connect(npn13G2l_b_pin, cont_drw)
connect(npn_sub, pwell_con)
connect(npn_sub, pwell)

# npn13G2V nodes connections
connect(npn13G2v_te, npn13G2v_e_pin)
Expand All @@ -57,7 +57,7 @@ connect(npn13G2v_tb, npn13G2v_b_pin)
connect(npn13G2v_e_pin, cont_drw)
connect(npn13G2v_c_pin, cont_drw)
connect(npn13G2v_b_pin, cont_drw)
connect(npn_sub, pwell_con)
connect(npn_sub, pwell)

# =============
# ---- PNP ----
Expand Down
Loading

0 comments on commit 599ba51

Please sign in to comment.