Skip to content

Commit 83bf4a6

Browse files
authored
Merge pull request #3702 from The-OpenROAD-Project-staging/synth-dff-mapping
added DFF_MAP_FILE flow variable to map DFF's
2 parents 9675342 + a54443e commit 83bf4a6

File tree

3 files changed

+50
-6
lines changed

3 files changed

+50
-6
lines changed

docs/user/FlowVariables.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ configuration file.
9595
| <a name="ABC_DRIVER_CELL"></a>ABC_DRIVER_CELL| Default driver cell used during ABC synthesis.| |
9696
| <a name="ABC_LOAD_IN_FF"></a>ABC_LOAD_IN_FF| During synthesis set_load value used.| |
9797
| <a name="ABSTRACT_SOURCE"></a>ABSTRACT_SOURCE| Which .odb file to use to create abstract| |
98-
| <a name="ADDER_MAP_FILE"></a>ADDER_MAP_FILE| List of adders treated as a black box by Yosys.| |
98+
| <a name="ADDER_MAP_FILE"></a>ADDER_MAP_FILE| Optional mapping file supplied to Yosys to map adders| |
9999
| <a name="ADDITIONAL_FILES"></a>ADDITIONAL_FILES| Additional files to be added to `make issue` archive.| |
100100
| <a name="ADDITIONAL_GDS"></a>ADDITIONAL_GDS| Hardened macro GDS files listed here.| |
101101
| <a name="ADDITIONAL_LEFS"></a>ADDITIONAL_LEFS| Hardened macro LEF view files listed here. The LEF information of the macros is immutable and used throughout all stages. Stored in the .odb file.| |
@@ -107,7 +107,7 @@ configuration file.
107107
| <a name="CDL_FILES"></a>CDL_FILES| Insert additional Circuit Description Language (`.cdl`) netlist files.| |
108108
| <a name="CELL_PAD_IN_SITES_DETAIL_PLACEMENT"></a>CELL_PAD_IN_SITES_DETAIL_PLACEMENT| Cell padding on both sides in site widths to ease routability in detail placement.| 0|
109109
| <a name="CELL_PAD_IN_SITES_GLOBAL_PLACEMENT"></a>CELL_PAD_IN_SITES_GLOBAL_PLACEMENT| Cell padding on both sides in site widths to ease routability during global placement.| 0|
110-
| <a name="CLKGATE_MAP_FILE"></a>CLKGATE_MAP_FILE| List of cells for gating clock treated as a black box by Yosys.| |
110+
| <a name="CLKGATE_MAP_FILE"></a>CLKGATE_MAP_FILE| Optional mapping file supplied to Yosys to map clock gating cells| |
111111
| <a name="CLUSTER_FLOPS"></a>CLUSTER_FLOPS| Minimum number of flip-flops per sink cluster.| 0|
112112
| <a name="CORE_AREA"></a>CORE_AREA| The core area specified as a list of lower-left and upper-right corners in microns (X1 Y1 X2 Y2).| |
113113
| <a name="CORE_ASPECT_RATIO"></a>CORE_ASPECT_RATIO| The core aspect ratio (height / width). This value is ignored if `CORE_UTILIZATION` is undefined.| 1.0|
@@ -128,6 +128,7 @@ configuration file.
128128
| <a name="DETAILED_ROUTE_ARGS"></a>DETAILED_ROUTE_ARGS| Add additional arguments for debugging purposes during detail route.| |
129129
| <a name="DETAILED_ROUTE_END_ITERATION"></a>DETAILED_ROUTE_END_ITERATION| Maximum number of iterations.| 64|
130130
| <a name="DFF_LIB_FILES"></a>DFF_LIB_FILES| Technology mapping liberty files for flip-flops.| |
131+
| <a name="DFF_MAP_FILE"></a>DFF_MAP_FILE| Optional mapping file supplied to Yosys to map D flip-flops| |
131132
| <a name="DIE_AREA"></a>DIE_AREA| The die area specified as a list of lower-left and upper-right corners in microns (X1 Y1 X2 Y2).| |
132133
| <a name="DONT_BUFFER_PORTS"></a>DONT_BUFFER_PORTS| Do not buffer input/output ports during floorplanning.| 0|
133134
| <a name="DONT_USE_CELLS"></a>DONT_USE_CELLS| Dont use cells eases pin access in detailed routing.| |
@@ -157,7 +158,7 @@ configuration file.
157158
| <a name="IO_PLACER_V"></a>IO_PLACER_V| A list of metal layers on which the I/O pins are placed vertically (sides of the die).| |
158159
| <a name="IR_DROP_LAYER"></a>IR_DROP_LAYER| Default metal layer to report IR drop.| |
159160
| <a name="KLAYOUT_TECH_FILE"></a>KLAYOUT_TECH_FILE| A mapping from LEF/DEF to GDS using the KLayout tool.| |
160-
| <a name="LATCH_MAP_FILE"></a>LATCH_MAP_FILE| List of latches treated as a black box by Yosys.| |
161+
| <a name="LATCH_MAP_FILE"></a>LATCH_MAP_FILE| Optional mapping file supplied to Yosys to map latches| |
161162
| <a name="LIB_FILES"></a>LIB_FILES| A Liberty file of the standard cell library with PVT characterization, input and output characteristics, timing and power definitions for each cell.| |
162163
| <a name="MACRO_BLOCKAGE_HALO"></a>MACRO_BLOCKAGE_HALO| Distance beyond the edges of a macro that will also be covered by the blockage generated for that macro. Note that the default macro blockage halo comes from the largest of the specified MACRO_PLACE_HALO x or y values. This variable overrides that calculation.| |
163164
| <a name="MACRO_EXTENSION"></a>MACRO_EXTENSION| Sets the number of GCells added to the blockages boundaries from macros.| |
@@ -276,6 +277,7 @@ configuration file.
276277
- [ABC_LOAD_IN_FF](#ABC_LOAD_IN_FF)
277278
- [ADDER_MAP_FILE](#ADDER_MAP_FILE)
278279
- [CLKGATE_MAP_FILE](#CLKGATE_MAP_FILE)
280+
- [DFF_MAP_FILE](#DFF_MAP_FILE)
279281
- [LATCH_MAP_FILE](#LATCH_MAP_FILE)
280282
- [MIN_BUF_CELL_AND_PORTS](#MIN_BUF_CELL_AND_PORTS)
281283
- [SDC_FILE](#SDC_FILE)

flow/scripts/synth.tcl

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
1+
#
2+
# Extracts and returns module names from Verilog file
3+
#
4+
proc get_module_names { file_path } {
5+
set module_list [list]
6+
if { [catch { set fid [open $file_path r] } err] } {
7+
error "Failed to open file $file_path: $err"
8+
}
9+
10+
set regex {^[ \t]*module[ \t]+([A-Za-z_$][A-Za-z0-9_$]*)}
11+
12+
while { [gets $fid line] >= 0 } {
13+
if { [regexp -nocase $regex $line match_all module_name] } {
14+
lappend module_list $module_name
15+
}
16+
}
17+
18+
close $fid
19+
return $module_list
20+
}
21+
22+
#
23+
# Builds dfflegalize arg list
24+
#
25+
proc get_dfflegalize_args { file_path } {
26+
set legalize_args [list]
27+
set module_names [get_module_names $file_path]
28+
foreach module_name $module_names {
29+
lappend legalize_args -cell $module_name x
30+
}
31+
return $legalize_args
32+
}
33+
134
source $::env(SCRIPTS_DIR)/synth_preamble.tcl
235
read_checkpoint $::env(RESULTS_DIR)/1_1_yosys_canonicalize.rtlil
336

@@ -143,6 +176,10 @@ if { [env_var_exists_and_non_empty LATCH_MAP_FILE] } {
143176
# dfflibmap only supports one liberty file
144177
if { [env_var_exists_and_non_empty DFF_LIB_FILE] } {
145178
dfflibmap -liberty $::env(DFF_LIB_FILE) {*}$lib_dont_use_args
179+
} elseif { [env_var_exists_and_non_empty DFF_MAP_FILE] } {
180+
set legalize_args [get_dfflegalize_args $::env(DFF_MAP_FILE)]
181+
dfflegalize {*}$legalize_args
182+
techmap -map $::env(DFF_MAP_FILE)
146183
} else {
147184
dfflibmap {*}$lib_args {*}$lib_dont_use_args
148185
}

flow/scripts/variables.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,19 +292,24 @@ SYNTH_RETIME_MODULES:
292292
optimal distribution of registers on long pipelines. See OR discussion #8080.
293293
stages:
294294
- synth
295+
DFF_MAP_FILE:
296+
description: |
297+
Optional mapping file supplied to Yosys to map D flip-flops
298+
stages:
299+
- synth
295300
LATCH_MAP_FILE:
296301
description: |
297-
List of latches treated as a black box by Yosys.
302+
Optional mapping file supplied to Yosys to map latches
298303
stages:
299304
- synth
300305
CLKGATE_MAP_FILE:
301306
description: |
302-
List of cells for gating clock treated as a black box by Yosys.
307+
Optional mapping file supplied to Yosys to map clock gating cells
303308
stages:
304309
- synth
305310
ADDER_MAP_FILE:
306311
description: |
307-
List of adders treated as a black box by Yosys.
312+
Optional mapping file supplied to Yosys to map adders
308313
stages:
309314
- synth
310315
TIEHI_CELL_AND_PORT:

0 commit comments

Comments
 (0)