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