#! /usr/sepp/bin/perl -w
############################################################
## Copyright: 2011 Integrated Sytems Laboratory, ETH Zurich
## http://www.iis.ee.ethz.ch/~sha3
############################################################
use strict;
# v0.1 - kgf@ee.ethz.ch - Thu Aug 25 20:26:46 CEST 2011
# one attempt to compile everything
# constants
my $VER="10.0b";
my $LIB="final";
my $LOG="compile_all.log";
my @ALGS= qw| ethz_blake ethz_groestl ethz_jh ethz_keccak ethz_sha2 ethz_skein
gmu_blake gmu_groestl gmu_jh gmu_keccak gmu_sha2 gmu_skein
shabziger|;
#my @ALGS= qw| ethz_blake|;
my %CNT = ("Warning" => 0,
"Error" => 0);
print "\n","=" x 75,"\n";
print "Starting script at: ";
print `date`;
print "=" x 75,"\n\n";
if (-d $LIB){
print "Removing the Modelsim library [$LIB]\n\n";
system ("rm -rf $LIB");
}
system ("vlib-${VER} ${LIB}");
open (LOG, "> $LOG") or die " ERROR: Can not open log file $LOG\n";
foreach my $a (@ALGS){
print " Compiling [$a] \n";
if (open (LST, "< ../../$a/sourcecode/source.list")){
my @FILES=(LST);
close(LST);
foreach my $f(@FILES){
chomp($f);
print " Compiling : $f\n";
my @res=`vcom-${VER} -work ${LIB} -check_synthesis ../../$a/sourcecode/$f`;
foreach my $r (@res){
print LOG $r;
if ($r=~/^\s*\*\* (Warning|Error)/){
$CNT{$1}++;
print " ".$r
}
}
}
}
else{
print " Error: could not access ../../$a/sourcecode/source.list\n";
}
}
# close teh log file
close(LOG);
print "\nDONE!\n\n Log file = $LOG\n\n";
print "\n","=" x 75,"\n";
if ($CNT{"Warning"} + $CNT{"Error"} gt 0 ){
printf("RESULT: A total of %d Warning(s) and %d Error(s) were encountered\n",$CNT{"Warning"},$CNT{"Error"});
}
else {
print "RESULT: Compilation Successful\n";
}
print "\n\n";