Skip to content

Commit dc359a6

Browse files
oharboeclaude
andcommitted
Merge The-OpenROAD-Project/OpenROAD-flow-scripts master into grt-fails-hard
global_route.tcl: master's estimate_parasitics without -global_routing (#4691) taken into the unwrapped script; master's change to the GENERATE_ARTIFACTS_ON_FAILURE branch goes with the branch. FlowVariables.md, variables.json: GLOBAL_CONNECT_TCL kept, GENERATE_ARTIFACTS_ON_FAILURE dropped; generate-variables-docs.py reproduces both files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018PFLaCzFtFbnWE4nPTDwpC Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2 parents d5d0ddc + c5310d7 commit dc359a6

78 files changed

Lines changed: 2909 additions & 618 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/contrib/EndpointSlackTracking.md‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,21 @@ cells) re-time the design if it is loaded, or else copy the previous step's
2727
snapshot. Intermediate `.odb` files written through `orfs_write_db` (e.g. CTS
2828
`save_progress`) also get a snapshot; `*-failed` ones don't.
2929

30-
So that all steps are timed the same way, parasitics are estimated before
31-
reporting as in `open.tcl`, based on the step number:
30+
A placed step is timed with the parasitics OpenROAD has for it: a bare
31+
`estimate_parasitics` estimates from the global routes when there are any,
32+
else from placement, and does nothing once `read_spef` has read the
33+
extracted parasitics:
3234

3335
| Steps | Parasitics |
3436
| --- | --- |
35-
| 1, 2 | none (cells are not placed) |
36-
| 3, 4 | `estimate_parasitics -placement` |
37-
| 5, `6_1_fill` | `estimate_parasitics -global_routing` if global routes exist |
38-
| `6_final` | `rcx`: the extracted `6_final.spef`, as in `6_finish.rpt` (`global_routing` on platforms without `RCX_RULES`) |
37+
| before placement, and `3_1_place_gp_skip_io` while the pins are unplaced | `none` |
38+
| placed, before global route | `placement` |
39+
| global route and later | `global_routing` |
40+
| `6_final` | `spef`: the extracted `6_final.spef`, as in `6_finish.rpt` (`global_routing` on platforms without `RCX_RULES`, or with `SKIP_DETAILED_ROUTE=1`) |
3941

4042
The parasitics model is recorded in each snapshot and shown by
4143
`endpointSlack.py`. Slack changes between steps with different models (e.g.
42-
`2_4_floorplan_pdn` to `3_1_place_gp_skip_io`, `4_1_cts` to `5_1_grt`, or
44+
`2_4_floorplan_pdn` to the first placed step, `4_1_cts` to `5_1_grt`, or
4345
`6_1_fill` to `6_final`) include the change of model. Detailed routing is
4446
only extracted in `6_final`, so `5_2_route` to `6_1_fill` show global routing
4547
estimates.

‎docs/user/AutoMemories.md‎

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,134 @@ the left edge, alternating horizontal M4 `VDD`/`VSS` straps across the
160160
macro (which the platform's PDN macro grid connects to M5), and an `OBS`
161161
covering M1 to M4.
162162

163+
## Register files
164+
165+
A register file, many read and write ports over a few words, is no
166+
SRAM: FakeRAM's single-port model does not describe it, and synthesised
167+
to flops its mux trees are placed by a placer that does not know they
168+
are an array. `AUTO_MEMORIES_REGFILES` lists spec files, one per RTL
169+
module, and OpenROAD's `generate_ram` builds each as an array of placed
170+
standard cells: a flop per bit, its write logic beside it, the read
171+
trees in columns. The spec names the module, its words and bits, its
172+
read and write ports by the module's own port names, and the cells:
173+
174+
```
175+
module RegFile
176+
mode netlist
177+
words 16
178+
bits 8
179+
clock clock
180+
read io_r0_addr io_r0_data
181+
write io_w0_addr io_w0_data io_w0_en
182+
cell flop DFFHQNx1_ASAP7_75t_R
183+
...
184+
```
185+
186+
`memories/regfile_ram.py` translates the spec to `generate_ram_netlist`
187+
options (ports, banks, folds, the zero word, reset, read latency, write
188+
style and priority, cells) and checks it against the module's ports,
189+
from synthesis: a port in one and not the other, or a data port of
190+
another width, stops the build rather than miswire the parent. The RAM
191+
is a block `<m>_ram`, and a wrapper takes the module's place,
192+
connecting the module's ports to the RAM's (an active-high reset
193+
inverted for an active-low flop, an address narrowed or widened). What
194+
happens next depends on `AUTO_MEMORIES_MACRO_PLACE`, the register files
195+
to place as macros:
196+
197+
- **Not listed (the default): inlined.** Synthesis reads the wrapper
198+
and the RAM's netlist in the module's place; from there on their cells
199+
are placed, sized and buffered with the rest of the design. No macro,
200+
no abstract, no dissolve. The better shape for a small design, where a
201+
macro's outline and channels cost more core than the array saves.
202+
- **Listed: a macro.** `<m>_ram` is a macro to synthesis and macro
203+
placement: its abstract `<m>_ram.lef` and a liberty of its area and
204+
pins land beside the FakeRAM views and it joins `blackboxes.txt`. In
205+
`mode netlist` (the only one) `generate_ram` places only the array's
206+
core and leaves its periphery (decode, select and input buffers) to
207+
the parent, and the macro dissolves into its cells at the end of macro
208+
placement (`regfile_dissolve.tcl`): the core lands FIRM where the
209+
macro was placed, flipped as the macro was, on the parent's rows; the
210+
periphery is left to global placement and the resizer, and dead logic
211+
is eliminated as at synthesis. A large design whose floorplan plans
212+
its register files lists them.
213+
- **A macro of its own.** A register file wanted as a macro to the end
214+
is a design of its own: run its module through the flow, its spec
215+
listed and macro-placed so it dissolves there, and give the parent
216+
its abstract as a macro. Its clock tree is then built and its timing
217+
model is written from it. `mode macro` stops with that advice: a
218+
timing model written from `generate_ram`'s netlist before any clock
219+
tree would have the whole unbuffered clock net as one pin.
220+
221+
A word holds its value between writes either through a hold mux per
222+
bit (`write_style mux`, the default here) or through one integrated
223+
clock gate per word, enabled by its write selects (`write_style
224+
clock_gate`, `generate_ram`'s own default). Where a row holds more than
225+
one word (`bank_columns`), each word's bits sit side by side, so its
226+
selects and write enables are no longer than its bits; and a word whose
227+
bits would run more than 150 um is folded into more rows. `tap_columns`
228+
and `service_sites` leave empty columns in the array for the buffers a
229+
parent puts on the nets that cross it.
230+
231+
Listed register files appear in `memories.json` with kind `regfile`;
232+
the rest have kind `fakeram` or `flops`.
233+
234+
Moving the dissolve into OpenROAD is left for later: it would make it
235+
faster, testable at unit level and maintained with the database it
236+
edits.
237+
238+
### Designs to measure it on
239+
240+
What a register file of placed cells buys is a shorter minimum clock
241+
period (the read mux trees are columns, not a cloud) and a shorter
242+
build (fewer cells for synthesis, placement and the resizer to work
243+
on). The ORFS designs whose register file is flip-flops today and its
244+
own module, the seam a spec needs, measured as flops against
245+
`AUTO_MEMORIES_REGFILES`:
246+
247+
| Design | Module | Today | Shape | Ready? |
248+
|---|---|---|---|---|
249+
| asap7/riscv32i | `regfile` | flip-flops: `reg [31:0] rf[31:0]`, mapped to flops (no AUTO_MEMORIES) | 32 x 32, 2R1W, x0 reads 0 | Yes: the ports are the spec's (`zero_word 0`). Also exercises `OPENROAD_HIERARCHICAL=1` beside two FakeRAM macros. |
250+
| asap7/ibex | `ibex_register_file_ff` | flip-flops: `RegFile = RegFileFF`, the default | 32 x 32, 2R1W, x0 reads 0 | Yes: `unused` names `test_en_i` and `dummy_instr_id_i`, ports the array does not use, and `async_reset rst_ni low` resets the flops to 0 as ibex does; simulated against ibex's RTL. |
251+
| asap7/cva6 | `ariane_regfile` (`ariane_regfile_ff.sv`) | flip-flops: cv32a65x has `FpgaEn` 0 | 32 x 32, 2R1W | Not yet: the ports are packed arrays (`raddr_i[1:0][4:0]`), one port per slice, which a spec cannot yet address; asynchronous reset as ibex. |
252+
| asap7/swerv_wrapper | `dec_gpr_ctl_*` | flip-flops | 32 x 32, 4R3W | Not yet: read enables, bank ids and scan ports around the array need a seam in the RTL. |
253+
254+
coralnpu's `Regfile` (8R4W) and `FRegfile` (3R2W) carry their
255+
scoreboard and bypass logic in the same module, and picorv32 and
256+
tinyRocket keep their register file inside the CPU module: those need a
257+
seam in their RTL first.
258+
259+
### Status: at parity on riscv32i, on a smaller core
260+
261+
riscv32i with its register file generated and inlined (a spec in
262+
`AUTO_MEMORIES_REGFILES`, `zero_word 0`), at riscv32i's own
263+
utilisation, against `designs/asap7/riscv32i`. To global route, 950 ps
264+
clock, minimum period from placement parasitics on the global-route
265+
database:
266+
267+
| | flops | register file |
268+
|---|---|---|
269+
| minimum period | 950 ps | 943 ps |
270+
| core area | 4 012 um2 | 3 503 um2 |
271+
272+
Both are limited by the same single-cycle path: the instruction into
273+
the register file's read, the ALU, the data memory and back into the
274+
register file's write. The register file's share of it, decode and read
275+
tree, is about 260 ps in either.
276+
277+
What did not pay, measured on the same design:
278+
279+
- the register file as a macro dissolved after macro placement: it does
280+
not fit riscv32i's 62 % beside the four FakeRAMs, and at 55 % it is
281+
959 ps on a 4 644 um2 core;
282+
- a hold mux per bit instead of the clock gate: 994 ps inlined, every
283+
array endpoint carrying the mux;
284+
- predecoded read selects: 960 ps;
285+
- a tree of 2:1 muxes steered by the address bits instead of a decoded
286+
one-hot read: 959 ps, the address bits' fanout (about 1 000 inputs a
287+
port) needs as many buffer levels as the decode it replaces;
288+
- four-input gates in the read tree, stronger cells: 950 to 954 ps,
289+
within what any change to the placement moves.
290+
163291
## Platform support
164292

165293
**asap7 only.** `gen_memories.py` rejects any other platform. The
@@ -221,3 +349,5 @@ bazel-orfs implements this.
221349

222350
- [AUTO_MEMORIES](FlowVariables.md#AUTO_MEMORIES)
223351
- [ADDITIONAL_MEMORIES](FlowVariables.md#ADDITIONAL_MEMORIES)
352+
- [AUTO_MEMORIES_MACRO_PLACE](FlowVariables.md#AUTO_MEMORIES_MACRO_PLACE)
353+
- [AUTO_MEMORIES_REGFILES](FlowVariables.md#AUTO_MEMORIES_REGFILES)

‎docs/user/FlowVariables.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ configuration file.
104104
| <a name="ADDITIONAL_SITES"></a>ADDITIONAL_SITES| Passed as -additional_sites to initialize_floorplan.| |
105105
| <a name="ASAP7_USE_VT"></a>ASAP7_USE_VT| A space separated list of VT options to use with the ASAP7 standard cell library: RVT, LVT, SLVT.| RVT|
106106
| <a name="AUTO_MEMORIES"></a>AUTO_MEMORIES| Experimental. When set to 1, memories that yosys infers in the RTL (`$mem_v2` cells, module boundary only) are detected pre-synthesis, inventoried in `$(RESULTS_DIR)/memories.json`, and — when idiomatic as an SRAM macro — given generated .lib/.lef views under `$(RESULTS_DIR)/memories/`. Synthesis blackboxes those modules and all later stages read the generated views, so an existing design gets macro-based results without a memory compiler. Supported for the asap7 platform only. See docs/user/AutoMemories.md.| 0|
107+
| <a name="AUTO_MEMORIES_MACRO_PLACE"></a>AUTO_MEMORIES_MACRO_PLACE| Experimental. Space-separated list of module names of AUTO_MEMORIES_REGFILES register files to place as macros, blackboxed in synthesis and placed by the macro placer (and, in `mode netlist`, dissolved after macro placement). A register file not listed is inlined: its generated netlist of standard cells replaces the module's body in synthesis, and its cells are placed, sized and buffered with the rest of the design -- the better shape for a small design, where a macro's outline and channels cost more core than the array saves. A name no spec builds stops the build. Requires AUTO_MEMORIES=1.| |
108+
| <a name="AUTO_MEMORIES_REGFILES"></a>AUTO_MEMORIES_REGFILES| Experimental. Space-separated list of register-file spec files, one per RTL module to build as a register file of placed standard cells rather than synthesise to flops. Each spec names its module, words, bits, read and write ports by the RTL's own port names, and the cells. memories/regfile_ram.py checks the spec against the module's ports and has OpenROAD's generate_ram build it as `<module>_ram`, under `$(RESULTS_DIR)/memories/`, with a wrapper in the module's place. A module named in AUTO_MEMORIES_MACRO_PLACE is blackboxed like an AUTO_MEMORIES macro and placed as one; any other is inlined as its generated netlist. A placed spec in `mode netlist` then dissolves into its cells after macro placement: its core FIRM where the macro was placed, in the macro's orientation, its periphery left to placement. Every register file appears in memories.json with kind `regfile`. Requires AUTO_MEMORIES=1.| |
107109
| <a name="BALANCE_ROWS"></a>BALANCE_ROWS| Balance rows during placement.| 0|
108110
| <a name="BLOCKS"></a>BLOCKS| Blocks used as hard macros in a hierarchical flow. Do note that you have to specify block-specific inputs file in the directory mentioned by Makefile.| |
109111
| <a name="BUFFER_PORTS_ARGS"></a>BUFFER_PORTS_ARGS| Specify arguments to the buffer_ports call during placement. Only used if DONT_BUFFER_PORTS=0.| |
@@ -155,6 +157,7 @@ configuration file.
155157
| <a name="FOOTPRINT_TCL"></a>FOOTPRINT_TCL| Specifies a Tcl script with custom footprint-related commands for floorplan setup.| |
156158
| <a name="GDS_ALLOW_EMPTY"></a>GDS_ALLOW_EMPTY| Single regular expression of module names of macros that have no .gds file| |
157159
| <a name="GDS_FILES"></a>GDS_FILES| Path to platform GDS files.| |
160+
| <a name="GLOBAL_CONNECT_TCL"></a>GLOBAL_CONNECT_TCL| File path to the add_global_connection rules that connect the supply pins of the instances to the supply nets. Sourced at floorplan right after the netlist is loaded, before any step can mark an instance dont_touch; the rules are kept in the database. The platform's file by default; a design whose PDN_TCL names other supply nets sets its own. PDN_TCL defines the grids.| |
158161
| <a name="GLOBAL_PLACEMENT_ARGS"></a>GLOBAL_PLACEMENT_ARGS| Use additional tuning parameters during global placement other than default args defined in global_place.tcl.| |
159162
| <a name="GLOBAL_ROUTE_ARGS"></a>GLOBAL_ROUTE_ARGS| Replaces default arguments for global route. The -congestion_iterations default is set by the flow (30 for FastRoute, 10 for CUGR); add -congestion_iterations here to override it.| -congestion_report_iter_step 5 -verbose|
160163
| <a name="GLOBAL_ROUTE_USE_CUGR"></a>GLOBAL_ROUTE_USE_CUGR| Passed as -use_cugr to global_route. Uses CUGR as the global routing solver instead of the default FastRoute solver. NOTE: CUGR is not ready for production.| 0|
@@ -298,6 +301,7 @@ configuration file.
298301
| <a name="SWAP_ARITH_OPERATORS"></a>SWAP_ARITH_OPERATORS| Improve timing QoR by swapping ALU and MULT arithmetic operators.| 0|
299302
| <a name="SYNTH_ARGS"></a>SYNTH_ARGS| Optional synthesis variables for yosys.| |
300303
| <a name="SYNTH_BLACKBOXES"></a>SYNTH_BLACKBOXES| List of cells treated as a black box by Yosys. With Bazel, this can be used to run synthesis in parallel for the large modules of the design. Non-existant modules are ignored silently, useful when listing modules statically, even if modules come and go dynamically.| |
304+
| <a name="SYNTH_BLACKBOXES_FILE"></a>SYNTH_BLACKBOXES_FILE| Path to a file with more modules to treat as black boxes, one name per line, added to SYNTH_BLACKBOXES. For a parallel synthesis whose list is too long for one environment variable: Linux caps one at 128 KiB.| |
301305
| <a name="SYNTH_CANONICALIZE_TCL"></a>SYNTH_CANONICALIZE_TCL| Specifies a Tcl script with commands to run as part of the synth canonicalize step.| |
302306
| <a name="SYNTH_CHECKPOINT"></a>SYNTH_CHECKPOINT| Path to a Yosys RTLIL checkpoint to read in place of the default canonicalization checkpoint at the start of synth.tcl. Intended for parallel synthesis flows that reuse a checkpoint taken after coarse synthesis and `keep_hierarchy` have already been decided, so each partition skips that common prefix. Leave unset for the normal flow.| |
303307
| <a name="SYNTH_GUT"></a>SYNTH_GUT| Load design and remove all internal logic before doing synthesis. This is useful when creating a mock .lef abstract that has a smaller area than the amount of logic would allow. bazel-orfs uses this to mock SRAMs, for instance.| 0|
@@ -350,6 +354,8 @@ configuration file.
350354
- [ABC_SCRIPT](#ABC_SCRIPT)
351355
- [ADDER_MAP_FILE](#ADDER_MAP_FILE)
352356
- [ADDITIONAL_MEMORIES](#ADDITIONAL_MEMORIES)
357+
- [AUTO_MEMORIES_MACRO_PLACE](#AUTO_MEMORIES_MACRO_PLACE)
358+
- [AUTO_MEMORIES_REGFILES](#AUTO_MEMORIES_REGFILES)
353359
- [CACHED_REPORTS](#CACHED_REPORTS)
354360
- [CLKGATE_MAP_FILE](#CLKGATE_MAP_FILE)
355361
- [DFF_LIB_FILE](#DFF_LIB_FILE)
@@ -369,6 +375,7 @@ configuration file.
369375
- [SKIP_REPORT_METRICS](#SKIP_REPORT_METRICS)
370376
- [SYNTH_ARGS](#SYNTH_ARGS)
371377
- [SYNTH_BLACKBOXES](#SYNTH_BLACKBOXES)
378+
- [SYNTH_BLACKBOXES_FILE](#SYNTH_BLACKBOXES_FILE)
372379
- [SYNTH_CANONICALIZE_TCL](#SYNTH_CANONICALIZE_TCL)
373380
- [SYNTH_CHECKPOINT](#SYNTH_CHECKPOINT)
374381
- [SYNTH_GUT](#SYNTH_GUT)
@@ -415,6 +422,7 @@ configuration file.
415422
- [FLOORPLAN_DEF](#FLOORPLAN_DEF)
416423
- [FOOTPRINT](#FOOTPRINT)
417424
- [FOOTPRINT_TCL](#FOOTPRINT_TCL)
425+
- [GLOBAL_CONNECT_TCL](#GLOBAL_CONNECT_TCL)
418426
- [HOLD_SLACK_MARGIN](#HOLD_SLACK_MARGIN)
419427
- [IO_CONSTRAINTS](#IO_CONSTRAINTS)
420428
- [MACRO_PLACEMENT_TCL](#MACRO_PLACEMENT_TCL)
@@ -653,6 +661,7 @@ configuration file.
653661
## generate_abstract variables
654662

655663
- [ABSTRACT_SOURCE](#ABSTRACT_SOURCE)
664+
- [SKIP_DETAILED_ROUTE](#SKIP_DETAILED_ROUTE)
656665

657666
## Uncategorized variables
658667

‎flow/Makefile‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,6 @@ synth-report: synth
246246
do-synth-report:
247247
$(RUN_CMD) --log $(abspath $(LOG_DIR)/1_2_yosys_metrics.log) --tee -- $(OPENROAD_CMD) $(SCRIPTS_DIR)/synth_metrics.tcl
248248

249-
.PHONY: memory
250-
memory:
251-
if [ -f $(RESULTS_DIR)/mem_hierarchical.json ]; then \
252-
$(PYTHON_EXE) $(SCRIPTS_DIR)/mem_dump.py $(RESULTS_DIR)/mem_hierarchical.json; \
253-
fi
254-
$(PYTHON_EXE) $(SCRIPTS_DIR)/mem_dump.py $(RESULTS_DIR)/mem.json
255-
256249
# ==============================================================================
257250

258251

@@ -279,10 +272,14 @@ do-auto-memories: $(RESULTS_DIR)/memories_inferred.json
279272
--yosys-json $(RESULTS_DIR)/memories_inferred.json \
280273
--out-dir $(RESULTS_DIR)/memories \
281274
--json $(RESULTS_DIR)/memories.json \
282-
$(foreach file,$(ADDITIONAL_MEMORIES),--memories $(file))
275+
$(foreach file,$(ADDITIONAL_MEMORIES),--memories $(file)) \
276+
$(foreach file,$(AUTO_MEMORIES_REGFILES),--regfile-spec $(file)) \
277+
$(foreach m,$(AUTO_MEMORIES_MACRO_PLACE),--macro-place $(m)) \
278+
$(if $(AUTO_MEMORIES_REGFILES),--openroad $(OPENROAD_EXE)) \
279+
$(foreach file,$(TECH_LEF) $(SC_LEF),--lef $(file))
283280

284281
$(RESULTS_DIR)/memories.json: $(RESULTS_DIR)/memories_inferred.json $(ADDITIONAL_MEMORIES) \
285-
$(wildcard $(SCRIPTS_DIR)/memories/*.py)
282+
$(AUTO_MEMORIES_REGFILES) $(wildcard $(SCRIPTS_DIR)/memories/*.py)
286283
$(UNSET_AND_MAKE) do-auto-memories
287284

288285
yosys-dependencies: $(RESULTS_DIR)/memories.json
@@ -722,6 +719,10 @@ $(RESULTS_DIR)/6_final.sdc: $(LOG_DIR)/6_report.log
722719

723720
$(RESULTS_DIR)/6_final.def: $(LOG_DIR)/6_report.log
724721

722+
# Written only when final extracts parasitics (RCX_RULES set, detailed
723+
# route not skipped); generate_abstract reads it in that case.
724+
$(RESULTS_DIR)/6_final.spef: $(LOG_DIR)/6_report.log
725+
725726
# The final results are called 6_final.*, so it is convenient when scripting
726727
# to have the names of the artifacts match the name of the target
727728
.PHONY: do-final
@@ -735,7 +736,7 @@ do-finish:
735736
$(UNSET_AND_MAKE) do-6_1_fill do-6_1_fill.sdc do-6_report elapsed
736737

737738
.PHONY: generate_abstract
738-
generate_abstract: $(RESULTS_DIR)/6_final.gds $(RESULTS_DIR)/6_final.def $(RESULTS_DIR)/6_final.v $(RESULTS_DIR)/6_final.sdc
739+
generate_abstract: $(RESULTS_DIR)/6_final.gds $(RESULTS_DIR)/6_final.def $(RESULTS_DIR)/6_final.v $(RESULTS_DIR)/6_final.sdc $(RESULTS_DIR)/6_final.spef
739740
$(UNSET_AND_MAKE) do-generate_abstract
740741

741742
# Set ABSTRACT_SOURCE if you want to create an abstract from another stage than 6_final.

0 commit comments

Comments
 (0)