Repository navigation
AUTO_MEMORIES: a macro's blackbox costs its generated view's area - #4650
Conversation
With SYNTH_MINIMUM_KEEP_SIZE, synthesis decides which modules to keep with keep_hierarchy -min_cost, which needs a cost for every instanced blackbox. convert_liberty_areas gives Liberty cells one, as a gate equivalent of their area, but an AUTO_MEMORIES macro is a blackbox made from the RTL's own module and has none: any AUTO_MEMORIES design with a keep threshold stopped with "Missing cost information on instanced blackbox". asap7/riscv32i is such a design once its register file is a macro (AUTO_MEMORIES_REGFILES). Each AUTO_MEMORIES blackbox now gets the gate equivalent of the area its generated .lib states. The view is not read in the module's place: its pins need not be the module's (FakeRAM names its own). 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 updates flow/scripts/synth_preamble.tcl to parse the area of AUTO_MEMORIES blackboxes from their generated Liberty files and assign their gate_cost_equivalent attribute. Feedback on this change highlights that the regular expression used to parse the .lib file is fragile because it can fail on nested groups or special characters in module names, and suggests a more robust regex pattern.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Only `$` was escaped; yosys and slang module names also carry `\`, `[` and `.`, each a regular-expression metacharacter. 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. |
|
@vvbandeira please retrigger, CI snag |
|
Claude:
|
|
Thanks for running Claude: your seeding of Claude gives a different result than mine, obviously. Helpful. Also, it looks like you curated the output. 😌 |
…cost Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
The cost loop caught every set_attr failure as "not in the design", so a listed module whose name did not match its definition went unnoticed. slang's --keep-hierarchy names each elaborated module `<definition>$<instance path>` and --blackboxed-module matches only the definition, so such a name is in the design with its body elaborated: set_attr succeeded on it and the memory became flip-flops. A listed module absent from the design is skipped (slang imports a blackboxed module only where it is instanced); one present but not a blackbox stops synthesis by name; set_attr is no longer caught. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
The cost loop read a macro's area out of its .lib with a regular expression that matched only because FakeRAM writes `area :` first in the cell group. FakeRAM knows the area when it writes the view, so it now writes it beside the module name, `<module> <area>` in um^2 per line, and synthesis reads it from there. A line of any other shape is an error. gen_memories_test.py checks the area against the one the .lib states. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
|
Both done.
Merged master for #4618. |
The cost loop looked each blackboxes.txt name up in the module list as a Tcl list. yosys lists an escaped module with its leading backslash, `\1d_ram`, which list parsing reads as an escape, and blackboxes.txt names it as read_slang takes it, `1d_ram`; the lookup missed, the module was taken for absent and skipped, and keep_hierarchy -min_cost stopped with "Missing cost information on instanced blackbox \1d_ram". The list is now read one name per line, without the backslash. Checked with read_slang on a design with `ram` and `\1d_ram` blackboxed: before, the error above; now both get their cost and keep_hierarchy -min_cost runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
|
The detector fix for slang's per-instance names is #4658. b59c1d1: the cost loop missed an escaped module. yosys lists |
With SYNTH_MINIMUM_KEEP_SIZE, hierarchy discovery picks the modules to keep with keep_hierarchy -min_cost, which needs a cost for every instanced blackbox. An AUTO_MEMORIES macro is a blackbox made from the RTL's own module, not a Liberty cell, so any AUTO_MEMORIES design with a keep threshold stopped with "Missing cost information on instanced blackbox". ORFS patch 0090 carries The-OpenROAD-Project/OpenROAD-flow-scripts#4650 at its head: blackboxes.txt carries `<module> <area>` per line and synthesis gives each AUTO_MEMORIES blackbox that area's gate equivalent. Beyond the upstream pull request, STRUCTURED_MEMORIES (patch 0071) writes its modules' areas too, and FakeRAM's spsram_mask_test (patch 0073) reads the new format. test/auto_memories:am_top_keep_synth_test synthesizes the AUTO_MEMORIES fixture with a keep threshold of 1; it fails without the patch on the missing cost and passes with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
|
@oharboe Thanks. This PR has merged, so a retrigger is no longer needed. |
With
SYNTH_MINIMUM_KEEP_SIZE, synthesis picks the modules to keep withkeep_hierarchy -min_cost, which needs a cost for every instanced blackbox.convert_liberty_areasgives Liberty cells one, but an AUTO_MEMORIES macro is a blackbox made from the RTL's own module and has none. Any AUTO_MEMORIES design with a keep threshold stopped with "Missing cost information on instanced blackbox".Each AUTO_MEMORIES blackbox now gets the gate equivalent of the area FakeRAM writes beside its name in
blackboxes.txt,<module> <area>per line, the area its.libstates. The view is not read in the module's place: its pins need not be the module's (FakeRAM names its own).A listed module that is in the design but not a blackbox is an error: its name did not match its definition (slang's
--keep-hierarchynames each elaborated module<definition>$<instance path>, and--blackboxed-modulematches only the definition), so its body was elaborated into flip-flops.asap7/riscv32i hits this once its register file is a generated macro. The integration test is The-OpenROAD-Project/bazel-orfs#1187.
🤖 Generated with Claude Code