Repository navigation
Conversation
erase_non_stage_variables unsets a variable in every stage its stages: list leaves out, unless KEEP_VARS=1. A variable read in a stage it does not list is silently dropped there in the staged flow: - SETUP_SLACK_MARGIN, HOLD_SLACK_MARGIN and SETUP_MOVE_SEQUENCE lacked place, where resize.tcl runs repair_timing_helper when ENABLE_PLACE_REPAIR_TIMING=1. - FOOTPRINT and FOOTPRINT_TCL lacked place, where global_place.tcl and pins_fixed_in_floorplan (io_placement.tcl, global_place.tcl) read them: the pins a footprint placed were placed again, and the ports buffered. check-variable-stages.py scans the stage scripts, what they source and the procs they call, and fails when one reads a variable whose stages: list leaves its stage out. The variables.yaml CI job runs it. 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 introduces a new CI check script, check-variable-stages.py, which statically scans Tcl scripts to ensure that any environment variables they read are correctly listed in the stages section of variables.yaml. It also updates the documentation and adds the place stage to several variables in variables.yaml to resolve mismatches. The review feedback identifies opportunities to improve the robustness of the new Python script, specifically by adding bounds checking in word_end to prevent potential IndexError crashes, and handling cases where a variable entry in variables.yaml might be parsed as None to avoid an AttributeError.
The check correctly reports the stage lines The-OpenROAD-Project#4910 and The-OpenROAD-Project#4911 add, so it fails until they land. This PR keeps the stage-list fixes and the rule; the check and its CI step follow once those have merged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Øyvind Harboe <[email protected]>
🔍 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
stages:list invariables.yamlis not just documentation:erase_non_stage_variables <stage>(util.tcl) unsets every variable whoselist leaves out the running stage, unless
KEEP_VARS=1. A variable read in astage it does not list is silently dropped there in the staged flow, and the
staged flow and
KEEP_VARS=1disagree.This adds the missing stages. A CI check that keeps the lists complete
follows in a separate PR once #4910 and #4911 have merged (see below).
Fixes
SETUP_SLACK_MARGIN,HOLD_SLACK_MARGIN,SETUP_MOVE_SEQUENCErepair_timing_helper, whichresize.tclruns whenENABLE_PLACE_REPAIR_TIMING=1FOOTPRINT,FOOTPRINT_TCLglobal_place.tcl(port buffering) andpins_fixed_in_floorplan(io_placement.tcl,global_place.tcl)A static scan (to become the follow-up CI check) finds seven more, which
open PRs already fix:
MATCH_CELL_FOOTPRINTat grt (#4910, #4911) and thesix
SKIP_*repair_timing flags at place (#4911). This PR leaves those linesto them, so it stays independent of both.
docs/user/FlowVariables.mdisgenerated, so whichever PR lands second regenerates it.
VERILOG_TOP_PARAMS(synth only) is read bydesigns/asap7/chi_async_bridge/constraint.sdc. That needs no change: theSDC's Tcl runs only at synth, and floorplan reads the
1_synth.sdcthatOpenSTA writes, which has no Tcl in it (see Test).
The check (follow-up)
A static scan of
flow/scripts/*.tclthat maps each stage script, the filesit sources and the procs it calls to the
::env(X)reads in them, andcompares them with
stages:. It reports exactly the seven lines above, soadding it to CI here would fail until #4910 and #4911 land; it follows as its
own PR then.
TclContract.mdgets the rule: a variable that lists stages names every stagethat reads it.
Why
stages:says where a variable takes effect, and now thatis true.
variable it does not list fails there, instead of quietly running with the
variable unset.
SETUP_SLACK_MARGINis ignored atplace, but only without
KEEP_VARS=1" is a long afternoon for anyone, humanor agent.
Test
Local
makewith the same OpenROAD and yosys binaries for master and thisbranch.
Place repair_timing, asap7/gcd,
ENABLE_PLACE_REPAIR_TIMING=1 SETUP_SLACK_MARGIN=5 HOLD_SLACK_MARGIN=3 SETUP_MOVE_SEQUENCE=sizeup,swap SKIP_GATE_CLONING=1, the command in3_4_place_resized.log:The
SKIP_*flags are still dropped at place until #4911.FOOTPRINT at place: asap7/gcd placed, then
make do-3_2_place_iop do-3_3_place_gp FOOTPRINT=/dev/null(the file is not read at place):FOOTPRINTis unset at place, so the ports are buffered("Perform port buffering...") and
global_placement ... -place_iosplacesthe pins again.
KEEP_VARS=1and this PR, staged: no port buffering, no-place_ios. gcd has no footprint, so its pins are unplaced and GPL stopswith
GPL-0326 clk toplevel port is not placed, which is what this setupshould do.
ihp-sg13g2/i2c-gpio-expander (
FOOTPRINT_TCL, withBLOCKS=to keep itflat), through place: on master, staged,
io_placement.tclrunsplace_pins; withKEEP_VARS=1and on this branch it does not. Hereplace_pinsfinds 0 I/Os, so the results are the same.VERILOG_TOP_PARAMS: asap7/chi_async_bridge
FLOW_VARIANT=small(
DEPTH 4), staged, through floorplan: synth passes the SDC's synchronisercheck for DEPTH 4, and
1_synth.sdc, which floorplan reads, is OpenSTA'soutput with no Tcl in it. Negative control: rerunning synth with
VERILOG_TOP_PARAMS=fails withexpected 134 chains, found 86, theDEPTH 16 count, so the SDC reads the variable at synth, where it is listed.
Default path unchanged: nangate45/gcd, asap7/gcd and sky130hd/gcd
through
6_report, staged andKEEP_VARS=1, master vs this branch. Allstage logs are identical once runtimes and paths are removed, and every
metric is identical.
Scan: on master it reports the five variables fixed here and the seven
in #4910/#4911. On this branch it reports those seven only. Merged with
#4910 and #4911 it passes. It also passes on this branch merged with each of
the other open Tcl-cleanup branches together with those two.
🤖 Generated with Claude Code