Repository navigation
Conversation
Thirteen optional values read by repair, global and detailed route, the timing load and the reports have no default in variables.yaml; their absence means "let the tool choose". Give each `default: ""`, except ABSTRACT_SOURCE, whose fallback is the flow's own: it gets `default: 6_final` and generate_abstract.tcl reads it plainly. The `if` guards become `$::env(X) ne ""`, which keeps exactly what the helpers tested; the `append_env_var ... 1` calls are left alone, as an empty value passes nothing there. 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 establishes a cleaner contract for optional flow variables by defining explicit default values (such as "" or "6_final") in variables.yaml and updating the documentation in TclContract.md and FlowVariables.md. Tcl scripts (generate_abstract.tcl, global_route.tcl, load.tcl, open.tcl, and report_metrics.tcl) are simplified to directly reference
🔍 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 |
Thirteen optional values read by repair, global and detailed route, the timing load and the reports have no default in
variables.yaml; their absence means "let the tool choose", and every read is guarded. This gives each onedefault: "". Where the value decides whether an option is passed, the guard becomes an explicit$::env(X) ne "", which is exactly what the helper tested; where it goes throughappend_env_var ... 1, the call is left alone, as an empty value passes nothing there.ABSTRACT_SOURCEis the exception: its fallback,6_final, is the flow's own, not the tool's, so it becomes thevariables.yamldefault andgenerate_abstract.tclreads the variable plainly.FlowVariables.mdnow shows it.GRT_SEEDglobal_route.tclne ""(set_global_routing_random -seed), wasenv_var_or_emptyinto a localWIRE_LOAD_MODELload.tcl,open.tclne ""(set_wire_load_model)POWER_FILE_SCOPEreport_metrics.tclne ""(-scope)ABSTRACT_SOURCEgenerate_abstract.tcldefault: 6_final, plain readSETUP_MOVE_SEQUENCE,SETUP_REPAIR_PHASES,CAP_MARGIN,SLEW_MARGINutil.tcl(repair helpers)append_env_var ... 1)VIA_IN_PIN_MIN_LAYER,VIA_IN_PIN_MAX_LAYERglobal_route.tcl,detail_route.tclOR_SEED,OR_K,REPAIR_PDN_VIA_LAYERdetail_route.tclNo in-tree config sets any of the thirteen to empty, so nothing relies on empty meaning something else than unset. Platform and design values are unaffected: their
config.mkis read before thevariables.yamldefaults, and the defaults assign with?=. Every stage that reads each variable is in itsstages:list, or the variable has nostages:list (REPAIR_PDN_VIA_LAYER,CAP_MARGIN,SLEW_MARGIN,WIRE_LOAD_MODEL,POWER_FILE_SCOPE). The one gap,SETUP_MOVE_SEQUENCElackingplace(read there withENABLE_PLACE_REPAIR_TIMING=1), is #4917's line and is left to it;append_env_varstill guards that read, so nothing changes there.TclContract.mdgets the rule: an optional value the tool chooses when it is absent defaults to""and is tested withne ""where it decides whether an option is passed. #4922, the same cleanup for the synth..cts values, adds the same line.Why
Easier to read:
if { $::env(GRT_SEED) ne "" }says what it tests, without a local copy. Failures are hard and early: a misspelled or erased variable fails at the line that reads it, where today it silently lets the tool choose. And fewer squirrels for AI to chase: anexprternary that supplies6_finalbehind a guard is a default hiding in a script, wherevariables.yamlandFlowVariables.mddo not show it.Test
Full flows to
6_report, master vs this branch, logs (runtimes, memory and paths dropped) and every stage metric compared:SETUP_REPAIR_PHASES)KEEP_VARS=1KEEP_VARS=1KEEP_VARS=1On nangate45/gcd, set values take effect, identically before and after (0 logs, 0 metrics differ):
GRT_SEED=42:set_global_routing_random -seed 42at grt.OR_SEED=7:-or_seed 7indetailed_route.WIRE_LOAD_MODEL=5K_hvratio_1_1:set_wire_load_model -name 5K_hvratio_1_1in every stage through floorplan, and inopen.tcl(make open_floorplan GUI_TIMING=1).make generate_abstractafter the full flow loads6_final.odbby default and4_cts.odbwithABSTRACT_SOURCE=4_cts; the.lefand.libare byte-identical before and after.POWER_FILE_SCOPE, called throughget_power_file_scope_args(nothing in-tree setsSAIF_FILEorVCD_FILE):tb/dut.core[0]gives-scope {tb/dut\.core\[0\]}and""gives no option, before and after.Unset in the tool's environment: master runs on (the tool chooses,
ABSTRACT_SOURCEfalls back to6_final); this branch stops at the read,can't read "::env(X)": no such variable:GRT_SEEDin5_1_grt,WIRE_LOAD_MODELin1_synth(the firstload.tcl) and inopen.tcl,POWER_FILE_SCOPEin the firstreport_metrics(2_1_floorplan),ABSTRACT_SOURCEingenerate_abstract. The nineappend_env_varvariables still pass nothing when unset; that helper's guard is a separate change.tclint/tclfmt0.9.0 are clean;flow/testtest_generate_vars.pyandtest_make_issue.pypass; this merges cleanly with each of #4910-#4920, and with the other open Tcl cleanup branches.🤖 Generated with Claude Code