Skip to content

synth: UNSET_ABC9_BOX_CELLS defaults to "" and is tested for a value - #4927

Open
oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
oharboe:tcl-abc9-box
Open

oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
oharboe:tcl-abc9-box

Conversation

@oharboe

@oharboe oharboe commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

What

UNSET_ABC9_BOX_CELLS now has default: "" in variables.yaml, and synth_stdcells.tcl runs setattr -mod -unset abc9_box only when the variable names something: $::env(UNSET_ABC9_BOX_CELLS) ne "" instead of [info exists ::env(UNSET_ABC9_BOX_CELLS)].

What an empty value did before

With info exists, a set but empty value ran setattr -mod -unset abc9_box with no selection, which is yosys's current selection. At that point only the liberty cells are loaded, and they are all boxed modules (-lib, -wb), which yosys's default selection leaves out. So the command did nothing: checked with yosys 0.68 on the asap7 libraries, 56 cells carry abc9_box before and after, and a nangate45/gcd and asap7/gcd yosys synthesis with the variable empty gives the same netlist as with it unset. The empty case worked by that rule of yosys's; ne "" says it instead.

One more thing the same check shows, not changed here: a plain cell name selects no boxed module either, so UNSET_ABC9_BOX_CELLS=XOR2xp5_ASAP7_75t_R leaves its abc9_box set; =XOR2xp5_ASAP7_75t_R clears it. No configuration in the tree sets the variable.

FlowVariables.md renders default: "" as it renders no default, so it is unchanged. The rule is already proposed in #4912 (a variable with a default is read as $::env(X)) and #4920 (an optional list whose emptiness skips a step is tested with ne ""), so no new TclContract.md line.

No behavior change.

Why

  • Easier to read: ne "" says "only if it names cells"; info exists left the reader to find out what an empty selection means to setattr.
  • Hard, early failures: a misspelled or erased variable fails at the line that reads it.
  • Fewer squirrels for AI to chase: "does an empty value strip abc9_box from every cell?" took a yosys run to answer; now the script answers it.

Test

The script on its own, in yosys 0.68 with two asap7 libraries (synth_stdcells.tcl sourced, then the cells that carry abc9_box counted):

UNSET_ABC9_BOX_CELLS master this branch
unset 56 cells keep abc9_box can't read "::env(UNSET_ABC9_BOX_CELLS)": no such variable
empty 56 56
XOR2xp5_ASAP7_75t_R 56 (still on XOR2xp5) 56 (still on XOR2xp5)
=XOR2xp5_ASAP7_75t_R 55 (cleared on XOR2xp5) 55 (cleared on XOR2xp5)

Flows, master vs this branch, logs (runtimes, memory and paths dropped) and every stage metric compared:

design flow logs differing metrics differing
nangate45/gcd separate / KEEP_VARS=1, to 6_report 0 / 0 (of 20) 0 / 0
sky130hd/gcd synthesis 0 0
asap7/gcd, SYNTH_USE_SYN=0 (asap7 synthesizes with syn by default, which does not read this script) synthesis 0 0

The yosys netlists (1_2_yosys.v) are identical apart from the source paths in src attributes. With the variable empty, nangate45/gcd and asap7/gcd synthesize the same netlist as with it unset, on master and on this branch. With it unset, this branch stops synthesis at the read, as in the table.

tclint/tclfmt 0.9.0 are clean on the changed file; this merges cleanly with #4910-#4924.

🤖 Generated with Claude Code

UNSET_ABC9_BOX_CELLS now defaults to "" in variables.yaml, and
synth_stdcells.tcl runs `setattr -mod -unset abc9_box` only when it
names something: `$::env(UNSET_ABC9_BOX_CELLS) ne ""` instead of
`info exists`.

Before, a set but empty value ran setattr with no selection. Yosys's
default selection leaves out the liberty cells, which are all boxed
modules at that point, so the command did nothing; the explicit test
says so instead of relying on it. No behavior change.

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 adds a default empty string value to the UNSET_ABC9_BOX_CELLS variable in flow/scripts/variables.yaml and updates the conditional check in flow/scripts/synth_stdcells.tcl to verify that the environment variable is not empty instead of just checking its existence. I have no feedback to provide.

@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 c28a6ab · 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