Skip to content

asap7/riscv32i: flat synthesis, 5.2 % shorter reg2reg period; a clock repair cannot meet - #4713

Closed
oharboe wants to merge 4 commits into
The-OpenROAD-Project:masterfrom
oharboe:riscv32i-flat
Closed

oharboe wants to merge 4 commits into
The-OpenROAD-Project:masterfrom
oharboe:riscv32i-flat

Conversation

@oharboe

@oharboe oharboe commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

riscv32i synthesises with SYNTH_MINIMUM_KEEP_SIZE=10000, which keeps one module: dmem, four SRAM macros (1,376 µm²) and 56 µm² of address decode. The size rule counts the macros' area, so it keeps the wrapper, and the boundary sits on the worst path, between the ALU's address adder and the SRAMs' chip-enable decode. Flat synthesis gives a 5.2 % shorter reg2reg period.

At global route, asap7, 780 ps, measured as #4583 proposes (the clock period minus the reg2reg worst slack, and the reg2reg endpoints within 10 % of the period):

min reg2reg period vs today endpoints faster / slower WNS (path) hold buffers
today: keeps dmem 835.6 ps – – −55.6 ps (reg2reg) 0
this PR: flat 791.8 ps −5.2 % 995 / 3 −11.8 ps (reg2reg) 0
today, SWAP_ARITH_OPERATORS off 943.4 ps +12.9 % 0 / 1,026 −163.4 ps (reg2reg) 0
flat, SWAP_ARITH_OPERATORS off 895.7 ps +7.2 % 0 / 1,015 −115.7 ps (reg2reg) 0

Commits:

  1. The SDC: 950 → 780 ps, and input and output budgets from 12.5 % to 2 % of the period. At 950 ps every configuration measured closed at the clock, so WNS could not tell them apart; at 12.5 % an input-to-register path (instr through the decoder into the register file) set WNS at every clock tried. riscv32i-mock-sram, which includes riscv32i's config.mk, gets a copy of today's constraint.sdc and is unchanged.
  2. SWAP_ARITH_OPERATORS: no change to the setting; its measured effect, 11 % on the reg2reg period, is now a comment beside it.
  3. Flat synthesis: the size rule moves into the BLOCKS branch, which riscv32i-mock-sram takes; riscv32i synthesises flat.

How it was found

A search over which modules synthesis keeps, in bazel-orfs (The-OpenROAD-Project/bazel-orfs#1371): 40 keep sets, each synthesised and floorplanned in about a minute, and a census on each floorplan of where a kept boundary cuts a path between two logic cells. dmem's boundary was the only one on the worst path, and dropping it the only change the census predicted a gain for. The best keep sets were then built through global route. Two things the search taught:

  • Floorplan numbers alone over-rewarded one keep set (the comparator's cells), which global route did not confirm.
  • At a clock repair can meet, every keep set closes at the clock: the comparison needs one it cannot.

What may generalise

Measured on this design only:

  • The size rule and macros. With macro (blackbox) area left out of a module's size, the rule keeps nothing in riscv32i and gives what flat does (813.1 against 814.1 ps at 750 ps; 1,001 endpoints faster, 2 slower). It applies equally to hand-instantiated macros, AUTO_MEMORIES macros and BLOCKS: a module kept for a memory should hold only the memory, the principle of AUTO_MEMORIES: convert only a memory that is its own module; read firtool memory modules #4618 seen from the other side.
  • A report. A kept boundary that cuts the worst reg2reg path between two logic cells can be found after synthesis in about a second.
  • IO budgets leak into reg2reg. At 820 ps, with the input budget at 5 % and 8 % of the period, today's reg2reg period was 840.7 and 865.1 ps: repair spends its effort on the worst path whatever its group.

Also measured, not proposed

The comparator (magcompare32, a tree of 2-bit compare cells) rewritten as A < B before synthesis, checked equivalent by LEC: 0.6 % shorter than today at 750 ps, longer than flat. The hand-built tree is the better structure here.

The numbers are from Bazel builds of these files with ORFS's own settings (yosys's read_verilog, OpenROAD hierarchical as config.mk sets), one build each; the flow is deterministic.

Claude made the changes and stared at paint drying.

🤖 Generated with Claude Code

oharboe and others added 3 commits October 21, 2026 23:31
At 950 ps every configuration of riscv32i measured closed at the clock,
so WNS could not tell two of them apart. At 780 ps it does, and with the
input and output budgets at 2 % of the period instead of 12.5 % WNS is a
register-to-register path: an input-to-register path (instr through
the decoder into the register file) set it at 12.5 %. No hold buffers
are inserted, and the worst hold slack is +35 ps.

riscv32i-mock-sram includes riscv32i's config.mk and was tuned at
950 ps; it gets a copy of today's constraint.sdc and is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
riscv32i already swaps adder architectures during repair. Measured at
the new 780 ps clock, to global route: the reg2reg period is 835.6 ps
with it and 943.4 ps without, 11 % shorter; with flat synthesis 791.8
and 895.7 ps. The comment records it beside the setting, so the next
change to it starts from the number.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
SYNTH_MINIMUM_KEEP_SIZE=10000 kept one module, dmem: four SRAM macros
(1,376 um^2 of liberty area) and 56 um^2 of address decode. The rule
counts the macros' area, so it kept the wrapper, and the boundary sat
on the worst path, between the ALU's address adder and the SRAMs'
chip-enable decode, which synthesis then optimised apart.

Flat, at 780 ps to global route: the reg2reg period is 791.8 ps against
835.6 (5.2 % shorter); of the reg2reg endpoints within 10 % of the
period, 995 are faster and 3 slower. WNS is -11.8 ps, a reg2reg path.

riscv32i-mock-sram hardens the SRAM as a block and keeps hierarchical
synthesis and the size rule as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>

@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 synthesis and timing configurations for the riscv32i and riscv32i-mock-sram designs, including tuning the clock period and IO percentages, conditionalizing hierarchical synthesis parameters, and adding a dedicated SDC constraint file for the mock SRAM design. The review feedback suggests making the SDC_FILE path generic by using $(DESIGN_NICKNAME) in the base configuration, which would eliminate the need for a redundant override in the mock SRAM configuration. Additionally, it is recommended to brace expressions passed to expr in the Tcl SDC file to prevent double-evaluation and improve performance.

Comment thread flow/designs/asap7/riscv32i/config.mk Resolved
A design that includes riscv32i's config.mk now finds its own
constraint.sdc as it finds its own io.tcl, so riscv32i-mock-sram no
longer names it. Both designs resolve the same files as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
@oharboe

oharboe commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

@maliberty Just FYI: riscv32i can be faster with some different options.

@openroad-ci

openroad-ci commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

🔍 QoR check

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

Commit b6ad5d1 · Jenkins build #2 · Baseline: build · View build on dashboard

62 design(s) checked — 1 with regression(s), 0 without a comparable baseline.

❌ asap7/riscv32i base — 3 failing metric(s)
Metric target base delta limit band
cts__timing__setup__tns -5183.540 -61.627 -8311.219% -251.627 PeriodPadding 20.000%
finish__timing__setup__tns -17382.100 -9426.610 -84.394% -11311.932 PeriodPadding 20.000%
globalroute__timing__setup__tns -4578.500 -3.487 -131185.789% -193.487 PeriodPadding 20.000%

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