Skip to content

Commit 7de6886

Browse files
committed
synth: use SYNTH_KEEP_MODULES for consistency
and introduce a test-case. Also, the keep attribute is set at the same time as SYNTH_HIERARCHICAL=1 for consistency Signed-off-by: Øyvind Harboe <[email protected]>
1 parent 75193b9 commit 7de6886

File tree

5 files changed

+48
-14
lines changed

5 files changed

+48
-14
lines changed

docs/user/FlowVariables.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ configuration file.
131131
| <a name="PLACE_SITE"></a>PLACE_SITE| Placement site for core cells defined in the technology LEF file.| | |
132132
| <a name="PLATFORM"></a>PLATFORM| Specifies process design kit or technology node to be used.| | |
133133
| <a name="POST_CTS_TCL"></a>POST_CTS_TCL| Specifies a Tcl script with commands to run after CTS is completed.| | |
134-
| <a name="PRESERVE_CELLS"></a>PRESERVE_CELLS| Mark modules to keep from getting removed in flattening.| | |
135134
| <a name="PROCESS"></a>PROCESS| Technology node or process in use.| | |
136135
| <a name="PWR_NETS_VOLTAGES"></a>PWR_NETS_VOLTAGES| Used for IR Drop calculation.| | |
137136
| <a name="RCX_RULES"></a>RCX_RULES| RC Extraction rules file path.| | |
@@ -181,6 +180,7 @@ configuration file.
181180
| <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.| | |
182181
| <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.| | |
183182
| <a name="SYNTH_HIERARCHICAL"></a>SYNTH_HIERARCHICAL| Enable to Synthesis hierarchically, otherwise considered flat synthesis.| 0| |
183+
| <a name="SYNTH_KEEP_MODULES"></a>SYNTH_KEEP_MODULES| Mark modules to keep from getting removed in flattening.| | |
184184
| <a name="SYNTH_MEMORY_MAX_BITS"></a>SYNTH_MEMORY_MAX_BITS| Maximum number of bits for memory synthesis.| 4096| |
185185
| <a name="SYNTH_MINIMUM_KEEP_SIZE"></a>SYNTH_MINIMUM_KEEP_SIZE| For hierarchical synthesis, we keep modules of larger area than given by this variable and flatten smaller modules. The area unit used is the size of a basic nand2 gate from the platform's standard cell library. The default value is platform specific.| | |
186186
| <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.| | |
@@ -211,6 +211,7 @@ configuration file.
211211
- [SYNTH_BLACKBOXES](#SYNTH_BLACKBOXES)
212212
- [SYNTH_GUT](#SYNTH_GUT)
213213
- [SYNTH_HIERARCHICAL](#SYNTH_HIERARCHICAL)
214+
- [SYNTH_KEEP_MODULES](#SYNTH_KEEP_MODULES)
214215
- [SYNTH_MEMORY_MAX_BITS](#SYNTH_MEMORY_MAX_BITS)
215216
- [SYNTH_MINIMUM_KEEP_SIZE](#SYNTH_MINIMUM_KEEP_SIZE)
216217
- [SYNTH_NETLIST_FILES](#SYNTH_NETLIST_FILES)
@@ -400,7 +401,6 @@ configuration file.
400401
- [LIB_FILES](#LIB_FILES)
401402
- [MACRO_EXTENSION](#MACRO_EXTENSION)
402403
- [PLATFORM](#PLATFORM)
403-
- [PRESERVE_CELLS](#PRESERVE_CELLS)
404404
- [PROCESS](#PROCESS)
405405
- [RCX_RULES](#RCX_RULES)
406406
- [RECOVER_POWER](#RECOVER_POWER)

flow/designs/asap7/swerv_wrapper/config.mk

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,41 @@
11
export DESIGN_NAME = swerv_wrapper
22
export PLATFORM = asap7
33

4-
export SYNTH_HIERARCHICAL = 1
4+
# The list below is a manual keep policy:
5+
# make SYNTH_HIERARCHICAL=1 SYNTH_KEEP_MODULES= clean_synth synth
6+
# make run-yosys RUN_YOSYS_ARGS=-C
7+
8+
# % ls A:keep_hierarchy=1
9+
export SYNTH_KEEP_MODULES ?= \
10+
IC_DATA_ICACHE_TAG_HIGH12_ICACHE_TAG_LOW6_ICACHE_IC_DEPTH8 \
11+
IC_TAG_ICACHE_TAG_HIGH12_ICACHE_TAG_LOW6_ICACHE_TAG_DEPTH64 \
12+
dbg \
13+
dec_decode_ctl \
14+
dec_gpr_ctl_GPR_BANKS1_GPR_BANKS_LOG21 \
15+
dec_ib_ctl \
16+
dec_tlu_ctl \
17+
dec_trigger \
18+
dma_ctrl \
19+
exu \
20+
exu_alu_ctl \
21+
exu_div_ctl \
22+
ifu_aln_ctl \
23+
ifu_bp_ctl \
24+
ifu_ifc_ctl \
25+
ifu_mem_ctl \
26+
lsu_bus_buffer \
27+
lsu_bus_intf \
28+
lsu_dccm_ctl \
29+
lsu_dccm_mem \
30+
lsu_ecc \
31+
lsu_lsc_ctl \
32+
lsu_stbuf \
33+
lsu_trigger \
34+
pic_ctrl \
35+
ram_2048x39 \
36+
ram_256x34
37+
38+
539
# RTL_MP Settings
640
export RTLMP_MAX_INST = 30000
741
export RTLMP_MIN_INST = 5000

flow/scripts/synth.tcl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ if { [env_var_equals SYNTH_GUT 1] } {
88
delete $::env(DESIGN_NAME)/c:*
99
}
1010

11+
if {[env_var_exists_and_non_empty SYNTH_KEEP_MODULES]} {
12+
foreach module $::env(SYNTH_KEEP_MODULES) {
13+
select -module $module
14+
setattr -mod -set keep_hierarchy 1
15+
select -clear
16+
}
17+
}
18+
1119
if {![env_var_equals SYNTH_HIERARCHICAL 1]} {
1220
# Perform standard coarse-level synthesis script, flatten right away
1321
# (-flatten part of $synth_args per default)

flow/scripts/synth_preamble.tcl

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,6 @@ if {[env_var_exists_and_non_empty SYNTH_BLACKBOXES]} {
6363
}
6464
}
6565

66-
# Mark modules to keep from getting removed in flattening
67-
if {[env_var_exists_and_non_empty PRESERVE_CELLS]} {
68-
hierarchy -check -top $::env(DESIGN_NAME)
69-
foreach cell $::env(PRESERVE_CELLS) {
70-
select -module $cell
71-
setattr -mod -set keep_hierarchy 1
72-
select -clear
73-
}
74-
}
75-
7666
if {$::env(ABC_AREA)} {
7767
puts "Using ABC area script."
7868
set abc_script $::env(SCRIPTS_DIR)/abc_area.script

flow/scripts/variables.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,9 +644,11 @@ DFF_LIB_FILES:
644644
DONT_USE_LIBS:
645645
description: |
646646
Set liberty files as `dont_use`.
647-
PRESERVE_CELLS:
647+
SYNTH_KEEP_MODULES:
648648
description: |
649649
Mark modules to keep from getting removed in flattening.
650+
stages:
651+
- synth
650652
SYNTH_ARGS:
651653
description: |
652654
Optional synthesis variables for yosys.

0 commit comments

Comments
 (0)