Skip to content

Commit e3465b1

Browse files
authored
Merge pull request #3797 from Pinata-Consulting/yosys-canonicalization
synth: improve canonicalization
2 parents e19b7a5 + 77848ae commit e3465b1

4 files changed

Lines changed: 18 additions & 0 deletions

File tree

docs/user/FlowVariables.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ configuration file.
255255
| <a name="SYNTH_MOCK_LARGE_MEMORIES"></a>SYNTH_MOCK_LARGE_MEMORIES| Reduce Yosys inferred memories larger than SYNTH_MEMORY_MAX_BITS to 1 row. Yosys will generally infer memories from behavioral Verilog code, whether the memories are in standalone modules or instantiated within some larger module. fakeram and empty Verilog memories(blackboxes) of memories will not be inferred memories by Yosys and are therefore not affected by this variable. This is useful and convenient to separate the concern of instantiating and placing memories from investigating other issues with a design, though it comes at the expense of the increased accuracy that using realistic fakemem would provide. Memories with a single 1 row will of course have unrealistically good timing and area characteristics, but timing will still correctly terminate in a register. Large port memories, typically register files, will still have the retain a lot of the port logic that can be useful to investigate issues. This can be especially useful during development of designs where the behavioral model comes first and suitable memories are matched up when the design RTL is stable. A typical use case would be Chisel which will generate a behavioral model for a memories with the required clocks, ports, etc. in addition to a computer readable file with the specification of the memories that is used to [automatically](https://chipyard.readthedocs.io/en/stable/Tools/Barstools.html/) match up suitable memory macros later in the flow. During an architectural screening study, a large range of memory configurations can be investigated quickly with this option, without getting bogged down in the concern of how to realize the memories in silicon for emphemral RTL configurations that exist only long enough to run through the ORFS flow to create a table of some characteristics of a design configuration.| 0|
256256
| <a name="SYNTH_NETLIST_FILES"></a>SYNTH_NETLIST_FILES| Skips synthesis and uses the supplied netlist files. If the netlist files contains duplicate modules, which can happen when using hierarchical synthesis on indvidual netlist files and combining here, subsequent modules are silently ignored and only the first module is used.| |
257257
| <a name="SYNTH_OPT_HIER"></a>SYNTH_OPT_HIER| Optimize constants across hierarchical boundaries.| |
258+
| <a name="SYNTH_REPEATABLE_BUILD"></a>SYNTH_REPEATABLE_BUILD| License to prune anything that makes builds less repeatable, typically used with Bazel to ensure that builds are bit-for-bit identical so that caching works optimally. Removes debug information that encodes paths, timestamps, etc.| 0|
258259
| <a name="SYNTH_RETIME_MODULES"></a>SYNTH_RETIME_MODULES| *This is an experimental option and may cause adverse effects.* *No effort has been made to check if the retimed RTL is logically equivalent to the non-retimed RTL.* List of modules to apply automatic retiming to. These modules must not get dissolved and as such they should either be the top module or be included in SYNTH_KEEP_MODULES. The main use case is to quickly identify if performance can be improved by manually retiming the input RTL. Retiming will treat module ports like register endpoints/startpoints. The objective function of retiming isn't informed by SDC, even the clock period is ignored. As such, retiming will optimize for best delay at potentially high register number cost. Automatic retiming can produce suboptimal results as its timing model is crude and it doesn't find the optimal distribution of registers on long pipelines. See OR discussion #8080.| |
259260
| <a name="SYNTH_SLANG_ARGS"></a>SYNTH_SLANG_ARGS| Additional arguments passed to the slang frontend during synthesis.| |
260261
| <a name="SYNTH_WRAPPED_ADDERS"></a>SYNTH_WRAPPED_ADDERS| Specify the adder modules that can be used for synthesis, separated by commas. The default adder module is determined by the first element of this variable.| |
@@ -301,6 +302,7 @@ configuration file.
301302
- [SYNTH_MOCK_LARGE_MEMORIES](#SYNTH_MOCK_LARGE_MEMORIES)
302303
- [SYNTH_NETLIST_FILES](#SYNTH_NETLIST_FILES)
303304
- [SYNTH_OPT_HIER](#SYNTH_OPT_HIER)
305+
- [SYNTH_REPEATABLE_BUILD](#SYNTH_REPEATABLE_BUILD)
304306
- [SYNTH_RETIME_MODULES](#SYNTH_RETIME_MODULES)
305307
- [SYNTH_SLANG_ARGS](#SYNTH_SLANG_ARGS)
306308
- [SYNTH_WRAPPED_ADDERS](#SYNTH_WRAPPED_ADDERS)

flow/designs/nangate45/gcd/config.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export CORE_UTILIZATION ?= 55
1212
export PLACE_DENSITY_LB_ADDON = 0.20
1313
export TNS_END_PERCENT = 100
1414
export REMOVE_CELLS_FOR_EQY = TAPCELL*
15+
export SYNTH_REPEATABLE_BUILD ?= 1
1516

1617
# This needs a smaller pitch to accomodate a small block
1718
export PDN_TCL ?= $(DESIGN_HOME)/$(PLATFORM)/$(DESIGN_NAME)/grid_strategy-M1-M4-M7.tcl

flow/scripts/synth_canonicalize.tcl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,10 @@ source_env_var_if_exists SYNTH_CANONICALIZE_TCL
77

88
# Get rid of unused modules
99
opt_clean -purge
10+
if { $::env(SYNTH_REPEATABLE_BUILD) } {
11+
# avoid source line and path info affecting the hash
12+
setattr -unset src *
13+
setattr -mod -unset src *
14+
}
1015
# The hash of this file will not change if files not part of synthesis do not change
1116
write_rtlil $::env(RESULTS_DIR)/1_1_yosys_canonicalize.rtlil

flow/scripts/variables.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,16 @@ SYNTH_RETIME_MODULES:
295295
optimal distribution of registers on long pipelines. See OR discussion #8080.
296296
stages:
297297
- synth
298+
SYNTH_REPEATABLE_BUILD:
299+
description: >
300+
License to prune anything that makes builds less repeatable, typically
301+
used with Bazel to ensure that builds are bit-for-bit identical so that
302+
caching works optimally.
303+
304+
Removes debug information that encodes paths, timestamps, etc.
305+
stages:
306+
- synth
307+
default: 0
298308
DFF_MAP_FILE:
299309
description: |
300310
Optional mapping file supplied to Yosys to map D flip-flops

0 commit comments

Comments
 (0)