Skip to content

Commit

Permalink
QoR support for build system.
Browse files Browse the repository at this point in the history
git-svn-id: https://vtr-verilog-to-routing.googlecode.com/svn/trunk@501 8e3573b8-cf2c-4f14-ef6d-137439e28b8b
  • Loading branch information
nrootn committed Jul 3, 2012
1 parent 58732c4 commit b1758b5
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 24 deletions.
99 changes: 78 additions & 21 deletions run_reg_test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
my $parse_only = 0;
my $create_golden = 0;
my $check_golden = 0;
my $calc_qor = 0;
my $display_qor = 0;
my $can_quit = 0;

# Parse Input Arguments
Expand All @@ -70,6 +72,12 @@
elsif ( $token eq "-check_golden" ) {
$check_golden = 1;
}
elsif ( $token eq "-calc_qor" ) {
$calc_qor = 1;
}
elsif ( $token eq "-display_qor" ) {
$display_qor = 1;
}
elsif ($token eq "quick_test") {
run_quick_test();
$can_quit = 1;
Expand Down Expand Up @@ -128,9 +136,6 @@
##############################################################

if ( $#tests > -1 ) {
print "=============================================\n";
print " Verilog-to-Routing Regression Testing \n";
print "=============================================\n";

foreach my $test (@tests) {
chomp($test);
Expand All @@ -141,9 +146,9 @@
# Run regression test
run_single_test;
# Parse regression test
parse_single_test;
parse_single_test("");
# Check golden results
parse_single_test("check");
parse_single_test("check", "calculate");
}
print "\nTest complete\n\n";
}
Expand All @@ -170,40 +175,85 @@ sub check_override {

if ($parse_only) {
parse_single_test;
die;
die "Parsed results";
}

if ($create_golden) {
parse_single_test("create");
die;
die "Created golden results";
}

if ($check_golden) {
parse_single_test("check");
die;
die "Checked results.";
}

if ($calc_qor) {
parse_single_test("calculate");
die "Calculated results.";
}

if ($display_qor) {
if (!-e "$test_dir/qor_geomean.txt") {
die "QoR results do not exist ($test_dir/qor_geomean.txt)";
}
elsif (!-r "$test_dir/qor_geomean.txt") {
die "[ERROR] Failed to open $test_dir/qor_geomean.txt: $!";
}
else {
print "============================================================================================================================\n";
print " Verilog-to-Routing QoR Results \n";
print "============================================================================================================================\n";

open( QOR_FILE, "$test_dir/qor_geomean.txt" );
my $output = <QOR_FILE>;

my @first_line = split( /\t/, trim($output) );
print "@first_line[1]" . "\t\t " . "@first_line[2]" . "\t\t " . "@first_line[3]" . "\t\t " . "@first_line[4]" . "\t\t" . "@first_line[5] \n";
print "-----------------------" . "\t\t" . "----------------" . "\t" . "----------------" . "\t" . "----------------" . "\t" . "--------------------" . "\n";
my $last_line;
while(<QOR_FILE>) {
$last_line = $_ if eof;
}
my @last_line = split( /\t/, trim($last_line) );
print "@last_line[1]" . "\t\t" . "@last_line[2]" . "\t" . "@last_line[3]" . "\t" . "@last_line[4]" . "\t" . "@last_line[5] \n\n";
die "QoR results displayed";
}
}
}

my $first = 1;

sub run_single_test {
if ($first) {
print "=============================================\n";
print " Verilog-to-Routing Regression Testing \n";
print "=============================================\n";
$first = 0;
}

print "\nRunning regression test... \n";
system("$vtr_flow_path/scripts/run_vtr_task.pl $script_params \n");
}

sub parse_single_test {
my $golden = shift;

if ( $golden eq "create" ) {
print "\nCreating golden results... \n";
$script_params = $script_params . " -create_golden";
}
elsif ( $golden eq "check" ) {
print "\nChecking test results... \n";
$script_params = $script_params . " -check_golden";
}
else {
print "\nParsing test results... \n";
while ( my $golden = shift(@_) ) {
if ( $golden eq "create" ) {
print "\nCreating golden results... \n\n";
$script_params = $script_params . " -create_golden";
}
elsif ( $golden eq "check" ) {
print "\nChecking test results... \n\n";
$script_params = $script_params . " -check_golden";
}
elsif ( $golden eq "calculate" ) {
print "\nCalculating QoR results... \n\n";
$script_params = $script_params . " -calc_qor";
}
else {
print "\nParsing test results... \n\n";
}
}

system("$vtr_flow_path/scripts/parse_vtr_task.pl $script_params \n");
}

Expand Down Expand Up @@ -260,4 +310,11 @@ sub run_odin_test {
}

chdir ("..");
}

sub trim($) {
my $string = shift;
$string =~ s/^\s+//;
$string =~ s/\s+$//;
return $string;
}
5 changes: 2 additions & 3 deletions vtr_flow/scripts/parse_vtr_task.pl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
my $check_golden = 0;
my $parse_qor = 1; # QoR file is parsed by default; turned off if
# user does not specify QoR parse file in config.txt
my $calc_qor = 1; # QoR geomeans are computed by default, turned off as above.
my $calc_qor = 0; # QoR geomeans are not computed by default;

while ( $token = shift(@ARGV) ) {

Expand Down Expand Up @@ -209,7 +209,7 @@ sub calc_geomean {
}
else {
}
print OUTPUT_FILE "${exp_num}";
print OUTPUT_FILE "\n${exp_num}";

##############################################################
# Compute & write geomean to output file
Expand All @@ -231,7 +231,6 @@ sub calc_geomean {
print OUTPUT_FILE "\t" . "${geomean}" ;
$index++;
}
print OUTPUT_FILE "\n";
close(OUTPUT_FILE);
}

Expand Down

0 comments on commit b1758b5

Please sign in to comment.