diff --git a/precheck/precheck.py b/precheck/precheck.py index 3e5cf13..366d3bc 100644 --- a/precheck/precheck.py +++ b/precheck/precheck.py @@ -7,6 +7,7 @@ import time import traceback import xml.etree.ElementTree as ET +import gdstk import klayout.db as pya import klayout.rdb as rdb from klayout_tools import parse_lyp_layers @@ -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})") @@ -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") diff --git a/precheck/requirements.txt b/precheck/requirements.txt index 8ec6d50..49b91b5 100644 --- a/precheck/requirements.txt +++ b/precheck/requirements.txt @@ -1,2 +1,3 @@ klayout==0.28.12 +gdstk==0.9.50 pytest==7.4.3