Skip to content

Commit 4d93d5d

Browse files
committed
Enabled read_vcd/read_saif as part of metrics extraction
Signed-off-by: Jeff Ng <jeffng@precisioninno.com>
1 parent 64939f3 commit 4d93d5d

4 files changed

Lines changed: 65 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.| |
@@ -330,6 +332,7 @@ configuration file.
330332
| <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|
331333
| <a name="UNSET_ABC9_BOX_CELLS"></a>UNSET_ABC9_BOX_CELLS| List of cells to unset the abc9_box attribute on| |
332334
| <a name="USE_FILL"></a>USE_FILL| Whether to perform metal density filling.| 0|
335+
| <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.| |
333336
| <a name="VERILOG_DEFINES"></a>VERILOG_DEFINES| Preprocessor defines passed to the language frontend. Example: `-D HPDCACHE_ASSERT_OFF`| |
334337
| <a name="VERILOG_FILES"></a>VERILOG_FILES| The path to the design Verilog/SystemVerilog files providing a description of modules.| |
335338
| <a name="VERILOG_INCLUDE_DIRS"></a>VERILOG_INCLUDE_DIRS| Specifies the include directories for the Verilog input files.| |
@@ -674,18 +677,21 @@ configuration file.
674677
- [MIN_CLK_ROUTING_LAYER](#MIN_CLK_ROUTING_LAYER)
675678
- [PLATFORM](#PLATFORM)
676679
- [PLATFORM_TCL](#PLATFORM_TCL)
680+
- [POWER_FILE_SCOPE](#POWER_FILE_SCOPE)
677681
- [PROCESS](#PROCESS)
678682
- [RCX_RULES](#RCX_RULES)
679683
- [RECOVER_POWER](#RECOVER_POWER)
680684
- [REMOVE_CELLS_FOR_LEC](#REMOVE_CELLS_FOR_LEC)
681685
- [REPAIR_PDN_VIA_LAYER](#REPAIR_PDN_VIA_LAYER)
682686
- [RUN_LOG_NAME_STEM](#RUN_LOG_NAME_STEM)
683687
- [RUN_SCRIPT](#RUN_SCRIPT)
688+
- [SAIF_FILE](#SAIF_FILE)
684689
- [SC_LEF](#SC_LEF)
685690
- [SEAL_GDS](#SEAL_GDS)
686691
- [SLEW_MARGIN](#SLEW_MARGIN)
687692
- [TAP_CELL_NAME](#TAP_CELL_NAME)
688693
- [TECH_LEF](#TECH_LEF)
689694
- [USE_FILL](#USE_FILL)
695+
- [VCD_FILE](#VCD_FILE)
690696
- [WIRE_LOAD_MODEL](#WIRE_LOAD_MODEL)
691697

‎flow/scripts/report_metrics.tcl‎

Lines changed: 35 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 any backslashes immediately preceding [, ], or .
22+
regsub -all {\\(\[|\]|\.)} $scope_val {\1} scope_val
23+
24+
# 3. Apply single backslash escapes 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,17 @@ 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+
append_env_var additional_args POWER_FILE_SCOPE -scope 1
265+
266+
read_saif {*}$scope_args $::env(SAIF_FILE)
267+
report_activity_annotation
268+
} elseif { [env_var_exists_and_non_empty VCD_FILE] } {
269+
read_vcd {*}$scope_args $::env(VCD_FILE)
270+
report_activity_annotation
271+
}
237272
if { [env_var_exists_and_non_empty CORNERS] } {
238273
foreach corner $::env(CORNERS) {
239274
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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,3 +1730,15 @@ GRT_SEED:
17301730
- grt
17311731
tunable: 1
17321732
type: int
1733+
SAIF_FILE:
1734+
description: >
1735+
Specifies the Switching Activity Interchange Format (SAIF) file containing pin activities and duty cycles for use in power calculation.
1736+
type: string
1737+
POWER_FILE_SCOPE:
1738+
description: >
1739+
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 '/'.
1740+
type: string
1741+
VCD_FILE:
1742+
description: >
1743+
Specifies the Value Change Dump (VCD) file containing pin activities and duty cycles for use in power calculation.
1744+
type: string

0 commit comments

Comments
 (0)