Line 11... |
Line 11... |
my $RegressionsDirectory = "../regressions/single_core/";
|
my $RegressionsDirectory = "../regressions/single_core/";
|
my $CompilerDir = "../compiler/bin/";
|
my $CompilerDir = "../compiler/bin/";
|
my $SimulatonResultFile = "test_result.log";
|
my $SimulatonResultFile = "test_result.log";
|
my $Option_Quiet = 1;
|
my $Option_Quiet = 1;
|
my $TestConfig;
|
my $TestConfig;
|
|
my $UserTest = undef;
|
#Set the enviroment variable THEIA_PROJECT_FOLDER
|
#Set the enviroment variable THEIA_PROJECT_FOLDER
|
my $tmp = `pwd`;
|
my $tmp = `pwd`;
|
chomp $tmp;
|
chomp $tmp;
|
$tmp .= "/../";
|
$tmp .= "/../";
|
$ENV{'THEIA_PROJECT_FOLDER'} = $tmp;
|
$ENV{'THEIA_PROJECT_FOLDER'} = $tmp;
|
|
|
#find all the *.vp files
|
#find all the *.vp files
|
|
|
my @Tests = <$RegressionsDirectory/*.vp>;
|
my @Tests;
|
|
if (not defined $ARGV[0])
|
|
{
|
|
@Tests = <$RegressionsDirectory/*.vp>;
|
|
} else {
|
|
|
|
$UserTest = "$RegressionsDirectory/$ARGV[0]";
|
|
die "Test $UserTest not found\n" if (not -e "$UserTest");
|
|
@Tests = ($UserTest);
|
|
}
|
for my $Test (@Tests)
|
for my $Test (@Tests)
|
{
|
{
|
print sprintf("Running test %-60s ",$Test);
|
print sprintf("Running test %-60s ",$Test);
|
#Compile the test
|
#Compile the test
|
my $CompilationOutput = `$CompilerDir/theia_compile $Test`;
|
my $CompilationOutput = `$CompilerDir/theia_compile $Test`;
|
if ($CompilationOutput =~ /ERROR/)
|
if ($CompilationOutput =~ /ERROR/)
|
{
|
{
|
print $CompilationOutput;
|
print $CompilationOutput;
|
print "ERROR: theia_compile failed!\n";
|
print "ERROR: theia_compile failed!\n";
|
`rm *.mem`;
|
`ls *.mem | grep -v tmem.mem | xargs rm `;
|
next;
|
next;
|
}
|
}
|
print $CompilationOutput if ($Option_Quiet == 0);
|
print $CompilationOutput if ($Option_Quiet == 0);
|
#Run the test
|
#Run the test
|
my $SimulationOutput = `make run`;
|
my $SimulationOutput = `make run`;
|
Line 46... |
Line 56... |
$TestConfig = $RegressionsDirectory . "/" . $TestBaseName . ".config";
|
$TestConfig = $RegressionsDirectory . "/" . $TestBaseName . ".config";
|
|
|
if (not -e $TestConfig)
|
if (not -e $TestConfig)
|
{
|
{
|
print "ERROR: test configuration file $TestConfig does not exist\n";
|
print "ERROR: test configuration file $TestConfig does not exist\n";
|
`rm *.mem`;
|
`ls *.mem | grep -v tmem.mem | xargs rm `;
|
next;
|
next;
|
}
|
}
|
ParseConfigFile( $TestConfig );
|
ParseConfigFile( $TestConfig );
|
|
|
|
|
Line 66... |
Line 76... |
my $Line = 0;
|
my $Line = 0;
|
my $Failed = 0;
|
my $Failed = 0;
|
my $block, my $vp;
|
my $block, my $vp;
|
my $vpindex;
|
my $vpindex;
|
open CONFIG_FILE , $ConfigFile or die "Could not open $ConfigFile : $!\n";
|
open CONFIG_FILE , $ConfigFile or die "Could not open $ConfigFile : $!\n";
|
|
print "Parsing configuration file $ConfigFile\n" if ($Option_Quiet == 0);
|
while (<CONFIG_FILE>)
|
while (<CONFIG_FILE>)
|
{
|
{
|
$Line++;
|
$Line++;
|
next if m/\/\/.*/; #skip comments
|
next if m/\/\/.*/; #skip comments
|
#print "* $_ \n";
|
|
if (m/==/)
|
if (m/==/)
|
{
|
{
|
(my $left, my $ExpectedValue) = split /==/;
|
(my $left, my $ExpectedValue) = split /==/;
|
$ExpectedValue =~ s/\s+//g;
|
$ExpectedValue =~ s/\s+//g;
|
chomp $ExpectedValue;
|
chomp $ExpectedValue;
|
Line 91... |
Line 101... |
{
|
{
|
my $index = $1;
|
my $index = $1;
|
my $log_file = "rf.vp." . $vpindex . ".log";
|
my $log_file = "rf.vp." . $vpindex . ".log";
|
die "Could not open $log_file : $!\n" if (not -e $log_file);
|
die "Could not open $log_file : $!\n" if (not -e $log_file);
|
my $RegValue = `grep r$index $log_file| awk '{print \$2 \$3 \$4}'`;
|
my $RegValue = `grep r$index $log_file| awk '{print \$2 \$3 \$4}'`;
|
|
chomp $RegValue;
|
if (not ($RegValue =~ m/$ExpectedValue/))
|
if (not ($RegValue =~ m/$ExpectedValue/))
|
{
|
{
|
$Failed = 1;
|
$Failed = 1;
|
print "\n\t ASSERTION : Expecting vp[ $vpindex ].r[ $index ] == '$ExpectedValue', but simulation has value '$RegValue' \n";
|
print "\n\t ASSERTION : Expecting vp[ $vpindex ].r[ $index ] == '$ExpectedValue', but simulation has value '$RegValue' \n";
|
}
|
}
|
|
|
} elsif ($block =~ m/omem\[\s*(\d+)\s*\]/) { #get the OMEM <index>, expr omem[ <index> ]
|
} elsif ($block =~ m/omem\[\s*(\d+)\s*\]/) { #get the OMEM <index>, expr omem[ <index> ]
|
|
|
my $index = $1;
|
my $index = $1;
|
|
my $log_file = "OMEM.vp." . $vpindex . ".log";
|
|
die "Could not open $log_file : $!\n" if (not -e $log_file);
|
|
print "Expected Value: $ExpectedValue\n" if ($Option_Quiet == 0);
|
|
my $GrepString;
|
|
$GrepString = sprintf("grep @%02d %s| awk '{print $2 }'",$index,$log_file);
|
|
my $OmemValue = `$GrepString`;
|
|
chomp $OmemValue;
|
|
print " $GrepString\n" if ($Option_Quiet == 0);
|
|
if (not ($OmemValue =~ m/$ExpectedValue/))
|
|
{
|
|
$Failed = 1;
|
|
print "\n\t ASSERTION : Expecting vp[ $vpindex ].omem[ $index ] == '$ExpectedValue', but simulation has value '$OmemValue' \n";
|
|
}
|
|
|
} else {
|
} else {
|
die "Error parsing '$ConfigFile' unknown block type '$block'\n";
|
die "Error parsing '$ConfigFile' unknown block type '$block'\n";
|
}
|
}
|
|
|