Skip to content

Commit f274d5d

Browse files
authored
Merge pull request #4768 from The-OpenROAD-Project-staging/enable-vcd-saif-2
Enabled read_saif/read_vcd via flow variables
2 parents 5123e4d + 3400c5b commit f274d5d

4 files changed

Lines changed: 66 additions & 0 deletions

File tree

‎docs/user/FlowVariables.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ configuration file.
225225
| <a name="POST_SYNTH_TCL"></a>POST_SYNTH_TCL| Specifies a Tcl script with commands to run after synthesis ODB generation.| |
226226
| <a name="POST_TAPCELL_TCL"></a>POST_TAPCELL_TCL| Specifies a Tcl script with commands to run after tapcell.| |
227227
| <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"| |
228+
| <a name="POWER_FILE_SCOPE"></a>POWER_FILE_SCOPE| The SAIF or VCD scope of the current design. Typically the test bench name and design under the test instance name. Scope levels are separated with '/'.| |
228229
| <a name="PRE_CTS_TCL"></a>PRE_CTS_TCL| Specifies a Tcl script with commands to run before CTS.| |
229230
| <a name="PRE_DENSITY_FILL_TCL"></a>PRE_DENSITY_FILL_TCL| Specifies a Tcl script with commands to run before density fill.| |
230231
| <a name="PRE_DETAIL_PLACE_TCL"></a>PRE_DETAIL_PLACE_TCL| Specifies a Tcl script with commands to run before detailed placement.| |
@@ -272,6 +273,7 @@ configuration file.
272273
| <a name="RTLMP_WIRELENGTH_WT"></a>RTLMP_WIRELENGTH_WT| Weight for half-perimiter wirelength.| 100.0|
273274
| <a name="RUN_LOG_NAME_STEM"></a>RUN_LOG_NAME_STEM| Stem of the log file name, the log file will be named `$(LOG_DIR)/$(RUN_LOG_NAME_STEM).log`.| run|
274275
| <a name="RUN_SCRIPT"></a>RUN_SCRIPT| Path to script to run from `make run`, python or tcl script detected by .py or .tcl extension.| |
276+
| <a name="SAIF_FILE"></a>SAIF_FILE| Specifies the Switching Activity Interchange Format (SAIF) file containing pin activities and duty cycles for use in power calculation.| |
275277
| <a name="SC_LEF"></a>SC_LEF| Path to technology standard cell LEF file.| |
276278
| <a name="SDC_FILE"></a>SDC_FILE| The path to design constraint (SDC) file.| |
277279
| <a name="SEAL_GDS"></a>SEAL_GDS| Seal macro to place around the design.| |
@@ -331,6 +333,7 @@ configuration file.
331333
| <a name="TNS_END_PERCENT"></a>TNS_END_PERCENT| Default TNS_END_PERCENT value for post CTS timing repair. Try fixing all violating endpoints by default (reduce to 5% for runtime). Specifies how many percent of violating paths to fix [0-100]. Worst path will always be fixed.| 100|
332334
| <a name="UNSET_ABC9_BOX_CELLS"></a>UNSET_ABC9_BOX_CELLS| List of cells to unset the abc9_box attribute on| |
333335
| <a name="USE_FILL"></a>USE_FILL| Whether to perform metal density filling.| 0|
336+
| <a name="VCD_FILE"></a>VCD_FILE| Specifies the Value Change Dump (VCD) file containing pin activities and duty cycles for use in power calculation.| |
334337
| <a name="VERILOG_DEFINES"></a>VERILOG_DEFINES| Preprocessor defines passed to the language frontend. Example: `-D HPDCACHE_ASSERT_OFF`| |
335338
| <a name="VERILOG_FILES"></a>VERILOG_FILES| The path to the design Verilog/SystemVerilog files providing a description of modules.| |
336339
| <a name="VERILOG_INCLUDE_DIRS"></a>VERILOG_INCLUDE_DIRS| Specifies the include directories for the Verilog input files.| |
@@ -679,18 +682,21 @@ configuration file.
679682
- [MIN_CLK_ROUTING_LAYER](#MIN_CLK_ROUTING_LAYER)
680683
- [PLATFORM](#PLATFORM)
681684
- [PLATFORM_TCL](#PLATFORM_TCL)
685+
- [POWER_FILE_SCOPE](#POWER_FILE_SCOPE)
682686
- [PROCESS](#PROCESS)
683687
- [RCX_RULES](#RCX_RULES)
684688
- [RECOVER_POWER](#RECOVER_POWER)
685689
- [REMOVE_CELLS_FOR_LEC](#REMOVE_CELLS_FOR_LEC)
686690
- [REPAIR_PDN_VIA_LAYER](#REPAIR_PDN_VIA_LAYER)
687691
- [RUN_LOG_NAME_STEM](#RUN_LOG_NAME_STEM)
688692
- [RUN_SCRIPT](#RUN_SCRIPT)
693+
- [SAIF_FILE](#SAIF_FILE)
689694
- [SC_LEF](#SC_LEF)
690695
- [SEAL_GDS](#SEAL_GDS)
691696
- [SLEW_MARGIN](#SLEW_MARGIN)
692697
- [TAP_CELL_NAME](#TAP_CELL_NAME)
693698
- [TECH_LEF](#TECH_LEF)
694699
- [USE_FILL](#USE_FILL)
700+
- [VCD_FILE](#VCD_FILE)
695701
- [WIRE_LOAD_MODEL](#WIRE_LOAD_MODEL)
696702

‎flow/scripts/report_metrics.tcl‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,30 @@ proc report_puts { out } {
66
close $fileId
77
}
88

9+
#-----------------------------------------------------------------------------
10+
# Gets the power file scope arg and escapes, if necessary
11+
#-----------------------------------------------------------------------------
12+
proc get_power_file_scope_args { } {
13+
set args [list]
14+
15+
if { [env_var_exists_and_non_empty POWER_FILE_SCOPE] } {
16+
set scope_val $::env(POWER_FILE_SCOPE)
17+
18+
# 1. Strip surrounding quotes from shell/Make
19+
set scope_val [string trim $scope_val "\"'"]
20+
21+
# 2. Normalize: remove ALL backslashes preceding [, ], or .
22+
regsub -all {\\+(\[|\]|\.)} $scope_val {\1} scope_val
23+
24+
# 3. Apply exactly one backslash escape to [, ], and .
25+
regsub -all {(\[|\]|\.)} $scope_val {\\\1} scope_val
26+
27+
lappend args -scope $scope_val
28+
}
29+
30+
return $args
31+
}
32+
933
proc report_metrics { stage when { include_erc true } { include_clock_skew true } } {
1034
if { $::env(SKIP_REPORT_METRICS) } {
1135
return
@@ -234,6 +258,15 @@ proc report_metrics { stage when { include_erc true } { include_clock_skew true
234258
report_puts "\n=========================================================================="
235259
report_puts "$when report_power"
236260
report_puts "--------------------------------------------------------------------------"
261+
262+
set scope_args [get_power_file_scope_args]
263+
if { [env_var_exists_and_non_empty SAIF_FILE] } {
264+
read_saif {*}$scope_args $::env(SAIF_FILE)
265+
report_activity_annotation
266+
} elseif { [env_var_exists_and_non_empty VCD_FILE] } {
267+
read_vcd {*}$scope_args $::env(VCD_FILE)
268+
report_activity_annotation
269+
}
237270
if { [env_var_exists_and_non_empty CORNERS] } {
238271
foreach corner $::env(CORNERS) {
239272
report_puts "Corner: $corner"

‎flow/scripts/variables.json‎

Lines changed: 12 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: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,3 +1742,18 @@ GRT_SEED:
17421742
- grt
17431743
tunable: 1
17441744
type: int
1745+
SAIF_FILE:
1746+
description: >
1747+
Specifies the Switching Activity Interchange Format (SAIF) file containing pin
1748+
activities and duty cycles for use in power calculation.
1749+
type: string
1750+
POWER_FILE_SCOPE:
1751+
description: >
1752+
The SAIF or VCD scope of the current design. Typically the test bench name and
1753+
design under the test instance name. Scope levels are separated with '/'.
1754+
type: string
1755+
VCD_FILE:
1756+
description: >
1757+
Specifies the Value Change Dump (VCD) file containing pin activities and duty
1758+
cycles for use in power calculation.
1759+
type: string

0 commit comments

Comments
 (0)