feat(precheck/gf180mcuD): update to latest PDK

This commit is contained in:
Uri Shaked
2026-06-14 20:23:49 +03:00
parent a280aac0a7
commit d1bbd34d95
7 changed files with 42 additions and 44 deletions
@@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
PDK_ROOT: /home/runner/pdk PDK_ROOT: /home/runner/pdk
PDK_VERSION: ff08c23db8359afce3f134c454e7930586d0641c PDK_VERSION: e8daeda73ca8f5814dbc0b11d1d05802251a3750
steps: steps:
- name: Check out code - name: Check out code
+10 -1
View File
@@ -3,9 +3,18 @@
, ,
}: }:
let
# KLayout 0.30.8 is required by the latest gf180mcu rule-framework DRC deck
# (it uses LayoutToNetlist#copy, which older KLayout lacks). Pinned
# separately so magic-vlsi keeps coming from the base nixpkgs above.
klayoutPkgs = import
(fetchTarball
"https://github.com/NixOS/nixpkgs/archive/ffa10e26ae11d676b2db836259889f1f571cb14f.tar.gz")
{ };
in
pkgs.mkShell { pkgs.mkShell {
buildInputs = [ buildInputs = [
pkgs.klayout klayoutPkgs.klayout
pkgs.magic-vlsi pkgs.magic-vlsi
]; ];
} }
+27 -35
View File
@@ -4,7 +4,6 @@ import logging
import os import os
import re import re
import subprocess import subprocess
import sys
import tempfile import tempfile
import time import time
import traceback import traceback
@@ -130,44 +129,37 @@ def klayout_sg13g2(gds: str):
) )
def klayout_gf180mcuD_antenna(gds: str): def klayout_gf180mcuD_rule_deck(gds: str, top_module: str, check: str, decks: str):
return klayout_drc( # All gf180mcuD DRC runs go through the PDK's unified rule deck
gds, # (gf180mcu.drc); `decks` selects which rule groups to run (see its
"antenna", # `-rd help=true` output).
"antenna.drc", logging.info(f"Running klayout {check} on {gds}")
script_dir=f"{PDK_ROOT}/{PDK_NAME}/libs.tech/klayout/tech/drc/rule_decks", script = f"{PDK_ROOT}/{PDK_NAME}/libs.tech/klayout/tech/drc/gf180mcu.drc"
) script_vars = {
"input": gds,
"topcell": top_module,
"variant": "gf180mcuD", # metal_top=11K, mim_option=B, metal_level=5LM
"run_mode": "deep",
"threads": "1", # single-threaded to work around a klayout bug
"decks": decks,
}
klayout_custom_drc(check, script, script_vars, ["report"])
def klayout_gf180mcuD_antenna(gds: str, top_module: str):
# Antenna rules only - they are part of the full deck but get their own
# check, so the full DRC below excludes them to avoid running them twice.
return klayout_gf180mcuD_rule_deck(gds, top_module, "antenna", "antenna")
def klayout_gf180mcuD_drc(gds: str, top_module: str): def klayout_gf180mcuD_drc(gds: str, top_module: str):
logging.info(f"Running klayout gf180mcuD DRC on {gds}") # Full rule deck (FEOL + BEOL + connectivity) minus density and antenna.
run_dir = f"{REPORTS_PATH}/gf180mcuD_drc" # Density is excluded because user projects rely on the metal fill that is
os.makedirs(run_dir, exist_ok=True) # added after precheck to meet it; antenna has its own check above.
report_file = f"{run_dir}/{os.path.splitext(os.path.basename(gds))[0]}_main.lyrdb" return klayout_gf180mcuD_rule_deck(
if os.path.exists(report_file): gds, top_module, "gf180mcuD", "all,-density,-antenna"
os.remove(report_file)
run_drc = f"{PDK_ROOT}/{PDK_NAME}/libs.tech/klayout/tech/drc/run_drc.py"
subprocess.run(
[
sys.executable,
run_drc,
f"--path={gds}",
f"--topcell={top_module}",
"--variant=D", # gf180mcuD: metal_top=11K, mim_option=B, metal_level=5LM
"--run_mode=deep",
"--thr=1", # single-threaded to work around a klayout deadlock bug
f"--run_dir={run_dir}",
],
) )
# run_drc.py exits non-zero on violations, so we judge the result from the
# report database it produces (matching the other klayout checks).
if not os.path.exists(report_file):
raise PrecheckFailure("Klayout gf180mcuD DRC did not produce a report")
check_drc_report("gf180mcuD DRC", report_file)
def klayout_checks(gds: str, expected_name: str, tech: str): def klayout_checks(gds: str, expected_name: str, tech: str):
layout = pya.Layout() layout = pya.Layout()
@@ -529,7 +521,7 @@ def main():
}, },
{ {
"name": "Antenna check", "name": "Antenna check",
"check": lambda: klayout_gf180mcuD_antenna(gds_file), "check": lambda: klayout_gf180mcuD_antenna(gds_file, top_module),
"techs": ["gf180mcuD"], "techs": ["gf180mcuD"],
}, },
{ {
-1
View File
@@ -3,7 +3,6 @@ name = "tt-precheck"
requires-python = ">=3.11" requires-python = ">=3.11"
dynamic = ["version"] dynamic = ["version"]
dependencies = [ dependencies = [
"docopt",
"gdstk", "gdstk",
"klayout>=0.28.17.post1,<0.29.0", "klayout>=0.28.17.post1,<0.29.0",
"numpy<2", "numpy<2",
+1 -1
View File
@@ -6,7 +6,7 @@ drc_zero_area.xml
drc_nwell_urpm.xml drc_nwell_urpm.xml
drc_sg13g2.xml drc_sg13g2.xml
drc_antenna.xml drc_antenna.xml
gf180mcuD_drc/ drc_gf180mcuD.xml
magic_drc.mag magic_drc.mag
magic_drc.txt magic_drc.txt
results.md results.md
-2
View File
@@ -6,8 +6,6 @@
# #
click==8.3.1 click==8.3.1
# via yowasp-yosys # via yowasp-yosys
docopt==0.6.2
# via tt-precheck (pyproject.toml)
gdstk==0.9.52 gdstk==0.9.52
# via tt-precheck (pyproject.toml) # via tt-precheck (pyproject.toml)
iniconfig==2.0.0 iniconfig==2.0.0
+3 -3
View File
@@ -975,14 +975,14 @@ def test_gf180mcuD_drc_pass(gds_gf180_drc_pass: str):
def test_gf180mcuD_drc_fail(gds_gf180_drc_fail: str): def test_gf180mcuD_drc_fail(gds_gf180_drc_fail: str):
with pytest.raises( with pytest.raises(
precheck.PrecheckFailure, precheck.PrecheckFailure,
match="Klayout gf180mcuD DRC failed with 1 DRC violations", match="Klayout gf180mcuD failed with 1 DRC violations",
): ):
precheck.klayout_gf180mcuD_drc(gds_gf180_drc_fail, "TEST_gf180_drc_fail") precheck.klayout_gf180mcuD_drc(gds_gf180_drc_fail, "TEST_gf180_drc_fail")
@gf180mcuD_only @gf180mcuD_only
def test_antenna_pass(gds_antenna_pass: str): def test_antenna_pass(gds_antenna_pass: str):
precheck.klayout_gf180mcuD_antenna(gds_antenna_pass) precheck.klayout_gf180mcuD_antenna(gds_antenna_pass, "TEST_antenna_pass")
@gf180mcuD_only @gf180mcuD_only
@@ -991,4 +991,4 @@ def test_antenna_fail(gds_antenna_fail: str):
precheck.PrecheckFailure, precheck.PrecheckFailure,
match="Klayout antenna failed with 1 DRC violations", match="Klayout antenna failed with 1 DRC violations",
): ):
precheck.klayout_gf180mcuD_antenna(gds_antenna_fail) precheck.klayout_gf180mcuD_antenna(gds_antenna_fail, "TEST_antenna_fail")