@@ -44,6 +44,7 @@ def search_for_total_power(report_power: list[str]):
4444parser .add_argument ('--base' , action = 'store' , help = 'Path to file with base power report' )
4545parser .add_argument ('--total' , action = 'store' , help = 'Path to directory with total report for each clock cycle from simulation' )
4646parser .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' )
4748parser .add_argument ('--csv' , action = 'store' , help = 'Export results to a CSV file' )
4849parser .set_defaults (stop = True )
4950args = parser .parse_args ()
@@ -57,15 +58,22 @@ def search_for_total_power(report_power: list[str]):
5758if 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+
6068tcl_script = """
6169read_liberty $::env(LIB_DIR)/asap7sc7p5t_AO_RVT_FF_nldm_211120.lib.gz
6270read_liberty $::env(LIB_DIR)/asap7sc7p5t_INVBUF_RVT_FF_nldm_220122.lib.gz
6371read_liberty $::env(LIB_DIR)/asap7sc7p5t_OA_RVT_FF_nldm_211120.lib.gz
6472read_liberty $::env(LIB_DIR)/asap7sc7p5t_SIMPLE_RVT_FF_nldm_211120.lib.gz
6573read_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
6977read_sdc 1_synth.sdc
7078
7179"""
@@ -81,14 +89,13 @@ def search_for_total_power(report_power: list[str]):
8189if 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-
8792tcl_script += f"""
8893set 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"""
9097tcl_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"""
104111set 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