Skip to content

Commit 4cbf6bf

Browse files
oharboeclaude
andcommitted
flow: every step reads AUTO_MEMORIES_DIR, synthesis included
auto_memories_synthesis pointed AUTO_MEMORIES_DIR back at the variant's own $(RESULTS_DIR)/memories in every synthesis step, so synthesis read what it wrote even when AUTO_MEMORIES_DIR named another variant's memories. Only a build system that runs a stage of one variant on another variant's synthesis sets AUTO_MEMORIES_DIR, and such a build system sets the environment of each step it runs, synthesis included. With make, AUTO_MEMORIES_DIR keeps its default, the directory synthesis writes. Drop the proc and its calls from synth_preamble.tcl, synth_odb.tcl, synth_metrics.tcl and synth_syn.tcl: every step reads the lists and views from AUTO_MEMORIES_DIR. The writer, make's rules and load_stage_input's stop are unchanged. The documentation says who sets AUTO_MEMORIES_DIR and that make users leave the default. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 13a1b5b commit 4cbf6bf

9 files changed

Lines changed: 20 additions & 29 deletions

File tree

‎docs/user/AutoMemories.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ bazel-orfs) declare the generated artifacts as ordinary stage outputs
3939
and transitive dependencies of the remaining stages.
4040

4141
Synthesis writes the views and lists to its own
42-
`$(RESULTS_DIR)/memories` and reads them there. The stages after it read
43-
them from `AUTO_MEMORIES_DIR`, which defaults to that directory, as a
44-
stage reads its input from `INPUT_RESULTS_DIR`. A variant whose stages
45-
run on another variant's synthesis, with `FLOW_INPUT_VARIANT` naming it,
46-
sets `AUTO_MEMORIES_DIR` to that variant's `memories` directory for
47-
every stage it runs.
42+
`$(RESULTS_DIR)/memories`. Every step reads them from
43+
`AUTO_MEMORIES_DIR`, synthesis included, which defaults to that
44+
directory; with make, leave it there. `AUTO_MEMORIES_DIR` is for a build
45+
system that runs a stage of one variant on another variant's synthesis
46+
(e.g. bazel-orfs): it sets it for each step it runs, synthesis included,
47+
to the memories of the variant that synthesised them.
4848

4949
Memories that are *not* converted stay in the netlist and synthesize to
5050
flip-flops, like any other RTL.

‎docs/user/FlowVariables.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ 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_DIR"></a>AUTO_MEMORIES_DIR| Directory the stages after synthesis read AUTO_MEMORIES' generated views and lists from. Synthesis writes them to its own $(RESULTS_DIR)/memories, the default, and reads them there. Set it to another variant's directory to run stages on that variant's synthesis without copying its memories, with FLOW_INPUT_VARIANT naming the variant the stage input is read from. Like AUTO_MEMORIES, not tied to stages: every step that reads the views needs it, the abstract among them.| |
107+
| <a name="AUTO_MEMORIES_DIR"></a>AUTO_MEMORIES_DIR| Directory every step reads AUTO_MEMORIES' generated views and lists from, synthesis included. Synthesis writes them to its own $(RESULTS_DIR)/memories, the default; with make, leave it there. For a build system that runs a stage of one variant on another variant's synthesis (e.g. bazel-orfs), which sets it for each step it runs, synthesis included, to the memories of the variant that synthesised them. Like AUTO_MEMORIES, not tied to stages: every step that reads the views needs it, the abstract among them.| |
108108
| <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.| |
109109
| <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.| |
110110
| <a name="BALANCE_ROWS"></a>BALANCE_ROWS| Balance rows during placement.| 0|

‎flow/scripts/synth_metrics.tcl‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
utl::set_metrics_stage "synth__{}"
22
source $::env(SCRIPTS_DIR)/load.tcl
3-
auto_memories_synthesis
43
load_design 1_2_yosys.v
54

65
report_metrics 1 "Post synthesis" false false

‎flow/scripts/synth_odb.tcl‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ utl::set_metrics_stage "synth__{}"
22
source $::env(SCRIPTS_DIR)/load.tcl
33
source $::env(SCRIPTS_DIR)/formal_check.tcl
44
erase_non_stage_variables synth
5-
auto_memories_synthesis
65
load_design 1_2_yosys.v
76
source_step_tcl PRE SYNTH
87

‎flow/scripts/synth_preamble.tcl‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ yosys -import
22

33
source $::env(SCRIPTS_DIR)/util.tcl
44
erase_non_stage_variables synth
5-
auto_memories_synthesis
65

76
# If using a cached, gate level netlist, then copy over to the results dir with
87
# preserve timestamps flag set. If you don't, subsequent runs will cause the

‎flow/scripts/synth_syn.tcl‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ utl::set_metrics_stage "synth__{}"
22
source $::env(SCRIPTS_DIR)/load.tcl
33
source $::env(SCRIPTS_DIR)/formal_check.tcl
44
erase_non_stage_variables synth
5-
auto_memories_synthesis
65

76
source_env_var_if_exists PLATFORM_TCL
87
source $::env(SCRIPTS_DIR)/read_liberty.tcl

‎flow/scripts/util.tcl‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,8 @@ proc env_var_exists_and_non_empty { env_var } {
115115
# AUTO_MEMORIES: do-auto-memories writes into $RESULTS_DIR/memories the
116116
# lists below, and every later step reads the files they name, never
117117
# what a directory happens to hold. gen_memories.py writes each list
118-
# whole, after every view exists. The stages after synthesis read them
119-
# from AUTO_MEMORIES_DIR, as a stage reads its input from
120-
# INPUT_RESULTS_DIR; synthesis reads what it wrote.
121-
#
122-
# Called by every synthesis step before it reads the lists or the views.
123-
proc auto_memories_synthesis { } {
124-
set ::env(AUTO_MEMORIES_DIR) $::env(RESULTS_DIR)/memories
125-
}
118+
# whole, after every view exists. Every step reads them from
119+
# AUTO_MEMORIES_DIR, synthesis included.
126120

127121
# The words of one of those lists; none without AUTO_MEMORIES.
128122
proc auto_memories_words { list } {

‎flow/scripts/variables.mk‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ export RESULTS_DIR = $(WORK_HOME)/results/$(PLATFORM)/$(DESIGN_NICKNAME)/$(FLOW_
5757
# Where a stage reads the previous stage's result.
5858
export FLOW_INPUT_VARIANT ?= $(FLOW_VARIANT)
5959
export INPUT_RESULTS_DIR = $(WORK_HOME)/results/$(PLATFORM)/$(DESIGN_NICKNAME)/$(FLOW_INPUT_VARIANT)
60-
# Where the stages after synthesis read AUTO_MEMORIES' generated views;
61-
# synthesis writes them to its own $(RESULTS_DIR)/memories.
60+
# Where every step reads AUTO_MEMORIES' generated views; synthesis writes
61+
# them to its own $(RESULTS_DIR)/memories. Set by a build system that
62+
# runs a stage of one variant on another variant's synthesis.
6263
export AUTO_MEMORIES_DIR ?= $(RESULTS_DIR)/memories
6364

6465
#-------------------------------------------------------------------------------

‎flow/scripts/variables.yaml‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,14 @@ SYNTH_USE_SYN:
187187
default: 0
188188
AUTO_MEMORIES_DIR:
189189
description: >
190-
Directory the stages after synthesis read AUTO_MEMORIES' generated
191-
views and lists from. Synthesis writes them to its own
192-
$(RESULTS_DIR)/memories, the default, and reads them there. Set it
193-
to another variant's directory to run stages on that variant's
194-
synthesis without copying its memories, with FLOW_INPUT_VARIANT
195-
naming the variant the stage input is read from. Like AUTO_MEMORIES,
196-
not tied to stages: every step that reads the views needs it, the
197-
abstract among them.
190+
Directory every step reads AUTO_MEMORIES' generated views and lists
191+
from, synthesis included. Synthesis writes them to its own
192+
$(RESULTS_DIR)/memories, the default; with make, leave it there. For
193+
a build system that runs a stage of one variant on another variant's
194+
synthesis (e.g. bazel-orfs), which sets it for each step it runs,
195+
synthesis included, to the memories of the variant that synthesised
196+
them. Like AUTO_MEMORIES, not tied to stages: every step that reads
197+
the views needs it, the abstract among them.
198198
AUTO_MEMORIES:
199199
description: >
200200
Experimental. When set to 1, memories that yosys infers in the RTL

0 commit comments

Comments
 (0)