Skip to content

Commit

Permalink
compare_flow_metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
jjcherry56 committed Jun 17, 2021
1 parent 31531dc commit cfae1e4
Show file tree
Hide file tree
Showing 13 changed files with 232 additions and 22 deletions.
16 changes: 16 additions & 0 deletions test/aes_nangate45.metrics
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"instance_count" : "22167"
, "utilization" : "2.9"
, "design_area" : "25946"
, "DPL::errors" : "0"
, "ANT::errors" : "0"
, "DRT::drv" : "0"
, "worst_slack_min" : "0.088967447038752"
, "worst_slack_max" : "-0.08409406742318006"
, "tns_max" : "-5.561800954991669"
, "clock_skew" : "0.05810388445953065"
, "max_slew_violations" : "0"
, "max_fanout_violations" : "0"
, "max_capacitance_violations" : "0"
, "clock_period" : "0.810900"
}
16 changes: 16 additions & 0 deletions test/aes_sky130hd.metrics
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"instance_count" : "24410"
, "utilization" : "6.8"
, "design_area" : "205176"
, "DPL::errors" : "0"
, "ANT::errors" : "0"
, "DRT::drv" : "0"
, "worst_slack_min" : "0.1946411975576425"
, "worst_slack_max" : "-1.2672592223176151"
, "tns_max" : "-161.69136531789738"
, "clock_skew" : "0.5855105455092088"
, "max_slew_violations" : "0"
, "max_fanout_violations" : "0"
, "max_capacitance_violations" : "0"
, "clock_period" : "3.740000"
}
16 changes: 16 additions & 0 deletions test/aes_sky130hs.metrics
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"instance_count" : "23256"
, "utilization" : "9.2"
, "design_area" : "279058"
, "DPL::errors" : "0"
, "ANT::errors" : "0"
, "DRT::drv" : "0"
, "worst_slack_min" : "0.1477933373071917"
, "worst_slack_max" : "-0.8164256168871145"
, "tns_max" : "-69.22481273035046"
, "clock_skew" : "0.7503848865779472"
, "max_slew_violations" : "7"
, "max_fanout_violations" : "0"
, "max_capacitance_violations" : "1"
, "clock_period" : "2.811000"
}
17 changes: 17 additions & 0 deletions test/compare_flow_metrics
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
# The next line is executed by /bin/sh, but not Tcl \
exec tclsh $0 ${1+"$@"}

# Directory containing tests.
set test_dir [file dirname [file normalize [info script]]]
set openroad_dir [file dirname $test_dir]

source [file join $test_dir "regression.tcl"]
source [file join $test_dir "regression_tests.tcl"]
source [file join $test_dir "flow_metrics.tcl"]

compare_flow_metrics_main

# Local Variables:
# mode:tcl
# End:
61 changes: 39 additions & 22 deletions test/flow_metrics.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ proc check_test_metrics { test } {
################################################################

proc report_flow_metrics_main {} {
global arc argv
global argc argv
if { $argc == 0 } {
set tests $test_groups(flow)
} else {
Expand Down Expand Up @@ -211,21 +211,31 @@ proc report_test_metrics { test } {

################################################################

proc compare_test_metrics_main {} {
global arc argv
if { $argc == 0 } {
set tests $test_groups(flow)
proc compare_flow_metrics_main {} {
global argc argv
if { $argv == "help" || $argv == "-help" } {
puts {Usage: save_flow_metrics [test1]...}
} else {
set tests [expand_tests $argv]
}
set relative 0
if { $argc >= 1 && [lindex $argv 0] == "-relative" } {
set relative 1
set argc [expr $argc - 1]
set argv [lrange $argv 1 end]
}
if { $argc == 0 } {
set tests $test_groups(flow)
} else {
set tests [expand_tests $argv]
}

report_metrics_header
foreach test $tests {
compare_test_metrics $test
report_metrics_header
foreach test $tests {
compare_test_metrics $test $relative
}
}
}

proc compare_test_metrics { test } {
proc compare_test_metrics { test relative } {
# Don't require json until it is really needed.
package require json

Expand All @@ -234,28 +244,30 @@ proc compare_test_metrics { test } {
if { [file exists $metrics_file] \
&& [file exists $result_file] } {
set metrics_stream [open $metrics_file r]
set results_stream [open $metrics_result_file r]
set results_stream [open $result_file r]
set metrics_json [read $metrics_stream]
set results_json [read $results_stream]
close $metrics_stream
close $results_stream
puts -nonewline [format "%-20s" $test]
if { ![catch {json::json2dict $metrics_string} metrics_dict] \
&& ![catch {json::json2dict $result_string} results_dict]} {
if { ![catch {json::json2dict $metrics_json} metrics_dict] \
&& ![catch {json::json2dict $results_json} results_dict]} {
foreach name [metric_names] {
set short_name [metric_short_name $name]
if { $short_name != "" } {
set key [metric_json_key $name]
if { [dict exists $metrics_dict $key] \
&& [dict exists $results_dict $key]} {
set metrics_value [dict get $metrics_dict $key]
set result_value [dict get $result_dict $key]
if ($metrics_value != 0) {
set delta [expr ($result_value - $metrics_value) / $metrics_value]
set result_value [dict get $results_dict $key]
if { $metrics_value != 0 && $relative } {
set delta [expr ($result_value - $metrics_value) * 100.0 / abs($metrics_value)]
set field [format "%+.1f%%" $delta]
set field [format "%[string length $short_name]s" $field]
} else {
set delta [expr $result_value - $metrics_value]
set field [format [metric_format $name] $delta]
}
set field [format [metric_format $name] $delta]
} else {
set field [format "%[string length $short_name]s" "N/A"]
}
Expand All @@ -271,11 +283,16 @@ proc compare_test_metrics { test } {

# Copy result metrics to test results saved in the repository.
proc save_flow_metrics_main {} {
global argv
global argv argc

if { $argv == "help" || $argv == "-help" } {
puts {Usage: save_flow_metrics test1 [test2]...}
puts {Usage: save_flow_metrics [test1]...}
} else {
set tests [expand_tests $argv]
if { $argc == 0 } {
set tests [expand_tests "flow"]
} else {
set tests [expand_tests $argv]
}
foreach test $tests {
save_metrics $test
}
Expand All @@ -288,7 +305,7 @@ proc save_metrics { test } {
} else {
set metrics_result_file [test_metrics_result_file $test]
set metrics_file [test_metrics_file $test]
file copy $metrics_result_file $metrics_file
file copy -force $metrics_result_file $metrics_file
}
}

Expand Down
16 changes: 16 additions & 0 deletions test/gcd_nangate45.metrics
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"instance_count" : "368"
, "utilization" : "8.8"
, "design_area" : "564"
, "DPL::errors" : "0"
, "ANT::errors" : "0"
, "DRT::drv" : "0"
, "worst_slack_min" : "0.11158402295763645"
, "worst_slack_max" : "-0.013358592388155297"
, "tns_max" : "-0.06986023068880792"
, "clock_skew" : "0.002847007432610293"
, "max_slew_violations" : "0"
, "max_fanout_violations" : "0"
, "max_capacitance_violations" : "0"
, "clock_period" : "0.485000"
}
16 changes: 16 additions & 0 deletions test/gcd_sky130hd.metrics
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"instance_count" : "235"
, "utilization" : "6.2"
, "design_area" : "4835"
, "DPL::errors" : "0"
, "ANT::errors" : "0"
, "DRT::drv" : "0"
, "worst_slack_min" : "0.5281419340241067"
, "worst_slack_max" : "-0.2145448324168257"
, "tns_max" : "-3.939330306791268"
, "clock_skew" : "0.04105199629762815"
, "max_slew_violations" : "0"
, "max_fanout_violations" : "0"
, "max_capacitance_violations" : "0"
, "clock_period" : "4.360000"
}
16 changes: 16 additions & 0 deletions test/gcd_sky130hs.metrics
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"instance_count" : "368"
, "utilization" : "7.7"
, "design_area" : "6037"
, "DPL::errors" : "0"
, "ANT::errors" : "0"
, "DRT::drv" : "0"
, "worst_slack_min" : "0.3218794766275287"
, "worst_slack_max" : "-0.21815327939351623"
, "tns_max" : "-4.0824802471889425"
, "clock_skew" : "0.0338766801976952"
, "max_slew_violations" : "0"
, "max_fanout_violations" : "0"
, "max_capacitance_violations" : "0"
, "clock_period" : "1.780000"
}
16 changes: 16 additions & 0 deletions test/ibex_sky130hd.metrics
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"instance_count" : "15351"
, "utilization" : "3.8"
, "design_area" : "338322"
, "DPL::errors" : "0"
, "ANT::errors" : "0"
, "DRT::drv" : "0"
, "worst_slack_min" : "-1.4000130340186778"
, "worst_slack_max" : "-4.897586474996278"
, "tns_max" : "-3483.7779442865644"
, "clock_skew" : "5.1230185987897014"
, "max_slew_violations" : "895"
, "max_fanout_violations" : "0"
, "max_capacitance_violations" : "23"
, "clock_period" : "15.155000"
}
16 changes: 16 additions & 0 deletions test/ibex_sky130hs.metrics
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"instance_count" : "21251"
, "utilization" : "5.0"
, "design_area" : "443986"
, "DPL::errors" : "0"
, "ANT::errors" : "0"
, "DRT::drv" : "0"
, "worst_slack_min" : "0.10031264991480704"
, "worst_slack_max" : "-1.3433681214326452"
, "tns_max" : "-865.3525714264779"
, "clock_skew" : "3.0965006990519472"
, "max_slew_violations" : "44"
, "max_fanout_violations" : "0"
, "max_capacitance_violations" : "4"
, "clock_period" : "11.290000"
}
16 changes: 16 additions & 0 deletions test/jpeg_sky130hd.metrics
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"instance_count" : "57371"
, "utilization" : "7.4"
, "design_area" : "661577"
, "DPL::errors" : "0"
, "ANT::errors" : "0"
, "DRT::drv" : "0"
, "worst_slack_min" : "-0.09815526447234041"
, "worst_slack_max" : "-0.2522693236820903"
, "tns_max" : "-0.8340564031060045"
, "clock_skew" : "1.1026704306188861"
, "max_slew_violations" : "4"
, "max_fanout_violations" : "0"
, "max_capacitance_violations" : "0"
, "clock_period" : "12.087000"
}
16 changes: 16 additions & 0 deletions test/jpeg_sky130hs.metrics
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"instance_count" : "92216"
, "utilization" : "11.1"
, "design_area" : "984039"
, "DPL::errors" : "0"
, "ANT::errors" : "0"
, "DRT::drv" : "0"
, "worst_slack_min" : "0.05246780936004634"
, "worst_slack_max" : "-0.8525687064313778"
, "tns_max" : "-119.23315294799194"
, "clock_skew" : "0.638354276396025"
, "max_slew_violations" : "0"
, "max_fanout_violations" : "0"
, "max_capacitance_violations" : "0"
, "clock_period" : "6.387000"
}
16 changes: 16 additions & 0 deletions test/tinyRocket_nangate45.metrics
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"instance_count" : "35163"
, "utilization" : "7.8"
, "design_area" : "55274"
, "DPL::errors" : "0"
, "ANT::errors" : "0"
, "DRT::drv" : "0"
, "worst_slack_min" : "0.07948240901527767"
, "worst_slack_max" : "-0.28457947914773507"
, "tns_max" : "-100.86123155489292"
, "clock_skew" : "0.03872657859563223"
, "max_slew_violations" : "0"
, "max_fanout_violations" : "0"
, "max_capacitance_violations" : "0"
, "clock_period" : "2.030000"
}

0 comments on commit cfae1e4

Please sign in to comment.