Skip to content

Commit da3d75d

Browse files
committed
Added INFER_CLKGATES variable to enable inference of gated clocks
tclfmt updates Signed-off-by: Jeff Ng <jeffng@precisioninno.com>
1 parent f9ec54a commit da3d75d

4 files changed

Lines changed: 20 additions & 0 deletions

File tree

‎docs/user/FlowVariables.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +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|
171172
| <a name="IO_CONSTRAINTS"></a>IO_CONSTRAINTS| File path to the IO constraints .tcl file. Also used for manual placement.| |
172173
| <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).| |
173174
| <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).| |
@@ -348,6 +349,7 @@ configuration file.
348349
- [CLKGATE_MAP_FILE](#CLKGATE_MAP_FILE)
349350
- [DFF_LIB_FILE](#DFF_LIB_FILE)
350351
- [DFF_MAP_FILE](#DFF_MAP_FILE)
352+
- [INFER_CLKGATES](#INFER_CLKGATES)
351353
- [LATCH_MAP_FILE](#LATCH_MAP_FILE)
352354
- [MIN_BUF_CELL_AND_PORTS](#MIN_BUF_CELL_AND_PORTS)
353355
- [POST_SYNTH_TCL](#POST_SYNTH_TCL)

‎flow/scripts/synth.tcl‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ 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
239+
if { [env_var_equals INFER_CLKGATES 1] } {
240+
log_cmd clockgate {*}$lib_args
241+
}
242+
238243
# Technology mapping of flip-flops
239244
# dfflibmap only supports one liberty file
240245
if { [env_var_exists_and_non_empty DFF_LIB_FILE] } {

‎flow/scripts/variables.json‎

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎flow/scripts/variables.yaml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,12 @@ ADDER_MAP_FILE:
379379
Optional mapping file supplied to Yosys to map adders
380380
stages:
381381
- synth
382+
INFER_CLKGATES:
383+
description: |
384+
Enables Yosys clock gate inference. Uses Liberty to determine clock gating cell
385+
default: 0
386+
stages:
387+
- synth
382388
TIEHI_CELL_AND_PORT:
383389
description: >
384390
Tie high cells used in Yosys synthesis to replace a logical 1 in the

0 commit comments

Comments
 (0)