#! /usr/bin/perl -w

############################################################
## Copyright: 2011 Integrated Sytems Laboratory, ETH Zurich
##            http://www.iis.ee.ethz.ch/~sha3
############################################################
use strict;

# v0.3 - kgf@ee.ethz.ch - Fri Sep  2 10:45:07 CEST 2011
# - small  backtick corrections
# v0.2 - muheim@ee.ethz.ch - Fri Sep  2 10:29:50 CEST 2011
# - fix the vcom for simulstuff and _tb.
# v0.1 - muheim@ee.ethz.ch - Thu Aug 25 09:44:43 CEST 2011
# - Script for compiling RTL sourcecode taking the list from source.list 
#   in sourcecode.

my $VER = "10.0b";
my $LIB = "rtl";


# determine the name of the library
my $name = `pwd`;
chomp($name);
$name =~ s/\/[^\/]+$//;
$name =~ s/^.*\///;

my $ALG= $name;
my $LOG= ${ALG}."_compile.log";
open (LOG, ">  $LOG") or die "Failed to open log file: $!\n";


if (-e $LIB) {
  print "- Deleting old library [$LIB]\n\n";
  `rm -rf $LIB`; 
}

`vlib-${VER} $LIB`;
my $date = `date`;
print LOG "** Compilation of ${ALG} from: $date\n";


open (SCR_LIST,    "< ../sourcecode/source.list") or die "Failed to open file: $!\n";

while (SCR_LIST){
  if (/(\S+)/){
    print  "- Compile : $1\n";
    print LOG `vcom-${VER}  -work $LIB -check_synthesis ../sourcecode/$1`;

  }
}
print  "- Compile : simulstuff.vhd\n";
print  "- Compile : ${ALG}_tb.vhd\n";
print LOG `vcom-${VER}  -work $LIB  ../sourcecode/simulstuff.vhd`;
print LOG `vcom-${VER}  -work $LIB  ../sourcecode/${ALG}_tb.vhd`;

close (SCR_LIST);
close (LOG);

my $WarningsC  = `grep -c "** Warn" ${LOG}`;
my $ErrorsC    = `grep -c "** Err" ${LOG}`;
chomp($WarningsC);
chomp($ErrorsC);
my $Warnings   = `grep -i "** Warn" ${LOG}`;
my $Errors     = `grep -i "** Err" ${LOG} | grep -v "Compiler exiting"`;

print "\n";
print "- Reporting Warnings: $WarningsC\n";
print "$Warnings";
print "- Reporting Errors:   $ErrorsC\n";
print "$Errors";
print "* Done\n";

print  "\n    vsim-${VER} -c  -lib  ${LIB}  ${ALG}_tb -do \"run -all; quit\" | tee ../simvectors/${ALG}_sim.rpt\n\n";



Generated on Tue Nov 22 15:16:34 CET 2011
Home