Repository navigation
Conversation
…viewed against Write down the idioms flow/scripts/*.tcl keeps to as hard-stop rules, each with what breaks when it is broken, plus the review suggestions on these scripts that are declined again and again, so that a contributor's AI writes code consistent with the existing scripts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a new documentation file, TclContract.md, which outlines the rules, idioms, and guidelines for writing and reviewing stage scripts in flow/scripts/*.tcl. It also updates AGENTS.md, DeveloperGuide.md, and the table of contents (toc.yml) to reference this new contract. The review feedback focuses on improving readability by refining clunky phrasing in TclContract.md and DeveloperGuide.md, as well as ensuring formatting consistency for list items in the new contract.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
🔍 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. |
dsengupta0628
left a comment
There was a problem hiding this comment.
LGTM as a baseline. Two small things where the page currently describes the code incorrectly, so an agent following it would make wrong changes:
-
<STEP>_ARGS"replaces the arguments the flow would pass" is true only for some steps.CTS_ARGS,RTLMP_ARGSandDETAILED_ROUTE_ARGSreplace, butGLOBAL_PLACEMENT_ARGS(global_place.tcl:66),PLACE_PINS_ARGS,BUFFER_PORTS_ARGS,CLUSTER_FLOPS_ARGSandDETAIL_PLACEMENT_ARGS(util.tcl:52) append. Suggest "replaces or extends", or dropping that sentence, so an agent doesn't "fix" the appending steps into replacing ones. -
"A script never adds error numbers" cites
global_place.tclas the example, but that file hasutl::error GPL 200(an ORFS script using OpenROAD's GPL range). ORFS also already uses its ownFLWnumbers (util.tcl:182,util.tcl:237). Suggest rewording to "never uses a number from an OpenROAD module's range (FLWis ORFS's)", or dropping the rule for now.
…numbers <STEP>_ARGS was described as replacing the flow's arguments, which only CTS_ARGS, RTLMP_ARGS and DETAILED_ROUTE_ARGS do; the others are appended. The rule now names both, and that a change never switches one into the other. The error-number rule keeps its point and says why: message IDs are OpenROAD's, unique per tool and checked there; nothing checks ORFS's, whose errors come from many tools. FLW 25 already names two messages, and GPL 200 sits in GPL's own range. The numbered messages already in the scripts stay until a change of their own removes them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
|
@dsengupta0628 thanks, both checked against the scripts.
|
The stage scripts in
flow/scripts/*.tclkeep to idioms that have grown up in review and were never written down. This writes them down indocs/contrib/TclContract.mdas hard-stop rules, so that a contributor's AI writes stage-script code that is congruent with the existing scripts, and automated review has something to check against. The goal is more contributor autonomy: fewer review rounds spent restating the same conventions. Each rule says what breaks when it is broken.util.tclhelpers (append_env_var,log_cmd,orfs_write_db/orfs_write_sdc) rather than writing them again; a command's arguments go throughlog_cmdso the log shows the full command line that a user copies into<STEP>_ARGS; procs take arguments rather than globals, and state that crosses steps lives in the.odb; never repeat an OpenROAD default; an explicit flag over a sentinel value; plain Tcl astclint/tclfmtcheck it.variables.yaml, a declared input file); a failing step writes<step>-failed.odband callserror, never the success artifact; no error numbers or tool checks in ORFS.open.tclnever writes a file; a refactor never changes behavior.file existschecks,error $msg $::errorInfo, prefixingRESULTS_DIRwithout reading the callee, "robustness" for cases the flow does not have, and untested yosysselectrewrites. It also says which suggestions are worth taking.The rules come from review threads on
flow/scripts/*.tcl, among them #4563, #4543, #4416, #4365, #4619, #4688, #4685, #4418, #3680, #4168, #3076, #2700, #3330, #3610, #1652, #2100, #2236, #1596, #2610, #4486, #4212 and #4179. Existing code that breaks a rule is technical debt, not precedent.The page links to the Makefile contract (#4689) for the step and variable rules, which apply to the stage scripts too and are not repeated. The two PRs are independent and merge without conflict; this one's link to
MakefileContract.mdresolves once #4689 is merged.AGENTS.mdgets one line pointing agents at the page, and the Developer's Guide anddocs/toc.ymllist it.Documentation only.
🤖 Generated with Claude Code