支持RVM/VMM/UVM验证方法学+VCS/NC仿真器+Verdi的dumpfsdb的通用脚本文件

来源:互联网 发布:mac怎么添加铃声 编辑:程序博客网 时间:2024/04/29 15:18

0.一直想弄一个支持支持多种验证方法学,支持多种仿真器,支持Verdi的dumpfsdb的通用脚本文件,现在终于弄了个初版本,以后继续完善。

1.使用示例

1.1.使用RVM的例子

(1)例子源文件

http://pan.baidu.com/s/1hqxhvwS

(2)使用命令

>perl run_test -test testcase1 -rvm -vcs

>perl run_test -test testcase1 -rvm -nc

1.2.使用VMM的例子

(1)例子源文件:

http://pan.baidu.com/s/1jg0b0

(2)使用命令:

>perl run_test -test testcase1 -vmm -vcs

1.2.使用UVM的例子

(1)例子源文件:

http://pan.baidu.com/s/1rnYYM

(2)使用命令:

>perl run_test -test testcase1 -uvm -vcs

2.源文件

#! /usr/bin/perl
#support vcs and nc simulator
#support dumpfsdb

use Time::localtime;
use Getopt::Long;
use IO::File;
STDOUT->autoflush(1);

############################################################
#               1.setup enviroment
############################################################
$ENV{NOVAS_HOME} = "/usr/cad/verdi-2012.10";
$ENV{UVM_HOME} = "/usr/cad/uvm-1.2";
############################################################
#               2.get options and prepare for macro
############################################################
#2.1.macro and option initinallize
@arg = @ARGV;
$opt_nc = 0;
$opt_vcs = 0;
$opt_fsdb = 0;
$opt_start_at = 0;
$opt_stop_at = 0;
$opt_seed = 0;
$opt_timeout_ms = 0;
$opt_debug = 0;
$opt_error = 0;
$nc_cmd = "";     #nc simulator command
$vcs_cmd = "";    #vcs simulator command
$vera_cmd = "";   #vera simulator command
$common_cmd = ""; #common command
$tb_macro = "";   #testbench macro
$dut_macro = "";  #dut macro
if($#ARGV == -1){
   &print_help();
   exit(1);
}
@cmd = @ARGV;
unshift @cmd,$0;
foreach $line(@cmd){
   print "$line ";
}
print "\n";
Getopt::Long::Configure('no_auto_abbrev');
$result = GetOptions(
                    "help" => sub{ &print_help();},
                    "nc" => sub{ $opt_nc = 1;},
                    "vcs" => sub{$opt_vcs = 1;},
                    "fsdb" => sub{$opt_fsdb = 1;},
                    "test=s",
                    "seed=i",
                    "start_at",
                    "stop_at",
                    "timeout_ms",
                    "debug", => sub{$opt_debug = 1;},
                    "error",
                    "rvm" => sub{$opt_rvm = 1;},
                    "vmm" => sub{$opt_vmm = 1},
                    "uvm" => sub{$opt_uvm = 1}
);
$nc_cmd .= " -sv";
$vcs_cmd .= " -sverilog -R +v2k +acc +vpi";
$unique_name = $opt_test."_".$opt_seed;
$testcase = "pattern/".$opt_test;
#2.2.fsdb
if($opt_fsdb == 1){
   if($opt_nc == 1){
      $nc_cmd .= " +ncaccess+rwc +loadpli1=debpli:novas_pli_boot";
      $ENV{LD_LIBRARY_PATH} = "/usr/cad/verdi-2012.10/share/PLI/IUS/LINUX/boot";
   }
   elsif($opt_vcs == 1){
   $vcs_cmd.=" +cli+3 -P /usr/cad/verdi-2012.10/share/PLI/VCS/LINUX/novas.tab /usr/cad/verdi-2012.10/share/PLI/VCS/LINUX/pli.a";
   }
}
#2.3.uvm
if($opt_uvm == 1){
   if($opt_vcs == 1){
      $vcs_cmd .= " +incdir+$ENV{UVM_HOME}/src $ENV{UVM_HOME}/src/uvm.sv $ENV{UVM_HOME}/src/dpi/uvm_dpi.cc -CFLAGS -DVCS";
   }
   elsif($opt_nc == 1){ #for now, ius9.20 not support uvm
      print "IUS9.20 not support uvm now\n";
   }
}
#2.4.rvm
if($opt_rvm == 1){
   if($opt_vcs == 1){
      $vera_cmd = "vera -cmp -max_error 5 -I./harness -I./env -I./pattern $testcase ./local_run/$unique_name.vro";
      $vcs_cmd .= " -vera -debug_all +vera_vros=./local_run/$unique_name.vro ./local_run/$unique_name.vshell";
   }
   elsif($opt_nc == 1){
      $vera_cmd = "vera -cmp -max_error 5 -I./harness -I./env -I./pattern $testcase ./local_run/$unique_name.vro";
      $nc_cmd .= " +loadpli1=/usr/cad/vera-2009.12/vera_vD-2009.12-17_linux/lib/libVERA.a +vera_load=./local_run/$unique_name.vro ./local_run/$unique_name.vshell";
   }
   $testcase = "";
}
#2.5.vmm
if($opt_vmm == 1){
   if($opt_vcs == 1){
      $vcs_cmd .= " +incdir+/usr/cad/vmm-1.2.2b/sv";
   }
   elsif($opt_nc == 1){
      print("IUS9.20 not support vmm now\n");
   }
}
#2.6.debug
if($opt_debug == 1 && $opt_vcs == 1){
   $vcs_cmd .= " -debug_all -gui";
}
#2.7.testbench file directory, need change
$common_cmd .= " +incdir+./APB_VIP +incdir+./UART_VIP +incdir+./env +incdir+./pattern +incdir+./harness";
############################################################
#               3.prepare filelist and fsdb
############################################################
$filelist = "./harness/flist.f";
############################################################
#               4.run simulation
############################################################
#4.1.run vera
if($opt_rvm == 1){
   $ww = $vera_cmd;
   print("$ww\n");
   system($ww);
   print("Compile vera code complete!\n");
}
#4.2.run nc
if($opt_nc == 1){
   $ww = "ncverilog -f $filelist $testcase $nc_cmd $common_cmd $tb_macro $dut_macro -l $unique_name.log";
   print("$ww\n");
   system($ww);
}
#4.3.run vcs
elsif($opt_vcs == 1){
   $ww = "vcs -f $filelist $testcase $vcs_cmd $common_cmd $tb_macro $dut_macro  -l $unique_name.log";
   print("$ww\n");
   system($ww);
}
else{
   print "Please select one simulator, vcs|ncv available now\n";
}
############################################################
#               5.clean up temp files
############################################################
#5.1.save fsdb file
if($opt_fsdb == 1){
   $ww = "mv sim_top.fsdb log/fsdb/";
   system($ww);
}
#5.2.clean up vera tmp file
if($opt_rvm == 1){
   $ww = "rm -f ./local_run/*";
   system($ww);
   print("Clean up vera temp files done\n");
}
#5.3.clean up nc tmp file
if($opt_nc == 1){
   $ww = "mv $unique_name.log log/rpt/";
   system($ww);
   $ww = "rm -rf INCA_libs *.log verdiLog";
   system($ww);
   print("Clean up nc temp files done\n");
}
#5.4.clean up vcs tmp file
if($opt_vcs == 1){
   $ww = "mv $unique_name.log log/rpt/";
   $ww = "rm -rf csrc simv *.daidir *.key novas* *.log verdiLog *.h *.vdb";
   system($ww);
   print("Clean up vcs temp files done\n");
}
############################################################
#                    subroutine
############################################################
sub print_help{
   printf("-----------------------------------------help for run_test--------------------------------------------------\n");
   printf("-nc: Use Ncverilog simulator\n");
   printf("-vcs: Use VCS simulator\n");
   printf("-fsdb: Dump fsdb\n");
   printf("-start_at: Set a start time point to dump fsdb\n");
   printf("-stop_at: Set a stop time point to dump fsdb");
   printf("-seed: Feed seed manaually\n");
   printf("-timeout_ms: Set a timeout value for simulation\n");
   printf("-debug: Set an argument for debugger, can be debug_pp|debug_all for vcs, and on_bp|on_error|on_start for vera\n");
   printf("-error: When simulation error occur, ignore them for <number> time\n");
   printf("-rvm: Use rvm methodology\n");
   printf("-vmm: Use vmm methodology\n");
   printf("-uvm: Use uvm methodology\n");
}

0 0
原创粉丝点击