Skip to content

Commit 992deff

Browse files
committed
synth: allow user to specify custom hier separator for flatten pass
1 parent f8af7f8 commit 992deff

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

docs/user/FlowVariables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ configuration file.
182182
| <a name="SKIP_PIN_SWAP"></a>SKIP_PIN_SWAP| Do not use pin swapping as a transform to fix timing violations (default: use pin swapping).| | |
183183
| <a name="SKIP_REPORT_METRICS"></a>SKIP_REPORT_METRICS| If set to 1, then metrics, report_metrics does nothing. Useful to speed up builds.| | |
184184
| <a name="SLEW_MARGIN"></a>SLEW_MARGIN| Specifies a slew margin when fixing max slew violations. This option allows you to overfix.| | |
185-
| <a name="SYNTH_ARGS"></a>SYNTH_ARGS| Optional synthesis variables for yosys.| -flatten| |
185+
| <a name="SYNTH_ARGS"></a>SYNTH_ARGS| Optional synthesis variables for yosys.| | |
186186
| <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.| | |
187187
| <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.| | |
188188
| <a name="SYNTH_HDL_FRONTEND"></a>SYNTH_HDL_FRONTEND| Select an alternative language frontend to ingest the design. Available option is "slang". If the variable is empty, design is read with the Yosys read_verilog command.| | |

flow/scripts/synth.tcl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ if {[env_var_exists_and_non_empty SYNTH_KEEP_MODULES]} {
1717
}
1818
}
1919

20+
set flatten_hier_separator .
21+
if {[env_var_exists_and_non_empty SYNTH_HIER_SEPARATOR]} {
22+
set flatten_hier_separator $::env(SYNTH_HIER_SEPARATOR)
23+
}
24+
2025
set synth_full_args $::env(SYNTH_ARGS)
2126
if {[env_var_exists_and_non_empty SYNTH_OPERATIONS_ARGS]} {
2227
set synth_full_args [concat $synth_full_args $::env(SYNTH_OPERATIONS_ARGS)]
@@ -26,7 +31,7 @@ if {[env_var_exists_and_non_empty SYNTH_OPERATIONS_ARGS]} {
2631

2732
if {![env_var_equals SYNTH_HIERARCHICAL 1]} {
2833
# Perform standard coarse-level synthesis script, flatten right away
29-
# (-flatten part of $synth_args per default)
34+
flatten -separator $flatten_hier_separator
3035
synth -run :fine {*}$synth_full_args
3136
} else {
3237
# Perform standard coarse-level synthesis script,
@@ -43,7 +48,9 @@ if {![env_var_equals SYNTH_HIERARCHICAL 1]} {
4348
keep_hierarchy
4449
}
4550

46-
# Re-run coarse-level script, this time do pass -flatten
51+
flatten -separator $flatten_hier_separator
52+
53+
# Re-run coarse-level script
4754
synth -run coarse:fine {*}$synth_full_args
4855
}
4956

flow/scripts/variables.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ SYNTH_KEEP_MODULES:
676676
SYNTH_ARGS:
677677
description: |
678678
Optional synthesis variables for yosys.
679-
default: -flatten
679+
default: ""
680680
VERILOG_TOP_PARAMS:
681681
description: |
682682
Apply toplevel params (if exist).

0 commit comments

Comments
 (0)