Line 11... |
Line 11... |
use strict;
|
use strict;
|
use Cwd;
|
use Cwd;
|
use File::Copy;
|
use File::Copy;
|
use File::Find;
|
use File::Find;
|
use HTTP::Date;
|
use HTTP::Date;
|
|
use Time::HiRes;
|
use Data::Dumper;
|
use Data::Dumper;
|
#use File::Copy::Recursive;
|
#use File::Copy::Recursive;
|
|
|
#Globals
|
#Globals
|
my $SimulationCommand = undef;
|
my $SimulationCommand = undef;
|
Line 29... |
Line 30... |
print "Running from $ScriptPath\n";
|
print "Running from $ScriptPath\n";
|
#Read the configuration from this file
|
#Read the configuration from this file
|
eval Slurp( "testlist.pl" );
|
eval Slurp( "testlist.pl" );
|
die "-E- Errors in configuration file!\n".$@."\n" if($@);
|
die "-E- Errors in configuration file!\n".$@."\n" if($@);
|
|
|
|
my $Scale = 131072; # 2^17
|
CreateTargetTree( $RegressionTargetDirectory );
|
CreateTargetTree( $RegressionTargetDirectory );
|
#----------------------------------------------------------------
|
#----------------------------------------------------------------
|
sub hashValueAscendingNum {
|
sub hashValueAscendingNum {
|
$TestList{$a}->{'run_index'} <=> $TestList{$b}->{'run_index'};
|
$TestList{$a}->{'run_index'} <=> $TestList{$b}->{'run_index'};
|
}
|
}
|
Line 48... |
Line 49... |
mkdir $RegDir or die "Cannot create regression folder '$RegDir' $!\n";
|
mkdir $RegDir or die "Cannot create regression folder '$RegDir' $!\n";
|
|
|
#Create the regression.log
|
#Create the regression.log
|
open LOG, ">$RegDir/regression.log" or die "Cannot create file regression log file '$RegDir/Regression.log' $!\n";
|
open LOG, ">$RegDir/regression.log" or die "Cannot create file regression log file '$RegDir/Regression.log' $!\n";
|
print LOG "Regression Test-bench started at $date ,time $time\n";
|
print LOG "Regression Test-bench started at $date ,time $time\n";
|
|
#Collect some information about the system
|
|
my $system = `uname -a`;
|
|
my $memory = `cat /proc/meminfo | grep -i memtotal`;
|
|
my $cpu = `cat /proc/cpuinfo | grep -i model | grep name`;
|
|
print LOG "System: $system\n";
|
|
print LOG "RAM: $memory\n";
|
|
print LOG "CPU:\n$cpu\n";
|
|
|
#for my $i (0 .. $#TestList)
|
#for my $i (0 .. $#TestList)
|
#print Dumper(%TestList);
|
#print Dumper(%TestList);
|
for my $TestName (sort hashValueAscendingNum (keys %TestList))
|
for my $TestName (sort hashValueAscendingNum (keys %TestList))
|
{
|
{
|
Line 62... |
Line 69... |
|
|
|
|
print LOG "-----------------------------------------------------------------------------------\n";
|
print LOG "-----------------------------------------------------------------------------------\n";
|
print LOG "Scene: '$TestName'\n";
|
print LOG "Scene: '$TestName'\n";
|
my $TestDir = "$RegDir/$TestName";
|
my $TestDir = "$RegDir/$TestName";
|
|
|
mkdir $TestDir;
|
mkdir $TestDir;
|
#Copy compulsory files
|
#Copy compulsory files
|
copy("$TestPath/Vertex.mem","$TestDir/") or die "-E- $TestPath/Vertex.mem $!\n";
|
copy("$TestPath/Vertex.mem","$TestDir/") or die "-E- $TestPath/Vertex.mem $!\n";
|
copy("$TestPath/Params.mem","$TestDir/") or die "-E- $TestPath/Params.mem $!\n";
|
copy("$TestPath/Params.mem","$TestDir/") or die "-E- $TestPath/Params.mem $!\n";
|
copy("$TestPath/Creg.mem","$TestDir/") or die "-E- $TestPath/Config.mem $!\n";
|
copy("$TestPath/Creg.mem","$TestDir/") or die "-E- $TestPath/Config.mem $!\n";
|
copy("$TestPath/Reference.ppm","$TestDir/") or die "-E- $TestPath/Reference.ppm $!\n";
|
copy("$TestPath/Reference.ppm","$TestDir/") or die "-E- $TestPath/Reference.ppm $!\n";
|
copy("$TestPath/Textures.mem","$TestDir/") or die "-E- $TestPath/Textures.ppm $!\n";
|
copy("$TestPath/Textures.mem","$TestDir/") or die "-E- $TestPath/Textures.ppm $!\n";
|
copy("$TestPath/Instructions.mem","$TestDir/") or die "-E- $TestPath/Instructions.ppm $!\n";
|
copy("$TestPath/Instructions.mem","$TestDir/") or die "-E- $TestPath/Instructions.ppm $!\n";
|
copy("$TestPath/Instructions.mem","$TestDir/") or die "-E- $TestPath/Instructions.ppm $!\n";
|
copy("$TestPath/Instructions.mem","$TestDir/") or die "-E- $TestPath/Instructions.ppm $!\n";
|
|
#Print some information about the scene
|
|
my $Line = `grep -i width $TestDir/Params.mem`;
|
|
my ($Width,$Height) = split(" ", $Line);
|
|
$Width = (hex $Width)/$Scale;
|
|
$Height = (hex $Height)/$Scale;
|
|
|
|
print LOG "Scene Resolution: $Width x $Height\n";
|
|
$Line = `grep -i texture $TestDir/Params.mem`;
|
|
my ($Width,$Height) = split(" ", $Line);
|
|
$Width = (hex $Width)/$Scale;
|
|
$Height = (hex $Height)/$Scale;
|
|
print LOG "Texture: $Width x $Height\n";
|
|
my $TringleCount = `grep -A 1 -i child $TestDir/Vertex.mem | grep -v -i child`;
|
|
print LOG "Triangle count: $TringleCount\n";
|
|
|
#Copy the Source files just in case..
|
#Copy the Source files just in case..
|
mkdir "$RegDir/rtl";
|
mkdir "$RegDir/rtl";
|
system("cp -vr ../rtl/*.v $RegDir/rtl");
|
system("cp -vr ../rtl/*.v $RegDir/rtl");
|
#copy("../rtl","$RegDir") or die ("Cannot Copy '" . $_ . "' : $!\n");
|
#copy("../rtl","$RegDir") or die ("Cannot Copy '" . $_ . "' : $!\n");
|
Line 115... |
Line 137... |
|
|
|
|
#Execute the Simulation
|
#Execute the Simulation
|
chdir $TestDir;
|
chdir $TestDir;
|
my ($StartDate,$StartTime) = split(" ", HTTP::Date::time2iso());
|
my ($StartDate,$StartTime) = split(" ", HTTP::Date::time2iso());
|
print LOG "Simulation started at: $StartDate $StartTime\n";
|
|
print LOG "Number of execution cores: $CoreCount\n";
|
print LOG "Number of execution cores: $CoreCount\n";
|
print LOG "Number of memory banks: $MemBankCount\n";
|
print LOG "Number of memory banks: $MemBankCount\n";
|
|
print LOG "Simulation started at: $StartDate $StartTime\n";
|
|
|
#system "$SimulationCommand -tclbatch isim.tcl";
|
#system "$SimulationCommand -tclbatch isim.tcl";
|
if (system ("perl $ScriptPath/configure_params.pl $CoreCount") != 0)
|
if (system ("perl $ScriptPath/configure_params.pl $CoreCount") != 0)
|
{
|
{
|
die "-E- Error configuing scene parameters! ($!)\n";
|
die "-E- Error configuing scene parameters! ($!)\n";
|
}
|
}
|
|
my $StartTime = [Time::HiRes::gettimeofday()];
|
if (system("vvp -n $SimulationBinary -none") != 0)
|
if (system("vvp -n $SimulationBinary -none") != 0)
|
{
|
{
|
print LOG "-E- Error running simulation! ($!)\n";
|
print LOG "-E- Error running simulation! ($!)\n";
|
}
|
}
|
|
|
|
my $diff = Time::HiRes::tv_interval($StartTime);
|
my ($EndDate,$EndTime) = split(" ", HTTP::Date::time2iso());
|
my ($EndDate,$EndTime) = split(" ", HTTP::Date::time2iso());
|
print LOG "Simulation Completed at $EndDate $EndTime\n";
|
print LOG "Simulation Completed at $EndDate $EndTime\n";
|
if ( $StartDate eq $EndDate)
|
print LOG "Simulation ran for " . $diff/3600 . " hours\n";
|
{
|
|
my ($StartHour,$StartMinute) = split ":",$StartTime;
|
|
my ($EndHour,$EndMinute) = split ":",$EndTime;
|
|
print LOG "Elapsed time "
|
|
. ($EndHour - $StartHour) . " : " . ($EndMinute - $StartMinute) . "\n";
|
|
} else {
|
|
print LOG "Simulation ran for more than 1 day\n";
|
|
}
|
|
ParseOutputPPM( $TestDir );
|
ParseOutputPPM( $TestDir );
|
|
|
# system("perl D:/\Proyecto/\RTL/\Scripts/calculate_stats.pl $TestDir/\CU.log $RegDir/\Regression.log $TestDir/\Simulation.log");
|
# system("perl D:/\Proyecto/\RTL/\Scripts/calculate_stats.pl $TestDir/\CU.log $RegDir/\Regression.log $TestDir/\Simulation.log");
|
|
|
}
|
}
|