Skip to content

Commit

Permalink
Improve STA summary table (#340)
Browse files Browse the repository at this point in the history
* `OpenROAD.STAPostPnR`
	* Added hold/setup reg-to-reg worst violation to STA summary table.
	* Added hold/setup tns to STA summary table.
	* 0 slack is now highlighted green instead of red
  • Loading branch information
kareefardi authored Jan 11, 2024
1 parent 8907e2a commit f77e0dd
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 13 deletions.
7 changes: 3 additions & 4 deletions openlane/scripts/openroad/common/io.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,11 @@ set ::metrics_file ""
if { [info exists ::env(OPENSTA)] && $::env(OPENSTA) } {
proc write_metric_num {metric value} {
if { $value == 1e30 } {
write_metric_str $metric Infinity
set value inf
} elseif { $value == -1e30 } {
write_metric_str $metric -Infinity
} else {
puts "%OL_METRIC_F $metric $value"
set value -inf
}
puts "%OL_METRIC_F $metric $value"
}
proc write_metric_int {metric value} {
puts "%OL_METRIC_I $metric $value"
Expand Down
26 changes: 20 additions & 6 deletions openlane/scripts/openroad/sta/corner.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,9 @@ puts "%OL_CREATE_REPORT tns.max.rpt"
puts "\n==========================================================================="
puts "Total Negative Slack (Setup)"
puts "============================================================================"
set tns_design 0
foreach corner [sta::corners] {
set tns [sta::format_time [sta::total_negative_slack_corner_cmd $corner "max"] $sta_report_default_digits]
write_metric_num "timing__setup__tns__corner:[$corner name]" $tns
puts "[$corner name]: $tns"
}
set tns [sta::format_time [sta::total_negative_slack_corner_cmd $corner "max"] $sta_report_default_digits]
write_metric_num "timing__setup__tns__corner:[$corner name]" $tns
puts "[$corner name]: $tns"
puts "%OL_END_REPORT"

puts "%OL_CREATE_REPORT wns.min.rpt"
Expand Down Expand Up @@ -248,6 +245,7 @@ set total_setup_vios 0
set r2r_setup_vios 0

set hold_timing_paths [find_timing_paths -unique_paths_to_endpoint -path_delay min -sort_by_slack -group_count 999999999 -slack_max 0]
set worst_r2r_hold_slack 1e30
foreach path $hold_timing_paths {
set from "reg"
set to "reg"
Expand All @@ -265,13 +263,20 @@ foreach path $hold_timing_paths {

incr total_hold_vios
if { "$kind" == "reg-reg" } {
set slack [get_property $path slack]

if { $slack < $worst_r2r_hold_slack } {
set worst_r2r_hold_slack $slack
}

incr r2r_hold_vios
}

puts "\[hold $kind] [get_property $start_pin full_name] -> [get_property $end_pin full_name] : [get_property $path slack]"
}

set setup_timing_paths [find_timing_paths -unique_paths_to_endpoint -path_delay max -sort_by_slack -group_count 999999999 -slack_max 0]
set worst_r2r_setup_slack 1e30
foreach path $setup_timing_paths {
set from "reg"
set to "reg"
Expand All @@ -290,15 +295,24 @@ foreach path $setup_timing_paths {

incr total_setup_vios
if { "$kind" == "reg-reg" } {
set slack [get_property $path slack]
puts $slack

if { $slack < $worst_r2r_setup_slack } {
set worst_r2r_setup_slack $slack
}

incr r2r_setup_vios
}

puts "\[setup $kind] [get_property $start_pin full_name] -> [get_property $end_pin full_name] : [get_property $path slack]"
}

write_metric_int "timing__hold_vio__count__corner:[$corner name]" $total_hold_vios
write_metric_num "timing__hold_r2r__ws__corner:[$corner name]" $worst_r2r_hold_slack
write_metric_int "timing__hold_r2r_vio__count__corner:[$corner name]" $r2r_hold_vios
write_metric_int "timing__setup_vio__count__corner:[$corner name]" $total_setup_vios
write_metric_num "timing__setup_r2r__ws__corner:[$corner name]" $worst_r2r_setup_slack
write_metric_int "timing__setup_r2r_vio__count__corner:[$corner name]" $r2r_setup_vios
puts "%OL_END_REPORT"

Expand Down
19 changes: 16 additions & 3 deletions openlane/steps/openroad.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@
"clock__skew__worst_hold": (-inf, max),
"clock__skew__worst_setup": (-inf, max),
"timing__hold__ws": (inf, min),
"timing__hold_r2r__ws": (inf, min),
"timing__setup__ws": (inf, min),
"timing__setup_r2r__ws": (inf, min),
"timing__hold__wns": (inf, min),
"timing__setup__wns": (inf, min),
"timing__hold__tns": (0, lambda x: sum(x)),
Expand Down Expand Up @@ -580,18 +582,25 @@ def format_count(count: Optional[Union[int, float, Decimal]]) -> str:
def format_slack(slack: Optional[Union[int, float, Decimal]]) -> str:
if slack is None:
return "[gray]?"
if slack == float(inf):
return "[gray]N/A"
slack = round(float(slack), 4)
if slack <= 0:
return f"[red]{slack}"
formatted_slack = f"{slack:.4f}"
if slack < 0:
return f"[red]{formatted_slack}"
else:
return f"[green]{slack}"
return f"[green]{formatted_slack}"

table = rich.table.Table()
table.add_column("Corner/Group")
table.add_column("Hold Worst Slack")
table.add_column("reg-to-reg")
table.add_column("Hold TNS")
table.add_column("Hold Violations")
table.add_column("of which reg-to-reg")
table.add_column("Setup Worst Slack")
table.add_column("reg-to-reg")
table.add_column("Setup TNS")
table.add_column("Setup Violations")
table.add_column("of which reg-to-reg")
table.add_column("Max Cap Violations")
Expand All @@ -603,9 +612,13 @@ def format_slack(slack: Optional[Union[int, float, Decimal]]) -> str:
row = [corner]
for metric in [
"timing__hold__ws",
"timing__hold_r2r__ws",
"timing__hold__tns",
"timing__hold_vio__count",
"timing__hold_r2r_vio__count",
"timing__setup__ws",
"timing__setup_r2r__ws",
"timing__setup__tns",
"timing__setup_vio__count",
"timing__setup_r2r_vio__count",
"design__max_cap_violation__count",
Expand Down

0 comments on commit f77e0dd

Please sign in to comment.