Repository navigation
Conversation
The *_ARGS variables lacked a default and were read through
env_var_or_empty or env_var_exists_and_non_empty. Give each one
`default: ""` and read it as $::env(X): an argument list appended to a
command is spliced with {*}$::env(X), which splices nothing when the
list is empty, so no guard is needed. The four that replace the
arguments the flow would pass (CTS_ARGS, RTLMP_ARGS,
DETAILED_ROUTE_ARGS, SYNTH_OPERATIONS_ARGS) are tested with
`$::env(X) ne ""`.
Appended: BUFFER_PORTS_ARGS, GLOBAL_PLACEMENT_ARGS,
DETAIL_PLACEMENT_ARGS, PLACE_PINS_ARGS, SYNTH_ARGS,
SYNTH_VERILOG_SURGERY_ARGS. Every stage that reads each of them is
already in its stages: list, so erase_non_stage_variables keeps it.
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 contract documentation and refactors several Tcl scripts to simplify the handling of optional argument lists. Specifically, it removes the use of helper functions like env_var_or_empty and env_var_exists_and_non_empty in favor of direct environment variable splicing ({*}$::env(X)) and direct empty-string comparisons. To support this, default empty string values (default: "") have been added to the corresponding variables in variables.yaml. I have no feedback to provide as the changes are clean, consistent, and align perfectly with the updated style guidelines.
🔍 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
*_ARGSvariables have no default invariables.yaml, so every script that reads one guards it withenv_var_or_emptyorenv_var_exists_and_non_empty. This gives each onedefault: ""and reads it plainly. An argument list appended to a command is spliced with{*}$::env(X): an empty list splices to nothing, so no guard is needed at all.BUFFER_PORTS_ARGSglobal_place.tclenv_var_or_empty{*}$::env(X)GLOBAL_PLACEMENT_ARGSglobal_place.tcl,global_place_skip_io.tclenv_var_or_empty{*}$::env(X)DETAIL_PLACEMENT_ARGSutil.tcl(detailed_placement_helper)env_var_or_empty{*}$::env(X)PLACE_PINS_ARGSio_placement.tcl,util.tclenv_var_or_empty$::env(X)SYNTH_ARGSsynth.tclenv_var_or_empty$::env(X)SYNTH_VERILOG_SURGERY_ARGSutil.tclenv_var_or_empty{*}$::env(X)CTS_ARGScts.tclenv_var_exists_and_non_empty$::env(X) ne ""RTLMP_ARGSmacro_place_util.tclenv_var_exists_and_non_empty$::env(X) ne ""DETAILED_ROUTE_ARGSdetail_route.tclenv_var_exists_and_non_empty$::env(X) ne ""SYNTH_OPERATIONS_ARGSsynth.tclenv_var_exists_and_non_empty$::env(X) ne ""The last four replace the arguments the flow would pass (TclContract.md already says which
*_ARGSreplace and which append), so empty still means "use the flow's own" and they keep an explicitne ""test. Every stage that reads each variable is already in itsstages:list, soerase_non_stage_variableskeeps it. No in-treeconfig.mk, platform or AutoTuner setting sets any of them to empty.FlowVariables.mdrendersdefault: ""as it renders no default, so it is unchanged. (CLUSTER_FLOPS_ARGSalready hasdefault: ""; its guard is dropped in #4912.)TclContract.mdgets the rule: an optional argument list defaults to""and is spliced with{*}$::env(X); no guard is needed.Why
Easier to read:
{*}$::env(GLOBAL_PLACEMENT_ARGS)says what it does. Failures are hard and early: a misspelled or erased variable fails at the line that reads it, where today it silently passes nothing. And fewer squirrels for AI to chase: a helper call around a value that is always set 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=1-place_ios), dpl, cts, drtKEEP_VARS=1GPL_PLACE_IOS=0place_pinsin io_placementKEEP_VARS=1rtl_macro_placerNon-default values reach the command line, identically before and after (0 logs, 0 metrics differ):
BUFFER_PORTS_ARGS="-buffer_cell BUFx4_ASAP7_75t_R",GLOBAL_PLACEMENT_ARGS=-skip_initial_place,DETAIL_PLACEMENT_ARGS="-max_displacement 100",CTS_ARGS="... -sink_clustering_size 12",DETAILED_ROUTE_ARGS="-droute_end_iter 30 -drc_report_iter_step 5": the log showsglobal_placement ... -skip_initial_place,detailed_placement -max_displacement 100(placement and the CTS re-legalization),clock_tree_synthesis -sink_clustering_enable -repair_clock_nets -sink_clustering_size 12and the route arguments.PLACE_PINS_ARGS="-corner_avoidance 0":set_placer_config ... -io_pin_corner_avoidance 0; nangate45/gcdGPL_PLACE_IOS=0 PLACE_PINS_ARGS="-min_distance 2":place_pins ... -min_distance 2.SYNTH_ARGS=-nofsm SYNTH_OPERATIONS_ARGS=-boothwith a pass-throughSYNTH_VERILOG_SURGERYandSYNTH_VERILOG_SURGERY_ARGS="--tag hello"(separate /KEEP_VARS=1): no FSM pass, the BOOTH pass runs, the surgery script gets--tag hello.RTLMP_ARGS="-max_num_level 1 -target_util 0.5"(separate /KEEP_VARS=1):rtl_macro_placer -max_num_level 1 -target_util 0.5.SYNTH_OPERATIONS_ARGS=-booth): the BOOTH pass runs before and after. Its synthesis is not reproducible on master itself (two master runs: 17424 and 17466 instances), so it is not in the table.Unset in a
PRE_<STEP>_TCLhook (or aSYNTH_SCRIPTwrapper): master runs on with no arguments; this branch stops at the read,can't read "::env(X)": no such variable, for each of the ten.tclint/tclfmt0.9.0 are clean;flow/testtest_generate_vars.pyandtest_make_issue.pypass; this merges cleanly with #4910, #4911, #4912, #4913 and #4914. (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