1 |
2 |
ZTEX |
###############################################################################
|
2 |
|
|
## (c) Copyright 2009 Xilinx, Inc. All rights reserved.
|
3 |
|
|
##
|
4 |
|
|
## This file contains confidential and proprietary information
|
5 |
|
|
## of Xilinx, Inc. and is protected under U.S. and
|
6 |
|
|
## international copyright and other intellectual property
|
7 |
|
|
## laws.
|
8 |
|
|
##
|
9 |
|
|
## DISCLAIMER
|
10 |
|
|
## This disclaimer is not a license and does not grant any
|
11 |
|
|
## rights to the materials distributed herewith. Except as
|
12 |
|
|
## otherwise provided in a valid license issued to you by
|
13 |
|
|
## Xilinx, and to the maximum extent permitted by applicable
|
14 |
|
|
## law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
15 |
|
|
## WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
16 |
|
|
## AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
17 |
|
|
## BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
18 |
|
|
## INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
19 |
|
|
## (2) Xilinx shall not be liable (whether in contract or tort,
|
20 |
|
|
## including negligence, or under any other theory of
|
21 |
|
|
## liability) for any loss or damage of any kind or nature
|
22 |
|
|
## related to, arising under or in connection with these
|
23 |
|
|
## materials, including for any direct, or any indirect,
|
24 |
|
|
## special, incidental, or consequential loss or damage
|
25 |
|
|
## (including loss of data, profits, goodwill, or any type of
|
26 |
|
|
## loss or damage suffered as a result of any action brought
|
27 |
|
|
## by a third party) even if such damage or loss was
|
28 |
|
|
## reasonably foreseeable or Xilinx had been advised of the
|
29 |
|
|
## possibility of the same.
|
30 |
|
|
##
|
31 |
|
|
## CRITICAL APPLICATIONS
|
32 |
|
|
## Xilinx products are not designed or intended to be fail-
|
33 |
|
|
## safe, or for use in any application requiring fail-safe
|
34 |
|
|
## performance, such as life-support or safety devices or
|
35 |
|
|
## systems, Class III medical devices, nuclear facilities,
|
36 |
|
|
## applications related to the deployment of airbags, or any
|
37 |
|
|
## other applications that could lead to death, personal
|
38 |
|
|
## injury, or severe property or environmental damage
|
39 |
|
|
## (individually and collectively, "Critical
|
40 |
|
|
## Applications"). Customer assumes the sole risk and
|
41 |
|
|
## liability of any use of Xilinx products in Critical
|
42 |
|
|
## Applications, subject only to applicable laws and
|
43 |
|
|
## regulations governing limitations on product liability.
|
44 |
|
|
##
|
45 |
|
|
## THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
46 |
|
|
## PART OF THIS FILE AT ALL TIMES.
|
47 |
|
|
##
|
48 |
|
|
###############################################################################
|
49 |
|
|
## ____ ____
|
50 |
|
|
## / /\/ /
|
51 |
|
|
## /___/ \ / Vendor : Xilinx
|
52 |
|
|
## \ \ \/ Version : 3.92
|
53 |
|
|
## \ \ Application : MIG
|
54 |
|
|
## / / Filename : sim.do
|
55 |
|
|
## /___/ /\ Date Last Modified : $Date: 2011/06/02 07:17:00 $
|
56 |
|
|
## \ \ / \ Date Created : Mon Mar 2 2009
|
57 |
|
|
## \___\/\___\
|
58 |
|
|
##
|
59 |
|
|
## Device: Spartan-6
|
60 |
|
|
## Design Name : DDR/DDR2/DDR3/LPDDR
|
61 |
|
|
## Purpose:
|
62 |
|
|
## Sample sim .do file to compile and simulate memory interface
|
63 |
|
|
## design and run the simulation for specified period of time. Display the
|
64 |
|
|
## waveforms that are listed with "add wave" command.
|
65 |
|
|
## Assumptions:
|
66 |
|
|
## - Simulation takes place in \sim folder of MIG output directory
|
67 |
|
|
## Reference:
|
68 |
|
|
## Revision History:
|
69 |
|
|
###############################################################################
|
70 |
|
|
|
71 |
|
|
vlib work
|
72 |
|
|
|
73 |
|
|
#Map the required libraries here.#
|
74 |
|
|
#vmap unisims_ver
|
75 |
|
|
#vmap secureip
|
76 |
|
|
|
77 |
|
|
#Compile all rtl modules#
|
78 |
|
|
vlog ../../rtl/*.v
|
79 |
|
|
vlog ../../rtl/mcb_controller/*.v
|
80 |
|
|
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
#Compile all traffic_gen modules#
|
84 |
|
|
vlog ../../rtl/traffic_gen/*.v
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
#Compile files in sim folder (excluding model parameter file)#
|
89 |
|
|
#$XILINX variable must be set
|
90 |
|
|
vlog $env(XILINX)/verilog/src/glbl.v
|
91 |
|
|
vlog ../functional/*.v
|
92 |
|
|
|
93 |
|
|
#Pass the parameters for memory model parameter file#
|
94 |
|
|
vlog +incdir+. +define+x512Mb +define+FULL_MEM +define+sg5B +define+x16 ddr_model_c3.v
|
95 |
|
|
|
96 |
|
|
#Load the design. Use required libraries.#
|
97 |
|
|
vsim -t ps -novopt +notimingchecks -L unisims_ver -L secureip work.sim_tb_top glbl
|
98 |
|
|
|
99 |
|
|
onerror {resume}
|
100 |
|
|
|
101 |
|
|
#Log all the objects in design. These will appear in .wlf file#
|
102 |
|
|
log -r /*
|
103 |
|
|
|
104 |
|
|
#View sim_tb_top signals in waveform#
|
105 |
|
|
add wave sim:/sim_tb_top/*
|
106 |
|
|
|
107 |
|
|
#Change radix to Hexadecimal#
|
108 |
|
|
radix hex
|
109 |
|
|
#Supress Numeric Std package and Arith package warnings.#
|
110 |
|
|
#For VHDL designs we get some warnings due to unknown values on some signals at startup#
|
111 |
|
|
# ** Warning: NUMERIC_STD.TO_INTEGER: metavalue detected, returning 0#
|
112 |
|
|
#We may also get some Arithmetic packeage warnings because of unknown values on#
|
113 |
|
|
#some of the signals that are used in an Arithmetic operation.#
|
114 |
|
|
#In order to suppress these warnings, we use following two commands#
|
115 |
|
|
set NumericStdNoWarnings 1
|
116 |
|
|
set StdArithNoWarnings 1
|
117 |
|
|
|
118 |
|
|
#Choose simulation run time by inserting a breakpoint and then run for specified #
|
119 |
|
|
#period. Refer simulation_help file.#
|
120 |
|
|
when {/sim_tb_top/design_top/calib_done = 1} {
|
121 |
|
|
echo "Calibration Done"
|
122 |
|
|
if {[when -label a_100] == ""} {
|
123 |
|
|
when -label a_100 { $now = 50 us } {
|
124 |
|
|
nowhen a_100
|
125 |
|
|
report simulator control
|
126 |
|
|
report simulator state
|
127 |
|
|
if {[examine /sim_tb_top/design_top/error] == 0} {
|
128 |
|
|
echo "TEST PASSED"
|
129 |
|
|
stop
|
130 |
|
|
}
|
131 |
|
|
if {[examine /sim_tb_top/design_top/error] != 0} {
|
132 |
|
|
echo "TEST FAILED: DATA ERROR"
|
133 |
|
|
stop
|
134 |
|
|
}
|
135 |
|
|
}
|
136 |
|
|
}
|
137 |
|
|
}
|
138 |
|
|
|
139 |
|
|
#In case calibration fails to complete, choose the run time and then quit#
|
140 |
|
|
when {$now = @500 us and /sim_tb_top/design_top/calib_done != 1} {
|
141 |
|
|
echo "TEST FAILED: INITIALIZATION DID NOT COMPLETE"
|
142 |
|
|
stop
|
143 |
|
|
}
|
144 |
|
|
run -all
|
145 |
|
|
stop
|