Skip to content

flow: optional physical input files default to "" and are read without a helper - #4919

Open
oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
oharboe:tcl-defaults-files-physical
Open

oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
oharboe:tcl-defaults-files-physical

Conversation

@oharboe

@oharboe oharboe commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

The optional physical-design input files have no default in variables.yaml, so every script that reads one guards it with env_var_exists_and_non_empty. This gives each one default: "" and reads it as $::env(X).

variable script now
ADDITIONAL_LEFS load.tcl, open.tcl ×2, synth_syn.tcl foreach, no test
GLOBAL_CONNECT_TCL floorplan.tcl ne ""
MAKE_TRACKS floorplan.tcl ne "" (else the platform's make_tracks.tcl, else make_tracks)
FASTROUTE_TCL floorplan.tcl ne "" (else the flow's layer adjustment)
TAPCELL_TCL tapcell.tcl ne "" (else cut_rows)
MACRO_WRAPPERS, MACRO_PLACEMENT_TCL macro_place_util.tcl ne ""
LAYER_PARASITICS_FILE load.tcl, open.tcl ne "" (else the platform's setRC.tcl)
SAIF_FILE, VCD_FILE report_metrics.tcl ne "" (else vectorless power)
RCX_RULES util.tcl (final_extracts_parasitics) ne ""
CDL_FILES generate_abstract.tcl ne ""

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 with foreach, needs no test: an empty list does nothing.

No in-tree config sets any of these to empty. A platform's ?= is evaluated before defaults.py, so a yaml default: "" never overrides one, and the Makefile's ADDITIONAL_LEFS += (blocks, wrapped macros) still appends. Every stage that reads each variable is in its stages: list, or the variable has none, so erase_non_stage_variables keeps it. FlowVariables.md renders default: "" as it renders no default, so it is unchanged.

TclContract.md gets the rule: an optional file defaults to "" and is tested with ne "" 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: with GLOBAL_CONNECT_TCL missing, master stops in PDN on Unable 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 and KEEP_VARS=1, logs (runtimes, memory and paths dropped) and every stage metric compared:

design flow covers logs differing metrics differing
asap7/gcd separate / KEEP_VARS=1 platform global connect, tracks, FastRoute, tapcell, RCX rules 0 / 0 0 / 0
nangate45/gcd separate / KEEP_VARS=1 same, the platform's make_tracks.tcl 0 / 0 0 / 0
sky130hd/gcd separate same 0 0
gt2n/gcd separate / KEEP_VARS=1 platform ADDITIONAL_LEFS 0 / 0 0 / 0
asap7/riscv32i separate / KEEP_VARS=1 macros: ADDITIONAL_LEFS (fakeram) 0 / 0 0 / 0
nangate45/gcd FASTROUTE_TCL= TAPCELL_TCL= RCX_RULES= separate / KEEP_VARS=1 the flow's own layer adjustment, cut_rows, no extraction (no 6_final.spef) 0 / 0 0 / 0

Other values, identical before and after (0 logs and 0 metrics differ in every row):

  • asap7/riscv32i MACRO_PLACEMENT_TCL and MACRO_WRAPPERS set to small scripts (separate / KEEP_VARS=1): both are sourced before rtl_macro_placer.
  • nangate45/gcd LAYER_PARASITICS_FILE=<the platform's setRC.tcl> to place: sourced, results as the default.
  • nangate45/gcd VCD_FILE / SAIF_FILE set: read_vcd / read_saif run (on a missing file, so both stop there alike).
  • asap7/gcd MAKE_TRACKS= (no platform make_tracks.tcl): the plain make_tracks; nangate45/gcd GLOBAL_CONNECT_TCL=: no global_connect, PDN stops alike.
  • nangate45/gcd generate_abstract (do-generate_abstract on the finished design): CDL_FILES empty writes no .cdl; set, both reach cdl read_masters (this OpenROAD build has no cdl command, 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_TRACKS on asap7: IFP-0039); this branch stops at the read, no such variable (read trace on "::env(X)"), for each of the twelve.

tclint/tclfmt 0.9.0 are clean; flow/test test_generate_vars.py and test_make_issue.py pass; 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

…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]>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@openroad-ci

openroad-ci commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

🔍 QoR check

Metrics reflect the PR merge build — i.e. what will land on the target branch.

Commit 9307d10 · Jenkins build #1 · Baseline: build · View build on dashboard

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 58710a4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants