Repository navigation
Conversation
…elper The optional physical-design inputs had no default and were read through env_var_exists_and_non_empty. Give each one `default: ""` and read it as $::env(X). A single file that selects a step, or replaces the flow's own, is tested with `$::env(X) ne ""`: CDL_FILES, FASTROUTE_TCL, GLOBAL_CONNECT_TCL, MAKE_TRACKS, TAPCELL_TCL, MACRO_PLACEMENT_TCL, MACRO_WRAPPERS, LAYER_PARASITICS_FILE, SAIF_FILE, VCD_FILE and RCX_RULES. ADDITIONAL_LEFS, a list of files read with foreach, is read without a test (load.tcl, open.tcl, synth_syn.tcl). Every stage that reads each of them is in its stages: list, or the variable has none. TclContract.md gets the rule. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Øyvind Harboe <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request updates the Tcl scripts and variable definitions to align with a new contract regarding optional files and environment variables. Specifically, it documents that optional files should default to an empty string and be tested with ne "" only when their absence skips a step, while lists of files should be iterated over directly without guards. To implement this, default: "" was added to numerous variables in variables.yaml, redundant env_var_exists_and_non_empty checks around list iterations (like ADDITIONAL_LEFS) were removed, and other checks were simplified to direct $::env(VAR) ne "" comparisons. There are no review comments to evaluate, and the changes look clean and consistent.
🔍 QoR checkMetrics reflect the PR merge build — i.e. what will land on the target branch. Commit 62 design(s) checked — 0 with regression(s), 0 without a comparable baseline. ✅ QoR is compared against the master build at this PR's merge base |
The optional physical-design input files have no default in
variables.yaml, so every script that reads one guards it withenv_var_exists_and_non_empty. This gives each onedefault: ""and reads it as$::env(X).ADDITIONAL_LEFSload.tcl,open.tcl×2,synth_syn.tclforeach, no testGLOBAL_CONNECT_TCLfloorplan.tclne ""MAKE_TRACKSfloorplan.tclne ""(else the platform'smake_tracks.tcl, elsemake_tracks)FASTROUTE_TCLfloorplan.tclne ""(else the flow's layer adjustment)TAPCELL_TCLtapcell.tclne ""(elsecut_rows)MACRO_WRAPPERS,MACRO_PLACEMENT_TCLmacro_place_util.tclne ""LAYER_PARASITICS_FILEload.tcl,open.tclne ""(else the platform'ssetRC.tcl)SAIF_FILE,VCD_FILEreport_metrics.tclne ""(else vectorless power)RCX_RULESutil.tcl(final_extracts_parasitics)ne ""CDL_FILESgenerate_abstract.tclne ""A single file whose absence skips a step, or selects the flow's own, keeps an explicit
$::env(X) ne "".ADDITIONAL_LEFS, a list of files iterated withforeach, needs no test: an empty list does nothing.No in-tree config sets any of these to empty. A platform's
?=is evaluated beforedefaults.py, so a yamldefault: ""never overrides one, and the Makefile'sADDITIONAL_LEFS +=(blocks, wrapped macros) still appends. Every stage that reads each variable is in itsstages:list, or the variable has none, soerase_non_stage_variableskeeps it.FlowVariables.mdrendersdefault: ""as it renders no default, so it is unchanged.TclContract.mdgets the rule: an optional file defaults to""and is tested withne ""only where its absence skips a step; a list of files is spliced without a test. #4918 does the same for the synthesis inputs, with the same rule line; the two merge cleanly in either order.Why
Easier to read:
$::env(TAPCELL_TCL) ne ""says what it tests. Failures are hard and early: a misspelled or erased variable fails at the line that reads it. Today it is silently skipped, and the failure shows up later, elsewhere: withGLOBAL_CONNECT_TCLmissing, master stops in PDN onUnable to find power net: VDD. And fewer squirrels for AI to chase: a helper that asks "does it exist?" about a variable the flow always sets is a code path no CI run takes, and an agent reading the scripts chases it instead of the real problem.Test
Full flows to
6_report, master vs this branch, separate stages andKEEP_VARS=1, logs (runtimes, memory and paths dropped) and every stage metric compared:KEEP_VARS=1KEEP_VARS=1make_tracks.tclKEEP_VARS=1ADDITIONAL_LEFSKEEP_VARS=1ADDITIONAL_LEFS(fakeram)FASTROUTE_TCL= TAPCELL_TCL= RCX_RULES=KEEP_VARS=1cut_rows, no extraction (no6_final.spef)Other values, identical before and after (0 logs and 0 metrics differ in every row):
MACRO_PLACEMENT_TCLandMACRO_WRAPPERSset to small scripts (separate /KEEP_VARS=1): both are sourced beforertl_macro_placer.LAYER_PARASITICS_FILE=<the platform's setRC.tcl>toplace: sourced, results as the default.VCD_FILE/SAIF_FILEset:read_vcd/read_saifrun (on a missing file, so both stop there alike).MAKE_TRACKS=(no platformmake_tracks.tcl): the plainmake_tracks; nangate45/gcdGLOBAL_CONNECT_TCL=: noglobal_connect, PDN stops alike.generate_abstract(do-generate_abstracton the finished design):CDL_FILESempty writes no.cdl; set, both reachcdl read_masters(this OpenROAD build has nocdlcommand, so both stop there).Unset (OpenROAD started with the variable removed from its environment): master runs on, or fails later elsewhere (
GLOBAL_CONNECT_TCL: PDN-1002;MAKE_TRACKSon asap7: IFP-0039); this branch stops at the read,no such variable (read trace on "::env(X)"), for each of the twelve.tclint/tclfmt0.9.0 are clean;flow/testtest_generate_vars.pyandtest_make_issue.pypass; this merges cleanly with #4910, #4911, #4912, #4913, #4914 and #4915. (Every full-flow arm, before and after alike, stops at the final GDS merge, as the klayout Python module is not installed here.)🤖 Generated with Claude Code