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