@@ -2,36 +2,41 @@ source $::env(SCRIPTS_DIR)/synth_preamble.tcl
22
33hierarchy -check -top $::env(DESIGN_NAME)
44
5- set ungroup_threshold 0
6- if { $::env(MAX_UNGROUP_SIZE) > 0 } {
7- set ungroup_threshold $::env(MAX_UNGROUP_SIZE)
8- puts " Ungroup modules of size greater than $ungroup_threshold "
9- }
10-
11- set fp [open $::env(SYNTH_STATS) r]
12- while {[gets $fp line] != -1} {
13- set fields [split $line " " ]
14- set area [lindex $fields 0]
15- set module_name [lindex $fields 1]
16-
17- if {[expr $area > $ungroup_threshold ]} {
18- puts " Keeping module $module_name (area: $area )"
19- select -module $module_name
20- setattr -mod -set keep_hierarchy 1
21- select -clear
22- } else {
23- puts " Flattening module $module_name (area: $area )"
24- }
25- }
26- close $fp
27-
285if { [env_var_equals SYNTH_GUT 1] } {
296 # /deletes all cells at the top level, which will quickly optimize away
307 # everything else, including macros.
318 delete $::env(DESIGN_NAME) /c:*
329}
3310
34- synthesize_check mem $::env(SYNTH_FULL_ARGS)
11+ if {![env_var_equals SYNTH_HIERARCHICAL 1]} {
12+ # Perform standard coarse-level synthesis script, flatten right away
13+ # (-flatten part of $synth_args per default)
14+ synth -run :fine {*}$::env(SYNTH_FULL_ARGS)
15+ } else {
16+ # Perform standard coarse-level synthesis script,
17+ # defer flattening until we have decided what hierarchy to keep
18+ synth -run :fine
19+
20+ if {[env_var_exists_and_non_empty MAX_UNGROUP_SIZE]} {
21+ set ungroup_threshold $::env(MAX_UNGROUP_SIZE)
22+ puts " Ungroup modules below estimated size of $ungroup_threshold instances"
23+
24+ convert_liberty_areas
25+ keep_hierarchy -min_cost $ungroup_threshold
26+ } else {
27+ keep_hierarchy
28+ }
29+
30+ # Re-run coarse-level script, this time do pass -flatten
31+ synth -run coarse:fine {*}$::env(SYNTH_FULL_ARGS)
32+ }
33+
34+ json -o $::env(RESULTS_DIR) /mem.json
35+ # Run report and check here so as to fail early if this synthesis run is doomed
36+ exec -- python3 $::env(SCRIPTS_DIR) /mem_dump.py --max-bits $::env(SYNTH_MEMORY_MAX_BITS) $::env(RESULTS_DIR) /mem.json
37+ synth -top $::env(DESIGN_NAME) -run fine: {*}$::env(SYNTH_FULL_ARGS)
38+ # Get rid of indigestibles
39+ chformal -remove
3540
3641# rename registers to have the verilog register name in its name
3742# of the form \regName$_DFF_P_. We should fix yosys to make it the reg name.
0 commit comments