Skip to content

Commit 58a9e4f

Browse files
committed
peak power: test limited num of cycles parameter
1 parent 3f74ae7 commit 58a9e4f

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ Go to the synthesis results directory and then run the peak power script:
218218
<!-- name="execute-peak-power-script" -->
219219
```
220220
cd OpenROAD-flow-scripts/flow/results/asap7/ibex/base/
221-
python3 peak_power.py --base base_output --total total_output --csv power_analysis.csv
221+
python3 peak_power.py --base base_output --total total_output --csv power_analysis.csv --cycles 50
222222
```
223223

224224
This will visualize power consumption over time and output maximum encountered value:
@@ -272,7 +272,7 @@ Go to the synthesis results directory and then run the glitch power script:
272272
<!-- name="execute-glitch-power-script" -->
273273
```
274274
cd OpenROAD-flow-scripts/flow/results/asap7/ibex/base/
275-
python3 peak_power.py --base base_output --total total_output --glitch glitch_output --csv power_analysis.csv
275+
python3 peak_power.py --base base_output --total total_output --glitch glitch_output --csv power_analysis.csv --cycles 50
276276
```
277277

278278
This will visualize power consumption over time with per clock cycle total/glitch power and output maximum encountered value:

peak_power_example/peak_power.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def search_for_total_power(report_power: list[str]):
4444
parser.add_argument('--base', action='store', help='Path to file with base power report')
4545
parser.add_argument('--total', action='store', help='Path to directory with total report for each clock cycle from simulation')
4646
parser.add_argument('--glitch', action='store', help='Path to directory with glitch report for each clock cycle from simulation')
47+
parser.add_argument('--cycles', action='store', help='Num of cycles to generate peak/glitch power report from')
4748
parser.add_argument('--csv', action='store', help='Export results to a CSV file')
4849
parser.set_defaults(stop=True)
4950
args = parser.parse_args()
@@ -57,15 +58,22 @@ def search_for_total_power(report_power: list[str]):
5758
if not os.path.exists(result_path):
5859
os.makedirs(result_path)
5960

61+
total_cycles = 0
62+
if not args.cycles:
63+
total_power_files = os.listdir(args.total)
64+
total_cycles = len(total_power_files) - 1
65+
else:
66+
total_cycles = args.cycles - 1
67+
6068
tcl_script = """
6169
read_liberty $::env(LIB_DIR)/asap7sc7p5t_AO_RVT_FF_nldm_211120.lib.gz
6270
read_liberty $::env(LIB_DIR)/asap7sc7p5t_INVBUF_RVT_FF_nldm_220122.lib.gz
6371
read_liberty $::env(LIB_DIR)/asap7sc7p5t_OA_RVT_FF_nldm_211120.lib.gz
6472
read_liberty $::env(LIB_DIR)/asap7sc7p5t_SIMPLE_RVT_FF_nldm_211120.lib.gz
6573
read_liberty $::env(LIB_DIR)/asap7sc7p5t_SEQ_RVT_FF_nldm_220123.lib
6674
67-
read_db 5_route.odb
68-
75+
read_verilog 1_synth.v
76+
link_design ibex_core
6977
read_sdc 1_synth.sdc
7078
7179
"""
@@ -81,14 +89,13 @@ def search_for_total_power(report_power: list[str]):
8189
if not os.path.exists(total_power_result_directory):
8290
os.makedirs(total_power_result_directory)
8391

84-
total_power_files = os.listdir(args.total)
85-
total_power_files = sorted(total_power_files)
86-
8792
tcl_script += f"""
8893
set all_total [glob -directory "{args.total}" -- "*"]
94+
set all_total_sorted [lsort $all_total]
95+
set truncated_total [lrange $all_total_sorted 0 {total_cycles}]
8996
"""
9097
tcl_script += """
91-
foreach f $all_total {
98+
foreach f $truncated_total {
9299
source "$f"
93100
set_pin_activity_and_duty
94101
report_power > "result/$f"
@@ -102,9 +109,11 @@ def search_for_total_power(report_power: list[str]):
102109

103110
tcl_script += f"""
104111
set all_glitch [glob -directory "{args.glitch}" -- "*"]
112+
set all_glitch_sorted [lsort $all_glitch]
113+
set truncated_glitch [lrange $all_glitch_sorted 0 {total_cycles}]
105114
"""
106115
tcl_script += """
107-
foreach f $all_glitch {
116+
foreach f $truncated_glitch {
108117
source "$f"
109118
set_pin_activity_and_duty
110119
report_power > "result/$f"

0 commit comments

Comments
 (0)