| 1 | ############################################################################### |
|---|
| 2 | ## DISCLAIMER OF LIABILITY |
|---|
| 3 | ## |
|---|
| 4 | ## This file contains proprietary and confidential information of |
|---|
| 5 | ## Xilinx, Inc. ("Xilinx"), that is distributed under a license |
|---|
| 6 | ## from Xilinx, and may be used, copied and/or disclosed only |
|---|
| 7 | ## pursuant to the terms of a valid license agreement with Xilinx. |
|---|
| 8 | ## |
|---|
| 9 | ## XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION |
|---|
| 10 | ## ("MATERIALS") "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER |
|---|
| 11 | ## EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING WITHOUT |
|---|
| 12 | ## LIMITATION, ANY WARRANTY WITH RESPECT TO NONINFRINGEMENT, |
|---|
| 13 | ## MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE. Xilinx |
|---|
| 14 | ## does not warrant that functions included in the Materials will |
|---|
| 15 | ## meet the requirements of Licensee, or that the operation of the |
|---|
| 16 | ## Materials will be uninterrupted or error-free, or that defects |
|---|
| 17 | ## in the Materials will be corrected. Furthermore, Xilinx does |
|---|
| 18 | ## not warrant or make any representations regarding use, or the |
|---|
| 19 | ## results of the use, of the Materials in terms of correctness, |
|---|
| 20 | ## accuracy, reliability or otherwise. |
|---|
| 21 | ## |
|---|
| 22 | ## Xilinx products are not designed or intended to be fail-safe, |
|---|
| 23 | ## or for use in any application requiring fail-safe performance, |
|---|
| 24 | ## such as life-support or safety devices or systems, Class III |
|---|
| 25 | ## medical devices, nuclear facilities, applications related to |
|---|
| 26 | ## the deployment of airbags, or any other applications that could |
|---|
| 27 | ## lead to death, personal injury or severe property or |
|---|
| 28 | ## environmental damage (individually and collectively, "critical |
|---|
| 29 | ## applications"). Customer assumes the sole risk and liability |
|---|
| 30 | ## of any use of Xilinx products in critical applications, |
|---|
| 31 | ## subject only to applicable laws and regulations governing |
|---|
| 32 | ## limitations on product liability. |
|---|
| 33 | ## |
|---|
| 34 | ## Copyright 2007, 2008 Xilinx, Inc. |
|---|
| 35 | ## All rights reserved. |
|---|
| 36 | ## |
|---|
| 37 | ## This disclaimer and copyright notice must be retained as part |
|---|
| 38 | ## of this file at all times. |
|---|
| 39 | ############################################################################### |
|---|
| 40 | ## ____ ____ |
|---|
| 41 | ## / /\/ / |
|---|
| 42 | ## /___/ \ / Vendor : Xilinx |
|---|
| 43 | ## \ \ \/ Version : 3.6 |
|---|
| 44 | ## \ \ Application : MIG |
|---|
| 45 | ## / / Filename : sim.do |
|---|
| 46 | ## /___/ /\ Date Last Modified : $Date: 2010/06/29 12:03:41 $ |
|---|
| 47 | ## \ \ / \ Date Created : Mon May 14 2007 |
|---|
| 48 | ## \___\/\___\ |
|---|
| 49 | ## |
|---|
| 50 | ##Device: Virtex-5 |
|---|
| 51 | ##Purpose: |
|---|
| 52 | ## Sample sim .do file to compile and simulate memory interface |
|---|
| 53 | ## design and run the simulation for specified period of time. Display the |
|---|
| 54 | ## waveforms that are listed with "add wave" command. |
|---|
| 55 | ## Assumptions: |
|---|
| 56 | ## - Simulation takes place in \sim folder of MIG output directory |
|---|
| 57 | ##Reference: |
|---|
| 58 | ##Revision History: |
|---|
| 59 | ############################################################################### |
|---|
| 60 | vlib work |
|---|
| 61 | |
|---|
| 62 | #Map the required libraries here.# |
|---|
| 63 | |
|---|
| 64 | #Compile all modules# |
|---|
| 65 | vlog ../rtl/ddr2_chipscope* |
|---|
| 66 | vlog ../rtl/* |
|---|
| 67 | #Compile files in sim folder (excluding model parameter file)# |
|---|
| 68 | #$XILINX variable must be set |
|---|
| 69 | vlog $env(XILINX)/verilog/src/glbl.v |
|---|
| 70 | vlog ../sim/*.v |
|---|
| 71 | |
|---|
| 72 | #Pass the parameters for memory model parameter file# |
|---|
| 73 | vlog +incdir+. +define+x512Mb +define+sg37E +define+x16 ddr2_model.v |
|---|
| 74 | |
|---|
| 75 | #Load the design. Use required libraries.# |
|---|
| 76 | vsim -t ps -novopt +notimingchecks -L unisims_ver work.sim_tb_top glbl |
|---|
| 77 | |
|---|
| 78 | onerror {resume} |
|---|
| 79 | #Log all the objects in design. These will appear in .wlf file# |
|---|
| 80 | log -r /* |
|---|
| 81 | #View sim_tb_top signals in waveform# |
|---|
| 82 | add wave sim:/sim_tb_top/* |
|---|
| 83 | |
|---|
| 84 | #Change radix to Hexadecimal# |
|---|
| 85 | radix hex |
|---|
| 86 | #Supress Numeric Std package and Arith package warnings.# |
|---|
| 87 | #For VHDL designs we get some warnings due to unknown values on some signals at startup# |
|---|
| 88 | # ** Warning: NUMERIC_STD.TO_INTEGER: metavalue detected, returning 0# |
|---|
| 89 | #We may also get some Arithmetic packeage warnings because of unknown values on# |
|---|
| 90 | #some of the signals that are used in an Arithmetic operation.# |
|---|
| 91 | #In order to suppress these warnings, we use following two commands# |
|---|
| 92 | set NumericStdNoWarnings 1 |
|---|
| 93 | set StdArithNoWarnings 1 |
|---|
| 94 | |
|---|
| 95 | #Choose simulation run time by inserting a breakpoint and then run for specified # |
|---|
| 96 | #period. For more details, refer to Simulation Guide section of MIG user guide (UG086).# |
|---|
| 97 | when {/sim_tb_top/phy_init_done = 1} { |
|---|
| 98 | if {[when -label a_100] == ""} { |
|---|
| 99 | when -label a_100 { $now = 50 us } { |
|---|
| 100 | nowhen a_100 |
|---|
| 101 | report simulator control |
|---|
| 102 | report simulator state |
|---|
| 103 | if {[examine /sim_tb_top/error] == 0} { |
|---|
| 104 | echo "TEST PASSED" |
|---|
| 105 | stop |
|---|
| 106 | } |
|---|
| 107 | if {[examine /sim_tb_top/error] != 0} { |
|---|
| 108 | echo "TEST FAILED: DATA ERROR" |
|---|
| 109 | stop |
|---|
| 110 | } |
|---|
| 111 | } |
|---|
| 112 | } |
|---|
| 113 | } |
|---|
| 114 | |
|---|
| 115 | #In case calibration fails to complete, choose the run time and then stop# |
|---|
| 116 | when {$now = @500 us and /sim_tb_top/phy_init_done != 1} { |
|---|
| 117 | echo "TEST FAILED: CALIBRATION DID NOT COMPLETE" |
|---|
| 118 | stop |
|---|
| 119 | } |
|---|
| 120 | |
|---|
| 121 | echo "NOTE: Initial 200us power on period is skipped for simulation. |
|---|
| 122 | Change SIM_ONLY parameter in sim_tb_top file to activate this." |
|---|
| 123 | |
|---|
| 124 | run -all |
|---|
| 125 | stop |
|---|