rcp_misc_test 4.57 KB
#!/usr/sbin/perl

if ($ENV{"ROOT"}) {
   $ROOT = $ENV{"ROOT"};
  }
else {
  die "ROOT env not set. Plaase set ROOT environment first \n";
  }

$VUREGRES =  $ROOT."/PR/rspsim/vuregre";
#$TEST_SRC_DIR =  $VUREGRES."/rcp_misc_tests";
$TEST_SRC_DIR =  $ROOT."/PR/hw2/chip/vector/rcp_misc_test";

$hw2 = 1;
$HW = "hw2";
$MAKE_REAL_MAKEFILE  = "make_reality_makefile2";

if ($ENV{"USE_HW_ROOT"}) {
   $hw2 = 0;
   $HW = "hw";
   $MAKE_REAL_MAKEFILE  = "make_reality_makefile";
  }

$TOOL =   $VUREGRES."/bin";
$RSPASM = $ROOT."/PR/rspasm1201";
$RSPSIM = $ROOT."/PR/rspsim";
$REALITY_PATH = $ROOT."/PR/".$HW."/chip/sim";

$VCSDIR = "/ecad/vcs/vcs_2.2/sgi";

$WORKDIR = `pwd`;
chop($WORKDIR);
$DESIGNC = $WORKDIR."/designc"; 


$OPTION_VCSCOMPILE = 1;
$OPTION_VCSRUN = 1;
$OPTION_GATE = 0;
@PlusArgs = ();
$TEST = "";
$MMAP = "";

while ($#ARGV >= 0) {

    if ($ARGV[0] eq '-nocompile') {
      shift (@ARGV);
      $OPTION_VCSCOMPILE = 0;
      $OPTION_ASM = 0;
    }
    elsif ($ARGV[0] eq '-norun') {
      shift (@ARGV);
      $OPTION_VCSRUN = 0;
    }
    elsif ($ARGV[0] eq '+freeze_vclk_false') {
      $PlusArgs = push(@PlusArgs,shift(@ARGV));
      $PlusArgs = push(@PlusArgs,"+test_bypass");
    }
    elsif ($ARGV[0] eq '+rcp_full_tssi') {
      $PlusArgs = push(@PlusArgs,shift(@ARGV));
    }
    elsif ($ARGV[0] eq '+rcp_test_tssi') {
      $PlusArgs = push(@PlusArgs,shift(@ARGV));
      $PlusArgs = push(@PlusArgs,"+test_bypass");
    }
    elsif ($ARGV[0] eq '+rcp_hp330_tssi') {
      $PlusArgs = push(@PlusArgs,shift(@ARGV));
    }
    elsif ($ARGV[0] eq '+rcp_attest_tab') {
      $PlusArgs = push(@PlusArgs,shift(@ARGV));
    }
    elsif ($ARGV[0] =~ /^\+attest_name=/) {
      $PlusArgs = push(@PlusArgs,shift(@ARGV));
    }
    elsif ($ARGV[0] =~ /^\+mmap_rdram=/) {
      $PlusArgs = push(@PlusArgs,shift(@ARGV));
      $MMAP = "-MMAP";
    }
    elsif ($ARGV[0] =~ /^\+tssi_name=/) {
      $PlusArgs = push(@PlusArgs,shift(@ARGV));
    }
    elsif ($ARGV[0] eq '+dumpvars') {
      $PlusArgs = push(@PlusArgs,shift(@ARGV));
    }
    elsif ($ARGV[0] eq '+rsp_mon') {
      $PlusArgs = push(@PlusArgs,shift(@ARGV));
    }
    elsif ($ARGV[0] =~ /^\+reality=/) {
      ($TEMP,$plus_arg) = split(/=/,shift(@ARGV));
      $PlusArgs = push(@PlusArgs,"+".$plus_arg);
    }
    elsif ($ARGV[0] =~ /^\+test=/) {
      ($TEMP,$TEST) = split(/=/,shift(@ARGV));
      $TEST = $TEST.".v";
    }
    elsif ($ARGV[0] eq '-h') {
      shift (@ARGV);
      print "\n";
      print "\n";
      exit; 
    }
    else {
    die "Illigal option provided \n";
    }

} #while ($#ARGV >= 0)

if (!(-e $DESIGNC && -d $DESIGNC)) {
  print "Creating the $DESIGNC directory\n";
  mkdir ($DESIGNC,0777) || die "Cant make $DESIGNC \n";
  } 

if (!(-r $REALITY_PATH."/Makefile")){
  die "$REALITY_PATH/Makefile not found. Please p_tupdate $REALITY_PATH \n";
  }

if (-r $REALITY_PATH."/Makefile"){
    print "Getting file $REALITY_PATH/Makefile \n";
    system("cat $REALITY_PATH/Makefile | $TOOL/$MAKE_REAL_MAKEFILE $MMAP > $WORKDIR/Makefile")==0
      || die " System Call interrupt";
    chmod(0666,$WORKDIR."/Makefile");
   }
else {
  die "$REALITY_PATH/Makefile not found. Please p_tupdate $REALITY_PATH \n";
   }

if (-r $TEST_SRC_DIR."/$TEST") {
    print "Getting file $TEST_SRC_DIR/$TEST \n";
    system("cp $TEST_SRC_DIR/$TEST rcp_misc_test.v")==0 || die " System Call interrupt";
    chmod(0666, rcp_misc_test.v);
   }
else {
  die "$TEST_SRC_DIR/$TEST not found. Please p_tupdate $REALITY_PATH \n";
   }

if ($OPTION_VCSCOMPILE) {
  print "\n\nVCS Compile in progress\n\n";
  chdir ("$WORKDIR");

  if (-r "$WORKDIR/designc/simv"){
    system("rm $WORKDIR/designc/simv")==0 || die "System Interrupt";
    }
  chdir ("$WORKDIR");
  system("make simv_rcp_misc_test")==0 || die "VCS compile interupt";
  system("mv simv_rcp_misc_test designc/simv_rcp_misc_test")==0 || die "System Interrupt";
#  if ((-e simv_rcp_misc_test.daidir && -d simv_rcp_misc_test.daidir)) {
#    print "linking the simv_rcp_misc_test.daidir  directory\n";
#    chdir ("$WORKDIR/designc");
#    system("ln -s $WORKDIR/simv_rcp_misc_test.daidir .")==0 || die "System Interrupt";
#    chdir ("$WORKDIR");
#    }

}

$SIMV = "simv";

$HW_TYPE = "on HW2";
if ($hw2==0) {
  $HW_TYPE = "on HW";
  }

if ($OPTION_VCSRUN) {
    chdir ("$WORKDIR");
    print "\n\n Running (RSP RCP_PIN_LEVEL, $GATE_LEVEL, $HW_TYPE) Simulation\n\n";
    print "plusargs passed to vcs are: @PlusArgs \n";

    system("/bin/csh -c 'setenv LD_LIBRARY_PATH $VCSDIR/lib; ".
    "time designc/simv_rcp_misc_test -q @PlusArgs ' > ,out")==0
               || die("Interrupt occured, cannot run regression");
    print "SImulation Complete\n";
}