mirror of
https://github.com/TinyTapeout/tt-support-tools.git
synced 2026-11-03 04:36:09 +01:00
feat(precheck): allow more customization for run_klayout()
This commit is contained in:
+21
-12
@@ -74,18 +74,15 @@ def magic_drc(gds: str, toplevel: str):
|
|||||||
raise PrecheckFailure("Magic DRC failed")
|
raise PrecheckFailure("Magic DRC failed")
|
||||||
|
|
||||||
|
|
||||||
def klayout_drc(gds: str, check: str, script=f"{PDK_NAME}_mr.drc", extra_vars=[]):
|
def klayout_custom_drc(
|
||||||
logging.info(f"Running klayout {check} on {gds}")
|
check: str, script_path: str, script_vars: dict[str, str], report_vars: list[str]
|
||||||
|
):
|
||||||
report_file = f"{REPORTS_PATH}/drc_{check}.xml"
|
report_file = f"{REPORTS_PATH}/drc_{check}.xml"
|
||||||
script_vars = [
|
klayout_args = ["klayout", "-b", "-r", script_path]
|
||||||
f"{check}=true",
|
for k, v in script_vars.items():
|
||||||
f"input={gds}",
|
klayout_args.extend(["-rd", f"{k}={v}"])
|
||||||
f"report={report_file}",
|
for k in report_vars:
|
||||||
f"report_file={report_file}",
|
klayout_args.extend(["-rd", f"{k}={report_file}"])
|
||||||
]
|
|
||||||
klayout_args = ["klayout", "-b", "-r", f"tech-files/{script}"]
|
|
||||||
for v in script_vars + extra_vars:
|
|
||||||
klayout_args.extend(["-rd", v])
|
|
||||||
klayout = subprocess.run(klayout_args)
|
klayout = subprocess.run(klayout_args)
|
||||||
if klayout.returncode != 0:
|
if klayout.returncode != 0:
|
||||||
raise PrecheckFailure(f"Klayout {check} failed")
|
raise PrecheckFailure(f"Klayout {check} failed")
|
||||||
@@ -99,6 +96,18 @@ def klayout_drc(gds: str, check: str, script=f"{PDK_NAME}_mr.drc", extra_vars=[]
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def klayout_drc(gds: str, check: str, script=f"{PDK_NAME}_mr.drc", extra_vars=[]):
|
||||||
|
logging.info(f"Running klayout {check} on {gds}")
|
||||||
|
if "/" not in script:
|
||||||
|
script = f"tech-files/{script}"
|
||||||
|
script_vars = {
|
||||||
|
check: "true",
|
||||||
|
"input": gds,
|
||||||
|
}
|
||||||
|
script_vars.update(extra_vars)
|
||||||
|
klayout_custom_drc(check, script, script_vars, ["report", "report_file"])
|
||||||
|
|
||||||
|
|
||||||
def klayout_zero_area(gds: str):
|
def klayout_zero_area(gds: str):
|
||||||
return klayout_drc(gds, "zero_area", "zeroarea.rb.drc")
|
return klayout_drc(gds, "zero_area", "zeroarea.rb.drc")
|
||||||
|
|
||||||
@@ -234,7 +243,7 @@ def cell_name_check(gds: str):
|
|||||||
|
|
||||||
def urpm_nwell_check(gds: str, top_module: str):
|
def urpm_nwell_check(gds: str, top_module: str):
|
||||||
"""Run a DRC check for urpm to nwell spacing."""
|
"""Run a DRC check for urpm to nwell spacing."""
|
||||||
extra_vars = [f"thr={os.cpu_count()}", f"top_cell={top_module}"]
|
extra_vars = {"thr": os.cpu_count(), "top_cell": top_module}
|
||||||
klayout_drc(
|
klayout_drc(
|
||||||
gds=gds, check="nwell_urpm", script="nwell_urpm.drc", extra_vars=extra_vars
|
gds=gds, check="nwell_urpm", script="nwell_urpm.drc", extra_vars=extra_vars
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user