[14] | 1 | #start with: vsim -c -do simula.do |
---|
[13] | 2 | |
---|
[26] | 3 | set DEFINE +define+DEBUG+FPGA_SYN |
---|
[27] | 4 | #+FPGA_SYN_NO_SPU |
---|
[26] | 5 | #+FPGA_NEW_IRF |
---|
| 6 | set INCLUDEDIR +incdir+../T1-common/include/ |
---|
[13] | 7 | vlib work |
---|
| 8 | |
---|
| 9 | #Map the required libraries here.# |
---|
| 10 | |
---|
| 11 | #Compile all modules# |
---|
| 12 | |
---|
[26] | 13 | vlog $DEFINE $INCLUDEDIR ../T1-common/common/*.v |
---|
| 14 | vlog $DEFINE $INCLUDEDIR ../Top/*.v |
---|
| 15 | vlog $DEFINE +incdir+../OC-UART $INCLUDEDIR ../OC-UART/*.v |
---|
| 16 | vlog $DEFINE $INCLUDEDIR ../NOR-flash/*.v |
---|
| 17 | vlog $DEFINE $INCLUDEDIR ../os2wb/*.v |
---|
| 18 | vlog $DEFINE $INCLUDEDIR ../T1-common/m1/*.V |
---|
| 19 | vlog $DEFINE $INCLUDEDIR ../T1-common/srams/*.v |
---|
| 20 | vlog $DEFINE $INCLUDEDIR ../T1-common/u1/*.V |
---|
| 21 | vlog $DEFINE $INCLUDEDIR/ ../T1-FPU/*.v |
---|
| 22 | vlog $DEFINE $INCLUDEDIR +incdir+../WB ../WB/*.v |
---|
| 23 | vlog $DEFINE $INCLUDEDIR ../WB2ALTDDR3/*.v |
---|
| 24 | vlog $DEFINE $INCLUDEDIR ../Xilinx/*.v |
---|
| 25 | vlog $DEFINE $INCLUDEDIR ../T1-CPU/exu/*.v |
---|
| 26 | vlog $DEFINE $INCLUDEDIR ../T1-CPU/ffu/*.v |
---|
| 27 | vlog $DEFINE $INCLUDEDIR ../T1-CPU/ifu/*.v |
---|
| 28 | vlog $DEFINE $INCLUDEDIR ../T1-CPU/lsu/*.v |
---|
| 29 | vlog $DEFINE $INCLUDEDIR ../T1-CPU/mul/*.v |
---|
| 30 | vlog $DEFINE $INCLUDEDIR ../T1-CPU/rtl/*.v |
---|
| 31 | vlog $DEFINE $INCLUDEDIR ../T1-CPU/spu/*.v |
---|
| 32 | vlog $DEFINE $INCLUDEDIR ../T1-CPU/tlu/*.v |
---|
[13] | 33 | |
---|
| 34 | #Compile files in sim folder (excluding model parameter file)# |
---|
| 35 | #$XILINX variable must be set |
---|
| 36 | vlog $env(XILINX)/../../verilog/src/glbl.v |
---|
| 37 | #vlog $XILINX/../../verilog/src/glbl.v |
---|
[17] | 38 | vlog +define+DEBUG ../sim/*.v |
---|
[13] | 39 | |
---|
| 40 | #Pass the parameters for memory model parameter file# |
---|
| 41 | vlog +incdir+. +define+x512Mb +define+sg37E +define+x16 ddr2_model.v |
---|
| 42 | |
---|
| 43 | #Load the design. Use required libraries.# |
---|
| 44 | |
---|
[17] | 45 | |
---|
| 46 | vsim -t ps -novopt +notimingchecks -L unisims_ver -L XilinxCoreLib work.tb_top glbl |
---|
| 47 | |
---|
| 48 | #vsim -c -t ps -novopt +notimingchecks -L unisims_ver -L XilinxCoreLib work.tb_top glbl |
---|
[13] | 49 | #vsim -c -t ps -novopt +notimingchecks work.tb_top glbl |
---|
| 50 | |
---|
[22] | 51 | add wave sim:/tb_top/W1_inst/dram_wb_inst/* |
---|
| 52 | #exit |
---|
[13] | 53 | pause |
---|
| 54 | onerror {resume} |
---|
| 55 | #Log all the objects in design. These will appear in .wlf file# |
---|
| 56 | log -r /* |
---|
| 57 | #View sim_tb_top signals in waveform# |
---|
| 58 | add wave sim:/tb_top/* |
---|
| 59 | |
---|
| 60 | #Change radix to Hexadecimal# |
---|
| 61 | radix hex |
---|
| 62 | #Supress Numeric Std package and Arith package warnings.# |
---|
| 63 | #For VHDL designs we get some warnings due to unknown values on some signals at startup# |
---|
| 64 | # ** Warning: NUMERIC_STD.TO_INTEGER: metavalue detected, returning 0# |
---|
| 65 | #We may also get some Arithmetic packeage warnings because of unknown values on# |
---|
| 66 | #some of the signals that are used in an Arithmetic operation.# |
---|
| 67 | #In order to suppress these warnings, we use following two commands# |
---|
| 68 | set NumericStdNoWarnings 1 |
---|
| 69 | set StdArithNoWarnings 1 |
---|
| 70 | |
---|
| 71 | #Choose simulation run time by inserting a breakpoint and then run for specified # |
---|
| 72 | #period. For more details, refer to Simulation Guide section of MIG user guide (UG086).# |
---|
| 73 | when {/sim_tb_top/phy_init_done = 1} { |
---|
| 74 | if {[when -label a_100] == ""} { |
---|
| 75 | when -label a_100 { $now = 50 us } { |
---|
| 76 | nowhen a_100 |
---|
| 77 | report simulator control |
---|
| 78 | report simulator state |
---|
| 79 | if {[examine /sim_tb_top/error] == 0} { |
---|
| 80 | echo "TEST PASSED" |
---|
| 81 | stop |
---|
| 82 | } |
---|
| 83 | if {[examine /sim_tb_top/error] != 0} { |
---|
| 84 | echo "TEST FAILED: DATA ERROR" |
---|
| 85 | stop |
---|
| 86 | } |
---|
| 87 | } |
---|
| 88 | } |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | #In case calibration fails to complete, choose the run time and then stop# |
---|
| 92 | when {$now = @500 us and /sim_tb_top/phy_init_done != 1} { |
---|
| 93 | echo "TEST FAILED: CALIBRATION DID NOT COMPLETE" |
---|
| 94 | stop |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | echo "NOTE: Initial 200us power on period is skipped for simulation. |
---|
| 98 | Change SIM_ONLY parameter in sim_tb_top file to activate this." |
---|
| 99 | |
---|
| 100 | run -all |
---|
| 101 | stop |
---|
| 102 | |
---|