Skip to content

Commit 390ad43

Browse files
authored
fix(benchmark): correct clock period extraction and fmax units (#427)
- Fix clock period extraction to match any clock name (not just 'clk') - Fix fmax unit conversion from MHz to GHz Fixes parsing of report_clock_properties and report_clock_min_period output for accurate PPA reporting.
1 parent a7e8da3 commit 390ad43

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

place_and_route/private/benchmark.bzl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,14 @@ def benchmark(ctx, open_road_info):
8484
"inverters_area=$(cat {log} | awk '/Inverter/ {{ print $2 }}');",
8585
"wns_ps=$(cat {log} | awk '/wns/ {{ printf(\"%.0f\", $2 * 1000); }}');",
8686
"tns_ps=$(cat {log} | awk '/tns/ {{ printf(\"%.0f\", $2 * 1000); }}');",
87-
"period=$(cat {log} | awk '/clk / {{ period=$2; exit }} END {{ printf(\"%.0f\", period * 1000); }}');",
87+
# Fixed: Match any clock name (not just "clk") in the clock properties table
88+
# The table has format: "clock_name period waveform_start waveform_end"
89+
"period=$(cat {log} | awk '/Period.*Waveform/ {{ in_table=1; next }} in_table && /^-+$/ {{ next }} in_table && /^[a-zA-Z_][a-zA-Z0-9_]*[ \\t]+[0-9]/ {{ printf(\"%.0f\", $2 * 1000); exit }}');",
8890
"cpl=$(cat {log} | awk '/period_min/ {{ cpl=$4; exit }} END {{ printf(\"%.0f\", cpl * 1000); }}');",
89-
"fmax=$(cat {log} | awk '/fmax/ {{ fmax=$7; exit }} END {{ print fmax }}');",
91+
# Fixed: Convert fmax from MHz to GHz (OpenROAD reports in MHz, proto expects GHz)
92+
# Log format: "clock_name period_min = X.XX fmax = Y.YY"
93+
# where fmax is in MHz, so divide by 1000 to get GHz
94+
"fmax=$(cat {log} | awk '/fmax/ {{ fmax=$7; exit }} END {{ printf(\"%.3f\", fmax / 1000.0) }}');",
9095
"tot_pow=$(cat {log} | awk '/^Total / {{ total_power=$5 }} END {{ print total_power }}');",
9196
"int_pow=$(cat {log} | awk '/^Total / {{ intern_power=$2 }} END {{ print intern_power }}');",
9297
"leak_pow=$(cat {log} | awk '/^Total / {{ leak_power=$4 }} END {{ print leak_power }}');",

0 commit comments

Comments
 (0)