Skip to content

Commit 9725797

Browse files
authored
Merge pull request #3551 from The-OpenROAD-Project-staging/secure-reorder-alu
Added ALU module reordering feature for synthesis
2 parents 8962356 + 8ddced4 commit 9725797

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

docs/user/FlowVariables.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ configuration file.
241241
| <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.| |
242242
| <a name="SYNTH_OPT_HIER"></a>SYNTH_OPT_HIER| Optimize constants across hierarchical boundaries.| |
243243
| <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.| |
244+
| <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.| |
245+
| <a name="SYNTH_WRAPPED_MULTIPLIERS"></a>SYNTH_WRAPPED_MULTIPLIERS| Specify the multiplier modules that can be used for synthesis, separated by commas. The default multiplier module is determined by the first element of this variable.| |
244246
| <a name="SYNTH_WRAPPED_OPERATORS"></a>SYNTH_WRAPPED_OPERATORS| Synthesize multiple architectural options for each arithmetic operator in the design. These options are available for switching among in later stages of the flow.| |
245247
| <a name="TAPCELL_TCL"></a>TAPCELL_TCL| Path to Endcap and Welltie cells file.| |
246248
| <a name="TAP_CELL_NAME"></a>TAP_CELL_NAME| Name of the cell to use in tap cell insertion.| |
@@ -278,6 +280,8 @@ configuration file.
278280
- [SYNTH_NETLIST_FILES](#SYNTH_NETLIST_FILES)
279281
- [SYNTH_OPT_HIER](#SYNTH_OPT_HIER)
280282
- [SYNTH_RETIME_MODULES](#SYNTH_RETIME_MODULES)
283+
- [SYNTH_WRAPPED_ADDERS](#SYNTH_WRAPPED_ADDERS)
284+
- [SYNTH_WRAPPED_MULTIPLIERS](#SYNTH_WRAPPED_MULTIPLIERS)
281285
- [TIEHI_CELL_AND_PORT](#TIEHI_CELL_AND_PORT)
282286
- [TIELO_CELL_AND_PORT](#TIELO_CELL_AND_PORT)
283287
- [VERILOG_DEFINES](#VERILOG_DEFINES)

flow/scripts/synth_wrap_operators.tcl

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Set arithmetic operator modules. Default is the first module in the list.
12
set deferred_cells {
23
{
34
\$alu
@@ -15,6 +16,40 @@ set deferred_cells {
1516
}
1617
}
1718

19+
# Reorder the modules based on envar
20+
proc reorder_deferred_cells { deferred_cells_var index env_var } {
21+
upvar $deferred_cells_var deferred_cells
22+
23+
if { ![info exists ::env($env_var)] } {
24+
return
25+
}
26+
27+
set cell_def [lindex $deferred_cells $index]
28+
29+
# Build lookup dict
30+
set choice_map {}
31+
foreach choice [lrange $cell_def 2 end] {
32+
dict set choice_map [lindex $choice 0] $choice
33+
}
34+
35+
# Build new choices
36+
set new_choices {}
37+
foreach name [split $::env($env_var) ","] {
38+
if { [dict exists $choice_map $name] } {
39+
lappend new_choices [dict get $choice_map $name]
40+
} else {
41+
puts "Warning: Unknown choice '$name' ignored for $env_var"
42+
}
43+
}
44+
45+
# Replace cell
46+
lset deferred_cells $index [linsert $new_choices 0 {*}[lrange $cell_def 0 1]]
47+
}
48+
49+
# Apply custom orders
50+
reorder_deferred_cells deferred_cells 0 SYNTH_WRAPPED_ADDERS
51+
reorder_deferred_cells deferred_cells 1 SYNTH_WRAPPED_MULTIPLIERS
52+
1853
techmap {*}[join [lmap cell $deferred_cells { string cat "-dont_map [lindex $cell 0]" }] " "]
1954

2055
foreach info $deferred_cells {

flow/scripts/variables.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,18 @@ SYNTH_WRAPPED_OPERATORS:
299299
the flow.
300300
stages:
301301
- All stages
302+
SYNTH_WRAPPED_ADDERS:
303+
description: >
304+
Specify the adder modules that can be used for synthesis, separated by commas.
305+
The default adder module is determined by the first element of this variable.
306+
stages:
307+
- synth
308+
SYNTH_WRAPPED_MULTIPLIERS:
309+
description: >
310+
Specify the multiplier modules that can be used for synthesis, separated by commas.
311+
The default multiplier module is determined by the first element of this variable.
312+
stages:
313+
- synth
302314
SWAP_ARITH_OPERATORS:
303315
description: >
304316
Improve timing QoR by swapping ALU and MULT arithmetic operators.

0 commit comments

Comments
 (0)