Skip to content

Commit

Permalink
feat(precheck): add warning for flattened cells
Browse files Browse the repository at this point in the history
Flattened sky130 devices in analog layouts can lead to DRC errors.
They are difficult to test for, so as a heuristic we add a warning when magic DRC fails _and_ there are no unflattened sky130 cells.
  • Loading branch information
htamas committed Feb 26, 2024
1 parent f6fae27 commit c1c2995
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions precheck/precheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import klayout.db as pya
import klayout.rdb as rdb
from klayout_tools import parse_lyp_layers
import gdstk

PDK_ROOT = os.getenv("PDK_ROOT")
PDK_NAME = os.getenv("PDK_NAME") or "sky130A"
Expand All @@ -25,6 +26,13 @@ class PrecheckFailure(Exception):
pass


def has_sky130_devices(gds: str):
for cell_name in gdstk.read_rawcells(gds):
if cell_name.startswith('sky130_fd_'):
return True
return False


def magic_drc(gds: str, toplevel: str):
logging.info(f"Running magic DRC on {gds} (module={toplevel})")

Expand All @@ -45,6 +53,8 @@ def magic_drc(gds: str, toplevel: str):
)

if magic.returncode != 0:
if not has_sky130_devices(gds):
logging.warning("No sky130 devices present - was the design flattened?")
raise PrecheckFailure("Magic DRC failed")


Expand Down

0 comments on commit c1c2995

Please sign in to comment.