Skip to content

lec: declare KEPLER_FORMAL_EXE and REMOVE_LIBS_FOR_LEC, read RUN_CMD plainly - #4928

Open
oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
oharboe:tcl-lec-vars
Open

oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
oharboe:tcl-lec-vars

Conversation

@oharboe

@oharboe oharboe commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

What

Three variables formal_check.tcl reads, made plain:

  • KEPLER_FORMAL_EXE gets a variables.yaml entry (stages synth, cts, final). variables.mk keeps supplying it with ?=, so the entry has no default. check_kepler_formal drops its info exists and keeps the hard error for a missing executable.
  • REMOVE_LIBS_FOR_LEC gets an entry with default: "" (stages cts, final, where write_lec_script runs). write_lec_script filters LIB_FILES without a test: an empty list removes nothing.
  • RUN_CMD: flow.sh exports the RUN_CMD it defaults, as variables.mk already does, and run_kepler_formal reads $::env(RUN_CMD) instead of carrying its own copy of that default ($PYTHON_EXE $SCRIPTS_DIR/run_command.py, the same in all three places). RUN_CMD stays out of variables.yaml: it is the Makefile's (MakefileContract.md). test_flow_sh.py gets a test that the stage sees it; it fails on master.

FlowVariables.md is regenerated for the two new entries. The rules are already proposed in #4912 (a variable the flow guarantees is read as $::env(X)) and #4920 (an optional list is iterated without a test), so no new TclContract.md line.

No behavior change.

Why

  • Easier to read: run_kepler_formal is three lines, and the default for RUN_CMD lives in one place per entry point.
  • Hard, early failures: an unset RUN_CMD or REMOVE_LIBS_FOR_LEC fails at the read, instead of a fallback no CI run exercises.
  • Fewer squirrels for AI to chase: KEPLER_FORMAL_EXE was read by the scripts and named in LEC_CHECK's default without being declared anywhere an agent looks for variables.

Test

formal_check.tcl's procs on their own, in OpenROAD, with a stand-in kepler-formal (records its arguments, writes a check log with no differences):

case master this branch
defaults (RUN_CMD as make sets it, REMOVE_LIBS_FOR_LEC="") 3 of 3 libraries in the config, kepler-formal runs same
RUN_CMD a wrapper the wrapper runs kepler-formal same
REMOVE_LIBS_FOR_LEC one library 2 of 3 same
RUN_CMD unset falls back to its own default can't read "::env(RUN_CMD)": no such variable
REMOVE_LIBS_FOR_LEC unset all 3 can't read "::env(REMOVE_LIBS_FOR_LEC)": no such variable
KEPLER_FORMAL_EXE unset "Kepler Formal not found..." can't read "::env(KEPLER_FORMAL_EXE)": no such variable
KEPLER_FORMAL_EXE not executable "Kepler Formal not found..." same

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

design flow covers logs differing metrics differing
nangate45/gcd separate / KEEP_VARS=1, to 6_report LEC_CHECK=0 (no kepler-formal installed): write_lec_verilog only 0 / 0 (of 20) 0 / 0
nangate45/gcd, LEC_CHECK=1, stand-in kepler-formal separate / KEEP_VARS=1 run_lec_test at cts and final through RUN_CMD: "passed lec test" twice 0 / 1 (of 24, see below) 0 / 0
asap7/gcd, LEC_CHECK=1, stand-in separate same, 5 libraries 0 (of 22) 0

The one log line that differs, in the KEEP_VARS=1 run's 6_report.log, is the elapsed-time summary row of a sub-second step. With REMOVE_LIBS_FOR_LEC naming one asap7 library, both write 4 of the 5 libraries into the cts and final configs. With RUN_CMD removed from OpenROAD's environment at cts, master falls back and passes, this branch stops at the read.

flow.sh run by hand, the way make vars sets it up (vars.sh leaves out *_CMD, so RUN_CMD is unset): source vars.sh; flow.sh 4_1_cts cts with LEC_CHECK=1 passes on master and on this branch. As a negative control, master's flow.sh with this branch's scripts stops at $::env(RUN_CMD): the export is what carries it. test_flow_sh.py's new test fails on master's flow.sh and passes here; the other three still pass.

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

🤖 Generated with Claude Code

…plainly

- KEPLER_FORMAL_EXE gets a variables.yaml entry. variables.mk keeps
  supplying it, so it has no default there; check_kepler_formal drops
  its `info exists` and keeps the hard error for a missing executable.
- REMOVE_LIBS_FOR_LEC gets an entry with default "", and
  write_lec_script filters LIB_FILES without a test: an empty list
  removes nothing.
- flow.sh exports the RUN_CMD it defaults, as variables.mk already
  does, and run_kepler_formal reads $::env(RUN_CMD) instead of carrying
  its own copy of that default. test_flow_sh.py checks that the stage
  sees 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 exports the RUN_CMD environment variable in flow.sh and defines KEPLER_FORMAL_EXE and REMOVE_LIBS_FOR_LEC in variables.yaml with default values. Consequently, the conditional checks for these variables in formal_check.tcl have been simplified, relying on their guaranteed existence. Additionally, documentation for these variables has been added to FlowVariables.md, and a new test has been introduced in test_flow_sh.py to verify RUN_CMD propagation. I have no feedback to provide as the changes are clean, correct, and align with the repository's style guidelines.

@oharboe
oharboe marked this pull request as ready for review December 1, 2026 11:21
@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 fb00a7f · 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