feat(precheck): add warning for flattened cells

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.
This commit is contained in:
htamas
2024-02-26 08:46:49 +02:00
committed by Uri Shaked
parent f6fae279c1
commit 18c67d9a7e
2 changed files with 11 additions and 0 deletions
+10
View File
@@ -7,6 +7,7 @@ import time
import traceback import traceback
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
import gdstk
import klayout.db as pya import klayout.db as pya
import klayout.rdb as rdb import klayout.rdb as rdb
from klayout_tools import parse_lyp_layers from klayout_tools import parse_lyp_layers
@@ -25,6 +26,13 @@ class PrecheckFailure(Exception):
pass 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): def magic_drc(gds: str, toplevel: str):
logging.info(f"Running magic DRC on {gds} (module={toplevel})") 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 magic.returncode != 0:
if not has_sky130_devices(gds):
logging.warning("No sky130 devices present - was the design flattened?")
raise PrecheckFailure("Magic DRC failed") raise PrecheckFailure("Magic DRC failed")
+1
View File
@@ -1,2 +1,3 @@
klayout==0.28.12 klayout==0.28.12
gdstk==0.9.50
pytest==7.4.3 pytest==7.4.3