#! /usr/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 - Wed Oct  5 13:04:57 CEST 2011
# - this has to be a perl script now, csh script was not enough

# constants
my $VER="10.0b";
my $LOG="modelsim_run.log";
my $ELAB="postlayout.elab";
my $VCD="power.vcd";
my $DO="power.do";
my $NUMBLOCKS="1000";
my $PROBABILITY="20";
my $VCDDIR="/usr/scratch/antalya/kgf/shabziger/vcd";

unlink $LOG;


my %ALGORITHM = (
                "ethz_sha2"    =>  "0000", 
                "ethz_blake"   =>  "0001", 
                "ethz_groestl" =>  "0010", 
                "ethz_jh"      =>  "0011", 
                "ethz_keccak"  =>  "0100", 
                "ethz_skein"   =>  "0101", 
                "gmu_sha2"     =>  "1000", 
                "gmu_blake"    =>  "1001", 
                "gmu_groestl"  =>  "1010", 
                "gmu_jh"       =>  "1011", 
                "gmu_keccak"   =>  "1100", 
                "gmu_skein"    =>  "1101" 
                )   ;


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 |;

foreach my $a (@ALGS){
  print "Running algorithm $a\n";
  open (CONF, "> ../simvectors/config.txt") or die "Can not open ../simvectors/config.txt\n";
  print CONF<<"BUGU";
% The configuration file for shabziger
%
% All numbers in binary
% First entry is algorithm select
%    Second is the number of blocks to run
%    |     Third number is the (inverse) probability to generate a finblock signal
%    |     |    Fourth number is 73 bits of LFSR seed-----------------------------------|
%    |     |    |LSB     |                                                           MSB|
$ALGORITHM{$a} $NUMBLOCKS  $PROBABILITY   1000000000000000000000000010000000000000000000000000000000000000000000000
BUGU
  close(CONF);

  open(DO, "> $DO") or die "can not open do file $DO\n";
  print DO<<"BUGU";
run 1500 ns; 
vcd file $VCDDIR/${a}_${VCD}; 
vcd add -r /shabziger_chip_tb/DUT/*;
run 50us
quit;
BUGU
  close(DO);

  my $cmd="vsim-${VER} -load_elab postlayout.elab -do power.do >> $LOG";
  print "running [$cmd]\n";
  system ($cmd);
}

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