1 |
9 |
eejlny |
--------------------------------------------------------------------------------
|
2 |
|
|
--
|
3 |
|
|
-- FIFO Generator Core Demo Testbench
|
4 |
|
|
--
|
5 |
|
|
--------------------------------------------------------------------------------
|
6 |
|
|
--
|
7 |
|
|
-- (c) Copyright 2009 - 2010 Xilinx, Inc. All rights reserved.
|
8 |
|
|
--
|
9 |
|
|
-- This file contains confidential and proprietary information
|
10 |
|
|
-- of Xilinx, Inc. and is protected under U.S. and
|
11 |
|
|
-- international copyright and other intellectual property
|
12 |
|
|
-- laws.
|
13 |
|
|
--
|
14 |
|
|
-- DISCLAIMER
|
15 |
|
|
-- This disclaimer is not a license and does not grant any
|
16 |
|
|
-- rights to the materials distributed herewith. Except as
|
17 |
|
|
-- otherwise provided in a valid license issued to you by
|
18 |
|
|
-- Xilinx, and to the maximum extent permitted by applicable
|
19 |
|
|
-- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
20 |
|
|
-- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
21 |
|
|
-- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
22 |
|
|
-- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
23 |
|
|
-- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
24 |
|
|
-- (2) Xilinx shall not be liable (whether in contract or tort,
|
25 |
|
|
-- including negligence, or under any other theory of
|
26 |
|
|
-- liability) for any loss or damage of any kind or nature
|
27 |
|
|
-- related to, arising under or in connection with these
|
28 |
|
|
-- materials, including for any direct, or any indirect,
|
29 |
|
|
-- special, incidental, or consequential loss or damage
|
30 |
|
|
-- (including loss of data, profits, goodwill, or any type of
|
31 |
|
|
-- loss or damage suffered as a result of any action brought
|
32 |
|
|
-- by a third party) even if such damage or loss was
|
33 |
|
|
-- reasonably foreseeable or Xilinx had been advised of the
|
34 |
|
|
-- possibility of the same.
|
35 |
|
|
--
|
36 |
|
|
-- CRITICAL APPLICATIONS
|
37 |
|
|
-- Xilinx products are not designed or intended to be fail-
|
38 |
|
|
-- safe, or for use in any application requiring fail-safe
|
39 |
|
|
-- performance, such as life-support or safety devices or
|
40 |
|
|
-- systems, Class III medical devices, nuclear facilities,
|
41 |
|
|
-- applications related to the deployment of airbags, or any
|
42 |
|
|
-- other applications that could lead to death, personal
|
43 |
|
|
-- injury, or severe property or environmental damage
|
44 |
|
|
-- (individually and collectively, "Critical
|
45 |
|
|
-- Applications"). Customer assumes the sole risk and
|
46 |
|
|
-- liability of any use of Xilinx products in Critical
|
47 |
|
|
-- Applications, subject only to applicable laws and
|
48 |
|
|
-- regulations governing limitations on product liability.
|
49 |
|
|
--
|
50 |
|
|
-- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
51 |
|
|
-- PART OF THIS FILE AT ALL TIMES.
|
52 |
|
|
--------------------------------------------------------------------------------
|
53 |
|
|
--
|
54 |
|
|
-- Filename: fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3_synth.vhd
|
55 |
|
|
--
|
56 |
|
|
-- Description:
|
57 |
|
|
-- This is the demo testbench for fifo_generator core.
|
58 |
|
|
--
|
59 |
|
|
--------------------------------------------------------------------------------
|
60 |
|
|
-- Library Declarations
|
61 |
|
|
--------------------------------------------------------------------------------
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
LIBRARY ieee;
|
65 |
|
|
USE ieee.STD_LOGIC_1164.ALL;
|
66 |
|
|
USE ieee.STD_LOGIC_unsigned.ALL;
|
67 |
|
|
USE IEEE.STD_LOGIC_arith.ALL;
|
68 |
|
|
USE ieee.numeric_std.ALL;
|
69 |
|
|
USE ieee.STD_LOGIC_misc.ALL;
|
70 |
|
|
|
71 |
|
|
LIBRARY std;
|
72 |
|
|
USE std.textio.ALL;
|
73 |
|
|
|
74 |
|
|
LIBRARY work;
|
75 |
|
|
USE work.fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3_pkg.ALL;
|
76 |
|
|
|
77 |
|
|
--------------------------------------------------------------------------------
|
78 |
|
|
-- Entity Declaration
|
79 |
|
|
--------------------------------------------------------------------------------
|
80 |
|
|
ENTITY fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3_synth IS
|
81 |
|
|
GENERIC(
|
82 |
|
|
FREEZEON_ERROR : INTEGER := 0;
|
83 |
|
|
TB_STOP_CNT : INTEGER := 0;
|
84 |
|
|
TB_SEED : INTEGER := 1
|
85 |
|
|
);
|
86 |
|
|
PORT(
|
87 |
|
|
WR_CLK : IN STD_LOGIC;
|
88 |
|
|
RD_CLK : IN STD_LOGIC;
|
89 |
|
|
RESET : IN STD_LOGIC;
|
90 |
|
|
SIM_DONE : OUT STD_LOGIC;
|
91 |
|
|
STATUS : OUT STD_LOGIC_VECTOR(7 DOWNTO 0)
|
92 |
|
|
);
|
93 |
|
|
END ENTITY;
|
94 |
|
|
|
95 |
|
|
ARCHITECTURE simulation_arch OF fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3_synth IS
|
96 |
|
|
|
97 |
|
|
-- FIFO interface signal declarations
|
98 |
|
|
SIGNAL wr_clk_i : STD_LOGIC;
|
99 |
|
|
SIGNAL rd_clk_i : STD_LOGIC;
|
100 |
|
|
SIGNAL wr_data_count : STD_LOGIC_VECTOR(8-1 DOWNTO 0);
|
101 |
|
|
SIGNAL rd_data_count : STD_LOGIC_VECTOR(8-1 DOWNTO 0);
|
102 |
|
|
SIGNAL rst : STD_LOGIC;
|
103 |
|
|
SIGNAL prog_full : STD_LOGIC;
|
104 |
|
|
SIGNAL overflow : STD_LOGIC;
|
105 |
|
|
SIGNAL underflow : STD_LOGIC;
|
106 |
|
|
SIGNAL wr_en : STD_LOGIC;
|
107 |
|
|
SIGNAL rd_en : STD_LOGIC;
|
108 |
|
|
SIGNAL din : STD_LOGIC_VECTOR(8-1 DOWNTO 0);
|
109 |
|
|
SIGNAL dout : STD_LOGIC_VECTOR(64-1 DOWNTO 0);
|
110 |
|
|
SIGNAL full : STD_LOGIC;
|
111 |
|
|
SIGNAL empty : STD_LOGIC;
|
112 |
|
|
-- TB Signals
|
113 |
|
|
SIGNAL wr_data : STD_LOGIC_VECTOR(8-1 DOWNTO 0);
|
114 |
|
|
SIGNAL dout_i : STD_LOGIC_VECTOR(64-1 DOWNTO 0);
|
115 |
|
|
SIGNAL wr_en_i : STD_LOGIC := '0';
|
116 |
|
|
SIGNAL rd_en_i : STD_LOGIC := '0';
|
117 |
|
|
SIGNAL full_i : STD_LOGIC := '0';
|
118 |
|
|
SIGNAL empty_i : STD_LOGIC := '0';
|
119 |
|
|
SIGNAL almost_full_i : STD_LOGIC := '0';
|
120 |
|
|
SIGNAL almost_empty_i : STD_LOGIC := '0';
|
121 |
|
|
SIGNAL prc_we_i : STD_LOGIC := '0';
|
122 |
|
|
SIGNAL prc_re_i : STD_LOGIC := '0';
|
123 |
|
|
SIGNAL dout_chk_i : STD_LOGIC := '0';
|
124 |
|
|
SIGNAL rst_int_rd : STD_LOGIC := '0';
|
125 |
|
|
SIGNAL rst_int_wr : STD_LOGIC := '0';
|
126 |
|
|
SIGNAL rst_s_wr1 : STD_LOGIC := '0';
|
127 |
|
|
SIGNAL rst_s_wr2 : STD_LOGIC := '0';
|
128 |
|
|
SIGNAL rst_gen_rd : STD_LOGIC_VECTOR(7 DOWNTO 0) := (OTHERS => '0');
|
129 |
|
|
SIGNAL rst_s_wr3 : STD_LOGIC := '0';
|
130 |
|
|
SIGNAL rst_s_rd : STD_LOGIC := '0';
|
131 |
|
|
SIGNAL reset_en : STD_LOGIC := '0';
|
132 |
|
|
SIGNAL rst_async_wr1 : STD_LOGIC := '0';
|
133 |
|
|
SIGNAL rst_async_wr2 : STD_LOGIC := '0';
|
134 |
|
|
SIGNAL rst_async_wr3 : STD_LOGIC := '0';
|
135 |
|
|
SIGNAL rst_async_rd1 : STD_LOGIC := '0';
|
136 |
|
|
SIGNAL rst_async_rd2 : STD_LOGIC := '0';
|
137 |
|
|
SIGNAL rst_async_rd3 : STD_LOGIC := '0';
|
138 |
|
|
|
139 |
|
|
|
140 |
|
|
BEGIN
|
141 |
|
|
|
142 |
|
|
---- Reset generation logic -----
|
143 |
|
|
rst_int_wr <= rst_async_wr3 OR rst_s_wr3;
|
144 |
|
|
rst_int_rd <= rst_async_rd3 OR rst_s_rd;
|
145 |
|
|
|
146 |
|
|
--Testbench reset synchronization
|
147 |
|
|
PROCESS(rd_clk_i,RESET)
|
148 |
|
|
BEGIN
|
149 |
|
|
IF(RESET = '1') THEN
|
150 |
|
|
rst_async_rd1 <= '1';
|
151 |
|
|
rst_async_rd2 <= '1';
|
152 |
|
|
rst_async_rd3 <= '1';
|
153 |
|
|
ELSIF(rd_clk_i'event AND rd_clk_i='1') THEN
|
154 |
|
|
rst_async_rd1 <= RESET;
|
155 |
|
|
rst_async_rd2 <= rst_async_rd1;
|
156 |
|
|
rst_async_rd3 <= rst_async_rd2;
|
157 |
|
|
END IF;
|
158 |
|
|
END PROCESS;
|
159 |
|
|
|
160 |
|
|
PROCESS(wr_clk_i,RESET)
|
161 |
|
|
BEGIN
|
162 |
|
|
IF(RESET = '1') THEN
|
163 |
|
|
rst_async_wr1 <= '1';
|
164 |
|
|
rst_async_wr2 <= '1';
|
165 |
|
|
rst_async_wr3 <= '1';
|
166 |
|
|
ELSIF(wr_clk_i'event AND wr_clk_i='1') THEN
|
167 |
|
|
rst_async_wr1 <= RESET;
|
168 |
|
|
rst_async_wr2 <= rst_async_wr1;
|
169 |
|
|
rst_async_wr3 <= rst_async_wr2;
|
170 |
|
|
END IF;
|
171 |
|
|
END PROCESS;
|
172 |
|
|
|
173 |
|
|
--Soft reset for core and testbench
|
174 |
|
|
PROCESS(rd_clk_i)
|
175 |
|
|
BEGIN
|
176 |
|
|
IF(rd_clk_i'event AND rd_clk_i='1') THEN
|
177 |
|
|
rst_gen_rd <= rst_gen_rd + "1";
|
178 |
|
|
IF(reset_en = '1' AND AND_REDUCE(rst_gen_rd) = '1') THEN
|
179 |
|
|
rst_s_rd <= '1';
|
180 |
|
|
assert false
|
181 |
|
|
report "Reset applied..Memory Collision checks are not valid"
|
182 |
|
|
severity note;
|
183 |
|
|
ELSE
|
184 |
|
|
IF(AND_REDUCE(rst_gen_rd) = '1' AND rst_s_rd = '1') THEN
|
185 |
|
|
rst_s_rd <= '0';
|
186 |
|
|
END IF;
|
187 |
|
|
END IF;
|
188 |
|
|
END IF;
|
189 |
|
|
END PROCESS;
|
190 |
|
|
|
191 |
|
|
PROCESS(wr_clk_i)
|
192 |
|
|
BEGIN
|
193 |
|
|
IF(wr_clk_i'event AND wr_clk_i='1') THEN
|
194 |
|
|
rst_s_wr1 <= rst_s_rd;
|
195 |
|
|
rst_s_wr2 <= rst_s_wr1;
|
196 |
|
|
rst_s_wr3 <= rst_s_wr2;
|
197 |
|
|
IF(rst_s_wr3 = '1' AND rst_s_wr2 = '0') THEN
|
198 |
|
|
assert false
|
199 |
|
|
report "Reset removed..Memory Collision checks are valid"
|
200 |
|
|
severity note;
|
201 |
|
|
END IF;
|
202 |
|
|
END IF;
|
203 |
|
|
END PROCESS;
|
204 |
|
|
------------------
|
205 |
|
|
|
206 |
|
|
---- Clock buffers for testbench ----
|
207 |
|
|
wr_clk_i <= WR_CLK;
|
208 |
|
|
rd_clk_i <= RD_CLK;
|
209 |
|
|
------------------
|
210 |
|
|
|
211 |
|
|
rst <= RESET OR rst_s_rd AFTER 12 ns;
|
212 |
|
|
din <= wr_data;
|
213 |
|
|
dout_i <= dout;
|
214 |
|
|
wr_en <= wr_en_i;
|
215 |
|
|
rd_en <= rd_en_i;
|
216 |
|
|
full_i <= full;
|
217 |
|
|
empty_i <= empty;
|
218 |
|
|
|
219 |
|
|
fg_dg_nv: fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3_dgen
|
220 |
|
|
GENERIC MAP (
|
221 |
|
|
C_DIN_WIDTH => 8,
|
222 |
|
|
C_DOUT_WIDTH => 64,
|
223 |
|
|
TB_SEED => TB_SEED,
|
224 |
|
|
C_CH_TYPE => 0
|
225 |
|
|
)
|
226 |
|
|
PORT MAP ( -- Write Port
|
227 |
|
|
RESET => rst_int_wr,
|
228 |
|
|
WR_CLK => wr_clk_i,
|
229 |
|
|
PRC_WR_EN => prc_we_i,
|
230 |
|
|
FULL => full_i,
|
231 |
|
|
WR_EN => wr_en_i,
|
232 |
|
|
WR_DATA => wr_data
|
233 |
|
|
);
|
234 |
|
|
|
235 |
|
|
fg_dv_nv: fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3_dverif
|
236 |
|
|
GENERIC MAP (
|
237 |
|
|
C_DOUT_WIDTH => 64,
|
238 |
|
|
C_DIN_WIDTH => 8,
|
239 |
|
|
C_USE_EMBEDDED_REG => 1,
|
240 |
|
|
TB_SEED => TB_SEED,
|
241 |
|
|
C_CH_TYPE => 0
|
242 |
|
|
)
|
243 |
|
|
PORT MAP(
|
244 |
|
|
RESET => rst_int_rd,
|
245 |
|
|
RD_CLK => rd_clk_i,
|
246 |
|
|
PRC_RD_EN => prc_re_i,
|
247 |
|
|
RD_EN => rd_en_i,
|
248 |
|
|
EMPTY => empty_i,
|
249 |
|
|
DATA_OUT => dout_i,
|
250 |
|
|
DOUT_CHK => dout_chk_i
|
251 |
|
|
);
|
252 |
|
|
|
253 |
|
|
fg_pc_nv: fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3_pctrl
|
254 |
|
|
GENERIC MAP (
|
255 |
|
|
AXI_CHANNEL => "Native",
|
256 |
|
|
C_APPLICATION_TYPE => 0,
|
257 |
|
|
C_DOUT_WIDTH => 64,
|
258 |
|
|
C_DIN_WIDTH => 8,
|
259 |
|
|
C_WR_PNTR_WIDTH => 11,
|
260 |
|
|
C_RD_PNTR_WIDTH => 8,
|
261 |
|
|
C_CH_TYPE => 0,
|
262 |
|
|
FREEZEON_ERROR => FREEZEON_ERROR,
|
263 |
|
|
TB_SEED => TB_SEED,
|
264 |
|
|
TB_STOP_CNT => TB_STOP_CNT
|
265 |
|
|
)
|
266 |
|
|
PORT MAP(
|
267 |
|
|
RESET_WR => rst_int_wr,
|
268 |
|
|
RESET_RD => rst_int_rd,
|
269 |
|
|
RESET_EN => reset_en,
|
270 |
|
|
WR_CLK => wr_clk_i,
|
271 |
|
|
RD_CLK => rd_clk_i,
|
272 |
|
|
PRC_WR_EN => prc_we_i,
|
273 |
|
|
PRC_RD_EN => prc_re_i,
|
274 |
|
|
FULL => full_i,
|
275 |
|
|
ALMOST_FULL => almost_full_i,
|
276 |
|
|
ALMOST_EMPTY => almost_empty_i,
|
277 |
|
|
DOUT_CHK => dout_chk_i,
|
278 |
|
|
EMPTY => empty_i,
|
279 |
|
|
DATA_IN => wr_data,
|
280 |
|
|
DATA_OUT => dout,
|
281 |
|
|
SIM_DONE => SIM_DONE,
|
282 |
|
|
STATUS => STATUS
|
283 |
|
|
);
|
284 |
|
|
|
285 |
|
|
|
286 |
|
|
|
287 |
|
|
|
288 |
|
|
|
289 |
|
|
fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3_inst : fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3_exdes
|
290 |
|
|
PORT MAP (
|
291 |
|
|
WR_CLK => wr_clk_i,
|
292 |
|
|
RD_CLK => rd_clk_i,
|
293 |
|
|
WR_DATA_COUNT => wr_data_count,
|
294 |
|
|
RD_DATA_COUNT => rd_data_count,
|
295 |
|
|
RST => rst,
|
296 |
|
|
PROG_FULL => prog_full,
|
297 |
|
|
OVERFLOW => overflow,
|
298 |
|
|
UNDERFLOW => underflow,
|
299 |
|
|
WR_EN => wr_en,
|
300 |
|
|
RD_EN => rd_en,
|
301 |
|
|
DIN => din,
|
302 |
|
|
DOUT => dout,
|
303 |
|
|
FULL => full,
|
304 |
|
|
EMPTY => empty);
|
305 |
|
|
|
306 |
|
|
END ARCHITECTURE;
|