Skip to content

Commit 02f31eb

Browse files
committed
Enabled control of specific clock gating cell for inferencing
tclfmt fixes re-ordered clkgate definition Signed-off-by: Jeff Ng <jeffng@precisioninno.com>
1 parent 6101364 commit 02f31eb

4 files changed

Lines changed: 55 additions & 6 deletions

File tree

‎docs/user/FlowVariables.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ configuration file.
168168
| <a name="GRT_SEED"></a>GRT_SEED| Specifies a random seed for global routing. Useful for perturbation studies.| |
169169
| <a name="GUI_TIMING"></a>GUI_TIMING| Load timing information when opening GUI. For large designs, this can be quite time consuming. Useful to disable when investigating non-timing aspects like floorplan, placement, routing, etc.| 1|
170170
| <a name="HOLD_SLACK_MARGIN"></a>HOLD_SLACK_MARGIN| Specifies a time margin for the slack when fixing hold violations. This option allows you to overfix or underfix (negative value, terminate retiming before 0 or positive slack). floorplan.tcl uses min of HOLD_SLACK_MARGIN and 0 (default hold slack margin). This avoids overrepair in floorplan for hold by default, but allows skipping hold repair using a negative HOLD_SLACK_MARGIN. Exiting timing repair early is useful in exploration where the .sdc has a fixed clock period at the design's target clock period and where HOLD/SETUP_SLACK_MARGIN is used to avoid overrepair (extremely long running times) when exploring different parameter settings. When an ideal clock is used, that is before CTS, a clock insertion delay of 0 is used in timing paths. This creates a mismatch between macros that have a .lib file from after CTS, when the clock is propagated. To mitigate this, OpenSTA will use subtract the clock insertion delay of macros when calculating timing with ideal clock. Provided that min_clock_tree_path and max_clock_tree_path are in the .lib file, which is the case for macros built with OpenROAD. This is less accurate than if OpenROAD had created a placeholder clock tree for timing estimation purposes prior to CTS. There will inevitably be inaccuracies in the timing calculation prior to CTS. Use a slack margin that is low enough, even negative, to avoid overrepair. Inaccuracies in the timing prior to CTS can also lead to underrepair, but there no obvious and simple way to avoid underrapir in these cases. Overrepair can lead to excessive runtimes in repair or too much buffering being added, which can present itself as congestion of hold cells or buffer cells. Another use of SETUP/HOLD_SLACK_MARGIN is design parameter exploration when trying to find the minimum clock period for a design. The SDC_FILE for a design can be quite complicated and instead of modifying the clock period in the SDC_FILE, which can be non-trivial, the clock period can be fixed at the target frequency and the SETUP/HOLD_SLACK_MARGIN can be swept to find a plausible current minimum clock period.| 0|
171-
| <a name="INFER_CLKGATES"></a>INFER_CLKGATES| Enables Yosys clock gate inference. Uses Liberty to determine clock gating cell| 0|
171+
| <a name="INFER_CLKGATES"></a>INFER_CLKGATES| Enables Yosys clock gate inference. By default, it uses the Liberty cell definitions to determine clock gating cell. The selection can be overridden using the POS_CLKGATE_AND_PORTS and/or NEG_CLKGATE_AND_PORTS variables.| 0|
172172
| <a name="IO_CONSTRAINTS"></a>IO_CONSTRAINTS| File path to the IO constraints .tcl file. Also used for manual placement.| |
173173
| <a name="IO_PLACER_H"></a>IO_PLACER_H| A list of metal layers on which the I/O pins are placed horizontally (top and bottom of the die).| |
174174
| <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).| |
@@ -198,6 +198,7 @@ configuration file.
198198
| <a name="MIN_CLK_ROUTING_LAYER"></a>MIN_CLK_ROUTING_LAYER| The lowest metal layer name to be used for clock-net routing in global routing. Used in flow/platforms/*/fastroute.tcl as the lower bound of `set_routing_layers -clock`. Typically higher than MIN_ROUTING_LAYER so clock nets prefer the upper, lower-RC layers. No `stages:` list because floorplan.tcl also `source`s the platform fastroute.tcl.| |
199199
| <a name="MIN_PLACE_STEP_COEF"></a>MIN_PLACE_STEP_COEF| Sets the minimum phi coefficient (pcof_min / µ_k Lower Bound) for global placement optimization. This parameter controls the step size lower bound in the RePlAce Nesterov optimization algorithm. Lower values may improve convergence but can increase runtime. Valid range: 0.95-1.05| 0.95|
200200
| <a name="MIN_ROUTING_LAYER"></a>MIN_ROUTING_LAYER| The lowest metal layer name to be used in routing.| |
201+
| <a name="NEG_CLKGATE_AND_PORTS"></a>NEG_CLKGATE_AND_PORTS| Specifies the active low enable clock gating cell and port names when used in conjunction with the INFER_CLKGATES variable. Format is "cell_name enable_port:master_clock:gated_clock"| |
201202
| <a name="NUM_CORES"></a>NUM_CORES| Passed to `openroad -threads $(NUM_CORES)`, defaults to numbers of cores in system as determined by system specific code in Makefile, `nproc` is tried first. OpenROAD does not limit itself to this number of cores across OpenROAD running instances, which can lead to overprovisioning in contexts such as bazel-orfs where there could be many routing, or place jobs running at the same time.| |
202203
| <a name="OPENROAD_HIERARCHICAL"></a>OPENROAD_HIERARCHICAL| Feature toggle to enable to run OpenROAD in hierarchical mode, otherwise considered flat. Will eventually be the default and this option will be retired.| 0|
203204
| <a name="OPT_POST_GRT_WNS"></a>OPT_POST_GRT_WNS| Optimize WNS after global routing by additional repair_timing that uses VT swap and wire rerouting only to minimize placement and routing disturbance| 1|
@@ -226,6 +227,7 @@ configuration file.
226227
| <a name="POST_RESIZE_TCL"></a>POST_RESIZE_TCL| Specifies a Tcl script with commands to run after resize.| |
227228
| <a name="POST_SYNTH_TCL"></a>POST_SYNTH_TCL| Specifies a Tcl script with commands to run after synthesis ODB generation.| |
228229
| <a name="POST_TAPCELL_TCL"></a>POST_TAPCELL_TCL| Specifies a Tcl script with commands to run after tapcell.| |
230+
| <a name="POS_CLKGATE_AND_PORTS"></a>POS_CLKGATE_AND_PORTS| Specifies the active high enable clock gating cell and port names when used in conjunction with the INFER_CLKGATES variable. Format is "cell_name enable_port:master_clock:gated_clock"| |
229231
| <a name="PRE_CTS_TCL"></a>PRE_CTS_TCL| Specifies a Tcl script with commands to run before CTS.| |
230232
| <a name="PRE_DENSITY_FILL_TCL"></a>PRE_DENSITY_FILL_TCL| Specifies a Tcl script with commands to run before density fill.| |
231233
| <a name="PRE_DETAIL_PLACE_TCL"></a>PRE_DETAIL_PLACE_TCL| Specifies a Tcl script with commands to run before detailed placement.| |
@@ -352,7 +354,9 @@ configuration file.
352354
- [INFER_CLKGATES](#INFER_CLKGATES)
353355
- [LATCH_MAP_FILE](#LATCH_MAP_FILE)
354356
- [MIN_BUF_CELL_AND_PORTS](#MIN_BUF_CELL_AND_PORTS)
357+
- [NEG_CLKGATE_AND_PORTS](#NEG_CLKGATE_AND_PORTS)
355358
- [POST_SYNTH_TCL](#POST_SYNTH_TCL)
359+
- [POS_CLKGATE_AND_PORTS](#POS_CLKGATE_AND_PORTS)
356360
- [PRE_SYNTH_TCL](#PRE_SYNTH_TCL)
357361
- [SDC_FILE](#SDC_FILE)
358362
- [SDC_GUT](#SDC_GUT)

‎flow/scripts/synth.tcl‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,26 @@ if { [env_var_exists_and_non_empty LATCH_MAP_FILE] } {
235235
techmap -map $::env(LATCH_MAP_FILE)
236236
}
237237

238-
# Clock gate inference. Let yosys decide on which clock gating cell to use
238+
# Clock gate inference.
239239
if { [env_var_equals INFER_CLKGATES 1] } {
240-
log_cmd clockgate {*}$lib_args
240+
set clkgate_args {}
241+
if {
242+
[env_var_exists_and_non_empty POS_CLKGATE_AND_PORTS] ||
243+
[env_var_exists_and_non_empty NEG_CLKGATE_AND_PORTS]
244+
} {
245+
if { [env_var_exists_and_non_empty POS_CLKGATE_AND_PORTS] } {
246+
lappend clkgate_args "-pos"
247+
lappend clkgate_args {*}$::env(POS_CLKGATE_AND_PORTS)
248+
}
249+
if { [env_var_exists_and_non_empty NEG_CLKGATE_AND_PORTS] } {
250+
lappend clkgate_args "-neg"
251+
lappend clkgate_args {*}$::env(NEG_CLKGATE_AND_PORTS)
252+
}
253+
} else {
254+
# Let yosys decide on which clock gating cell to use
255+
lappend clkgate_args {*}$lib_args
256+
}
257+
log_cmd clockgate {*}$clkgate_args
241258
}
242259

243260
# Technology mapping of flip-flops

‎flow/scripts/variables.json‎

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎flow/scripts/variables.yaml‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,11 +380,27 @@ ADDER_MAP_FILE:
380380
stages:
381381
- synth
382382
INFER_CLKGATES:
383-
description: |
384-
Enables Yosys clock gate inference. Uses Liberty to determine clock gating cell
383+
description: >
384+
Enables Yosys clock gate inference. By default, it uses the Liberty cell
385+
definitions to determine clock gating cell. The selection can be overridden
386+
using the POS_CLKGATE_AND_PORTS and/or NEG_CLKGATE_AND_PORTS variables.
385387
default: 0
386388
stages:
387389
- synth
390+
NEG_CLKGATE_AND_PORTS:
391+
description: >
392+
Specifies the active low enable clock gating cell and port names when used
393+
in conjunction with the INFER_CLKGATES variable. Format is
394+
"cell_name enable_port:master_clock:gated_clock"
395+
stages:
396+
- synth
397+
POS_CLKGATE_AND_PORTS:
398+
description: >
399+
Specifies the active high enable clock gating cell and port names when used
400+
in conjunction with the INFER_CLKGATES variable. Format is
401+
"cell_name enable_port:master_clock:gated_clock"
402+
stages:
403+
- synth
388404
TIEHI_CELL_AND_PORT:
389405
description: >
390406
Tie high cells used in Yosys synthesis to replace a logical 1 in the

0 commit comments

Comments
 (0)