[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 | |
---|
[34] | 51 | #add wave sim:/tb_top/W1_inst/dram_wb_inst/* |
---|
[22] | 52 | #exit |
---|
[34] | 53 | #pause |
---|
[13] | 54 | onerror {resume} |
---|
| 55 | #Log all the objects in design. These will appear in .wlf file# |
---|
| 56 | log -r /* |
---|
[34] | 57 | run -all |
---|
| 58 | exit |
---|
| 59 | |
---|
[13] | 60 | #View sim_tb_top signals in waveform# |
---|
[34] | 61 | #add wave sim:/tb_top/* |
---|
[13] | 62 | |
---|
| 63 | #Change radix to Hexadecimal# |
---|
| 64 | radix hex |
---|
| 65 | #Supress Numeric Std package and Arith package warnings.# |
---|
| 66 | #For VHDL designs we get some warnings due to unknown values on some signals at startup# |
---|
| 67 | # ** Warning: NUMERIC_STD.TO_INTEGER: metavalue detected, returning 0# |
---|
| 68 | #We may also get some Arithmetic packeage warnings because of unknown values on# |
---|
| 69 | #some of the signals that are used in an Arithmetic operation.# |
---|
| 70 | #In order to suppress these warnings, we use following two commands# |
---|
| 71 | set NumericStdNoWarnings 1 |
---|
| 72 | set StdArithNoWarnings 1 |
---|
| 73 | |
---|
| 74 | #Choose simulation run time by inserting a breakpoint and then run for specified # |
---|
| 75 | #period. For more details, refer to Simulation Guide section of MIG user guide (UG086).# |
---|
| 76 | when {/sim_tb_top/phy_init_done = 1} { |
---|
| 77 | if {[when -label a_100] == ""} { |
---|
| 78 | when -label a_100 { $now = 50 us } { |
---|
| 79 | nowhen a_100 |
---|
| 80 | report simulator control |
---|
| 81 | report simulator state |
---|
| 82 | if {[examine /sim_tb_top/error] == 0} { |
---|
| 83 | echo "TEST PASSED" |
---|
| 84 | stop |
---|
| 85 | } |
---|
| 86 | if {[examine /sim_tb_top/error] != 0} { |
---|
| 87 | echo "TEST FAILED: DATA ERROR" |
---|
| 88 | stop |
---|
| 89 | } |
---|
| 90 | } |
---|
| 91 | } |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | #In case calibration fails to complete, choose the run time and then stop# |
---|
| 95 | when {$now = @500 us and /sim_tb_top/phy_init_done != 1} { |
---|
| 96 | echo "TEST FAILED: CALIBRATION DID NOT COMPLETE" |
---|
| 97 | stop |
---|
| 98 | } |
---|
| 99 | |
---|
| 100 | echo "NOTE: Initial 200us power on period is skipped for simulation. |
---|
| 101 | Change SIM_ONLY parameter in sim_tb_top file to activate this." |
---|
| 102 | |
---|
| 103 | run -all |
---|
| 104 | stop |
---|
| 105 | |
---|