Skip to content

Commit

Permalink
Merge pull request #353 from hdl/benchmark
Browse files Browse the repository at this point in the history
Add cell count area breakdowns, clock period, and critical path to place_and_route benchmarking.
  • Loading branch information
QuantamHD authored Sep 18, 2024
2 parents acf12a9 + 6c235be commit 40e5e10
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 12 deletions.
38 changes: 27 additions & 11 deletions place_and_route/private/benchmark.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def benchmark(ctx, open_road_info):
"report_check_types -max_slew -max_capacitance -max_fanout -violators",
"report_design_area",
"report_cell_usage",
"report_clock_min_period",
]

cmd_outputs = []
Expand Down Expand Up @@ -64,12 +65,19 @@ def benchmark(ctx, open_road_info):
awk_cmds = [
"area=$(cat {log} | awk '/Design area/ {{ print $3 }}');",
"util=$(cat {log} | awk -F '[ %]' '/Design area/ {{ print $5 }}');",
"combos=$(cat {log} | awk '/combinational cell/ {{ print 0 + $4 }}');",
"flops=$(cat {log} | awk '/Sequential cell/ {{ print 0 + $3 }}');",
"buffs=$(cat {log} | awk '/Buffer/ {{ buffer=$2; exit }} END {{ print 0 + buffers }}');",
"tbuffs=$(cat {log} | awk '/Timing Repair Buffer/ {{ print 0 + $4 }}');",
"combos=$(cat {log} | awk '/combinational cell/ {{ print $4 }}');",
"combos_area=$(cat {log} | awk '/combinational cell/ {{ print $5 }}');",
"seq=$(cat {log} | awk '/Sequential cell/ {{ print $3 }}');",
"seq_area=$(cat {log} | awk '/Sequential cell/ {{ print $4 }}');",
"buffs=$(cat {log} | awk '/Buffer/ {{ buffer=$2; exit }} END {{ print buffers }}');",
"buffs_area=$(cat {log} | awk '/Buffer/ {{ buffer=$2; exit }} END {{ print buffers }}');",
"tbuffs=$(cat {log} | awk '/Timing Repair Buffer/ {{ print $4 }}');",
"tbuffs_area=$(cat {log} | awk '/Timing Repair Buffer/ {{ print $4 }}');",
"inverters=$(cat {log} | awk '/Inverter/ {{ print $2 }}');",
"inverters_area=$(cat {log} | awk '/Inverter/ {{ print $2 }}');",
"wns=$(cat {log} | awk '/wns/ {{ print $2 }}');",
"tns=$(cat {log} | awk '/tns/ {{ print $2 }}');",
"cpl=$(cat {log} | awk '/period_min/ {{ cpl=$4; exit }} END {{ print cpl }}');",
"tot_pow=$(cat {log} | awk '/^Total / {{ total_power=$5 }} END {{ print total_power }}');",
"int_pow=$(cat {log} | awk '/^Total / {{ intern_power=$2 }} END {{ print intern_power }}');",
"swi_pow=$(cat {log} | awk '/^Total / {{ switch_power=$3 }} END {{ print switch_power }}');",
Expand All @@ -78,15 +86,23 @@ def benchmark(ctx, open_road_info):
textproto = proto.encode_text(
struct(
area = struct(
cell_area_um2 = "$area",
cell_utilization_fraction = "$util",
num_total_cells = "$(($combos + $flops + $buffs + $tbuffs))",
num_sequential = "$flops",
num_combinational = "$combos",
num_buffers = "$buffs",
num_timing_buffers = "$tbuffs",
cell_area_um2 = "${area:=0}",
cell_utilization_fraction = "$(printf %.0f $(bc<<<$util/100.0))",
area_sequentials_um2 = "${seq_area:=0}",
area_combinationals_um2 = "${combos_area:=0}",
area_buffers_um2 = "${buffs_area:=0}",
area_timing_buffers_um2 = "${tbuffs_area:=0}",
area_inverters_um2 = "${inverters_area:=0}",
num_total_cells = "$((${combos:=0} + ${seq:=0} + ${buffs:=0} + ${tbuffs:=0} + ${inverters:=0}))",
num_sequential = "${seq:=0}",
num_combinational = "${combos:=0}",
num_buffers = "${buffs:=0}",
num_timing_buffers = "${tbuffs:=0}",
num_inverters = "${inverters:=0}",
),
performance = struct(
clock_period_ps = ctx.attr.clock_period if ctx.attr.clock_period else 0,
critical_path_ps = "$(printf %.0f $(bc<<<$cpl*1000))",
setup_wns_ps = "$(printf %.0f $(bc<<<$wns*1000))",
setup_tns_ps = "$(printf %.0f $(bc<<<$tns*1000))",
),
Expand Down
8 changes: 7 additions & 1 deletion synthesis/power_performance_area.proto
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ message Area {
// Area only covered by sequentials.
optional float area_sequentials_um2 = 9;

// Area only covered by inverters.
optional float area_inverters_um2 = 16;

// The total number of standard cells used.
// Invariance:
// total_cells = buffers + timing_buffers + sequential + combinational;
Expand All @@ -85,7 +88,10 @@ message Area {
// The number of sequential elements, such as flops.
optional int32 num_sequential = 14;

// Leaving out proto tags 15..19 for later use.
// The number of inverters.
optional int32 num_inverters = 15;

// Leaving out proto tags 17..19 for later use.

// Cell type mapping to fraction used in the area, e.g.
// {{ "svt: 0.7 }, { "lvt": 0.3}}
Expand Down

0 comments on commit 40e5e10

Please sign in to comment.