1 |
145 |
lanttu |
-------------------------------------------------------------------------------
|
2 |
|
|
-- Title : Synthesizable Testbench for 16-bit sdram <-> 32-bit hibi wra
|
3 |
|
|
-- Project :
|
4 |
|
|
-------------------------------------------------------------------------------
|
5 |
|
|
-- File : tb_wra_16sdram_32hibi.vhd
|
6 |
|
|
-- Author : <alhonena@AHVEN>
|
7 |
|
|
-- Company :
|
8 |
|
|
-- Created : 2012-01-26
|
9 |
|
|
-- Last update: 2012-01-26
|
10 |
|
|
-- Platform :
|
11 |
|
|
-- Standard : VHDL'87
|
12 |
|
|
-------------------------------------------------------------------------------
|
13 |
|
|
-- Description: Doesn't use hibi or sdram2hibi, just tests the 16-bit<->32-bit
|
14 |
|
|
-- adapter wrapper using the bare 16-bit sdram controller and simple 32-bit
|
15 |
|
|
-- test case generated here.
|
16 |
|
|
--
|
17 |
|
|
-- Currently uses DE2 board. If you find a reliably working simulation model
|
18 |
|
|
-- for the DE2 sdram, feel free to use it instead... I play it safe and use
|
19 |
|
|
-- the real chip & SignalTap.
|
20 |
|
|
--
|
21 |
|
|
-- Copied the good&old DE2 sdram controller tester - changed it to use 32-bit
|
22 |
|
|
-- data and added the adapter wrapper.
|
23 |
|
|
-------------------------------------------------------------------------------
|
24 |
|
|
-- Copyright (c) 2012 TUT
|
25 |
|
|
-------------------------------------------------------------------------------
|
26 |
|
|
-- Revisions :
|
27 |
|
|
-- Date Version Author Description
|
28 |
|
|
-- 2012-01-26 1.0 alhonena Created
|
29 |
|
|
-------------------------------------------------------------------------------
|
30 |
|
|
|
31 |
|
|
-------------------------------------------------------------------------------
|
32 |
|
|
-- Title : SDRAM TEST.
|
33 |
|
|
-- Project :
|
34 |
|
|
-------------------------------------------------------------------------------
|
35 |
|
|
-- File : sdram_test.vhd
|
36 |
|
|
-- Author : <alhonena@BUMMALO>
|
37 |
|
|
-- Company :
|
38 |
|
|
-- Platform :
|
39 |
|
|
-------------------------------------------------------------------------------
|
40 |
|
|
-- Description: Quick test for SDRAM controller; writes 4 words to SDRAM, reads
|
41 |
|
|
-- them back and verifies the contents. The 3rd word is configured by external
|
42 |
|
|
-- switches so you can verify that the verification works :-).
|
43 |
|
|
--
|
44 |
|
|
-- Just for an experiment, I implemented the FSM as an integer counter.
|
45 |
|
|
-- It looks much nicer in SignalTap I primarily used to verify the operation.
|
46 |
|
|
-- LEDR shows the progress, LEDG shows error status.
|
47 |
|
|
-- LEDG(0) -> data came too early from the ctrl.
|
48 |
|
|
-- LEDG(1...4) -> data mismatch.
|
49 |
|
|
-- LEDG(5) -> extra data from the ctrl.
|
50 |
|
|
-- LEDR(0) -> Gave write command.
|
51 |
|
|
-- LEDR(1) -> Gave read command.
|
52 |
|
|
-- LEDR(10...13) -> data words succesfully read.
|
53 |
|
|
-------------------------------------------------------------------------------
|
54 |
|
|
-- Revisions :
|
55 |
|
|
-- Date Version Author Description
|
56 |
|
|
-- 2009/08/13 1.0 alhonena Created
|
57 |
|
|
-- 2011/07/16 2.0 alhonena Continued.
|
58 |
|
|
-- 2011/10/09 2.1 alhonena Updated coding conventions & comments.
|
59 |
|
|
-------------------------------------------------------------------------------
|
60 |
|
|
|
61 |
|
|
library ieee;
|
62 |
|
|
use ieee.std_logic_1164.all;
|
63 |
|
|
use ieee.numeric_std.all;
|
64 |
|
|
|
65 |
|
|
entity tb_wra_16sdram_32hibi is
|
66 |
|
|
|
67 |
|
|
port (
|
68 |
|
|
clk : in std_logic;
|
69 |
|
|
rst_n : in std_logic;
|
70 |
|
|
|
71 |
|
|
SW : in std_logic_vector(15 downto 0);
|
72 |
|
|
LEDR : out std_logic_vector(17 downto 0);
|
73 |
|
|
LEDG : out std_logic_vector(8 downto 0);
|
74 |
|
|
|
75 |
|
|
sdram_data_inout : inout std_logic_vector(15 downto 0);
|
76 |
|
|
sdram_cke_out : out std_logic;
|
77 |
|
|
sdram_cs_n_out : out std_logic;
|
78 |
|
|
sdram_we_n_out : out std_logic;
|
79 |
|
|
sdram_ras_n_out : out std_logic;
|
80 |
|
|
sdram_cas_n_out : out std_logic;
|
81 |
|
|
sdram_dqm_out : out std_logic_vector(1 downto 0);
|
82 |
|
|
sdram_ba_out : out std_logic_vector(1 downto 0);
|
83 |
|
|
sdram_address_out : out std_logic_vector(11 downto 0);
|
84 |
|
|
sdram_clk : out std_logic
|
85 |
|
|
);
|
86 |
|
|
|
87 |
|
|
end tb_wra_16sdram_32hibi;
|
88 |
|
|
|
89 |
|
|
architecture rtl of tb_wra_16sdram_32hibi is
|
90 |
|
|
|
91 |
|
|
component sdram_controller
|
92 |
|
|
generic (
|
93 |
|
|
clk_freq_mhz_g : integer;
|
94 |
|
|
mem_addr_width_g : integer;
|
95 |
|
|
amountw_g : integer;
|
96 |
|
|
block_read_length_g : integer;
|
97 |
|
|
sim_ena_g : integer);
|
98 |
|
|
port (
|
99 |
|
|
clk : in std_logic;
|
100 |
|
|
rst_n : in std_logic;
|
101 |
|
|
command_in : in std_logic_vector(1 downto 0);
|
102 |
|
|
address_in : in std_logic_vector(mem_addr_width_g-1 downto 0);
|
103 |
|
|
data_amount_in : in std_logic_vector(amountw_g - 1
|
104 |
|
|
downto 0);
|
105 |
|
|
byte_select_in : in std_logic_vector(1 downto 0);
|
106 |
|
|
input_empty_in : in std_logic;
|
107 |
|
|
input_one_d_in : in std_logic;
|
108 |
|
|
output_full_in : in std_logic;
|
109 |
|
|
data_in : in std_logic_vector(15 downto 0);
|
110 |
|
|
write_on_out : out std_logic;
|
111 |
|
|
busy_out : out std_logic;
|
112 |
|
|
output_we_out : out std_logic;
|
113 |
|
|
input_re_out : out std_logic;
|
114 |
|
|
data_out : out std_logic_vector(15 downto 0);
|
115 |
|
|
sdram_data_inout : inout std_logic_vector(15 downto 0);
|
116 |
|
|
sdram_cke_out : out std_logic;
|
117 |
|
|
sdram_cs_n_out : out std_logic;
|
118 |
|
|
sdram_we_n_out : out std_logic;
|
119 |
|
|
sdram_ras_n_out : out std_logic;
|
120 |
|
|
sdram_cas_n_out : out std_logic;
|
121 |
|
|
sdram_dqm_out : out std_logic_vector(1 downto 0);
|
122 |
|
|
sdram_ba_out : out std_logic_vector(1 downto 0);
|
123 |
|
|
sdram_address_out : out std_logic_vector(11 downto 0));
|
124 |
|
|
end component;
|
125 |
|
|
|
126 |
|
|
component fifo
|
127 |
|
|
generic (
|
128 |
|
|
data_width_g : integer;
|
129 |
|
|
depth_g : integer);
|
130 |
|
|
port (
|
131 |
|
|
clk : in std_logic;
|
132 |
|
|
rst_n : in std_logic;
|
133 |
|
|
data_in : in std_logic_vector (data_width_g-1 downto 0);
|
134 |
|
|
we_in : in std_logic;
|
135 |
|
|
full_out : out std_logic;
|
136 |
|
|
one_p_out : out std_logic;
|
137 |
|
|
re_in : in std_logic;
|
138 |
|
|
data_out : out std_logic_vector (data_width_g-1 downto 0);
|
139 |
|
|
empty_out : out std_logic;
|
140 |
|
|
one_d_out : out std_logic);
|
141 |
|
|
end component;
|
142 |
|
|
|
143 |
|
|
component wra_16sdram_32hibi
|
144 |
|
|
generic (
|
145 |
|
|
mem_addr_width_g : integer);
|
146 |
|
|
port (
|
147 |
|
|
clk : in std_logic;
|
148 |
|
|
rst_n : in std_logic;
|
149 |
|
|
sdram2hibi_write_on_out : out std_logic;
|
150 |
|
|
sdram2hibi_comm_in : in std_logic_vector(1 downto 0);
|
151 |
|
|
sdram2hibi_addr_in : in std_logic_vector(21 downto 0);
|
152 |
|
|
sdram2hibi_data_amount_in : in std_logic_vector(mem_addr_width_g-1 downto 0);
|
153 |
|
|
sdram2hibi_input_one_d_in : in std_logic;
|
154 |
|
|
sdram2hibi_input_empty_in : in std_logic;
|
155 |
|
|
sdram2hibi_output_full_in : in std_logic;
|
156 |
|
|
sdram2hibi_busy_out : out std_logic;
|
157 |
|
|
sdram2hibi_re_out : out std_logic;
|
158 |
|
|
sdram2hibi_we_out : out std_logic;
|
159 |
|
|
sdram2hibi_data_in : in std_logic_vector(31 downto 0);
|
160 |
|
|
sdram2hibi_data_out : out std_logic_vector(31 downto 0);
|
161 |
|
|
ctrl_command_out : out std_logic_vector(1 downto 0);
|
162 |
|
|
ctrl_address_out : out std_logic_vector(21 downto 0);
|
163 |
|
|
ctrl_data_amount_out : out std_logic_vector(mem_addr_width_g-1 downto 0);
|
164 |
|
|
ctrl_byte_select_out : out std_logic_vector(1 downto 0);
|
165 |
|
|
ctrl_input_empty_out : out std_logic;
|
166 |
|
|
ctrl_input_one_d_out : out std_logic;
|
167 |
|
|
ctrl_output_full_out : out std_logic;
|
168 |
|
|
ctrl_data_out : out std_logic_vector(15 downto 0);
|
169 |
|
|
ctrl_write_on_in : in std_logic;
|
170 |
|
|
ctrl_busy_in : in std_logic;
|
171 |
|
|
ctrl_output_we_in : in std_logic;
|
172 |
|
|
ctrl_input_re_in : in std_logic;
|
173 |
|
|
ctrl_data_in : in std_logic_vector(15 downto 0));
|
174 |
|
|
end component;
|
175 |
|
|
|
176 |
|
|
signal fifo_to_sdram_one_d : std_logic;
|
177 |
|
|
signal fifo_to_sdram_empty : std_logic;
|
178 |
|
|
signal fifo_to_sdram_re : std_logic;
|
179 |
|
|
signal fifo_to_sdram_data : std_logic_vector(31 downto 0);
|
180 |
|
|
signal fifo_from_sdram_data : std_logic_vector(31 downto 0);
|
181 |
|
|
signal fifo_from_sdram_we : std_logic;
|
182 |
|
|
signal fifo_from_sdram_full : std_logic;
|
183 |
|
|
|
184 |
|
|
signal data_to_write_r : std_logic_vector(31 downto 0);
|
185 |
|
|
signal we_r : std_logic;
|
186 |
|
|
signal fifo_full : std_logic;
|
187 |
|
|
|
188 |
|
|
signal data_to_read : std_logic_vector(31 downto 0);
|
189 |
|
|
signal re_r : std_logic;
|
190 |
|
|
signal empty_from_fifo : std_logic;
|
191 |
|
|
|
192 |
|
|
signal state_r : integer range 0 to 15;
|
193 |
|
|
|
194 |
|
|
signal read_cnt_r : integer range 0 to 7;
|
195 |
|
|
|
196 |
|
|
signal command_to_sdram_ctrl : std_logic_vector(1 downto 0);
|
197 |
|
|
signal address_to_sdram_ctrl : std_logic_vector(21 downto 0);
|
198 |
|
|
signal data_amount_to_sdram_ctrl : std_logic_vector(21 downto 0);
|
199 |
|
|
|
200 |
|
|
signal write_on, busy : std_logic;
|
201 |
|
|
|
202 |
|
|
signal ctrl_command_out : std_logic_vector(1 downto 0);
|
203 |
|
|
signal ctrl_address_out : std_logic_vector(21 downto 0);
|
204 |
|
|
signal ctrl_data_amount_out : std_logic_vector(21 downto 0);
|
205 |
|
|
signal ctrl_byte_select_out : std_logic_vector(1 downto 0);
|
206 |
|
|
signal ctrl_input_empty_out : std_logic;
|
207 |
|
|
signal ctrl_input_one_d_out : std_logic;
|
208 |
|
|
signal ctrl_output_full_out : std_logic;
|
209 |
|
|
signal ctrl_data_out : std_logic_vector(15 downto 0);
|
210 |
|
|
signal ctrl_write_on_in : std_logic;
|
211 |
|
|
signal ctrl_busy_in : std_logic;
|
212 |
|
|
signal ctrl_output_we_in : std_logic;
|
213 |
|
|
signal ctrl_input_re_in : std_logic;
|
214 |
|
|
signal ctrl_data_in : std_logic_vector(15 downto 0);
|
215 |
|
|
|
216 |
|
|
|
217 |
|
|
|
218 |
|
|
begin -- rtl
|
219 |
|
|
|
220 |
|
|
sdram_clk <= clk;
|
221 |
|
|
|
222 |
|
|
sdram_controller_1: sdram_controller
|
223 |
|
|
generic map (
|
224 |
|
|
clk_freq_mhz_g => 50,
|
225 |
|
|
mem_addr_width_g => 22,
|
226 |
|
|
amountw_g => 22,
|
227 |
|
|
block_read_length_g => 123,
|
228 |
|
|
sim_ena_g => 0)
|
229 |
|
|
port map (
|
230 |
|
|
clk => clk,
|
231 |
|
|
rst_n => rst_n,
|
232 |
|
|
command_in => ctrl_command_out,
|
233 |
|
|
address_in => ctrl_address_out,
|
234 |
|
|
data_amount_in => ctrl_data_amount_out,
|
235 |
|
|
byte_select_in => ctrl_byte_select_out,
|
236 |
|
|
input_empty_in => ctrl_input_empty_out,
|
237 |
|
|
input_one_d_in => ctrl_input_one_d_out,
|
238 |
|
|
output_full_in => ctrl_output_full_out,
|
239 |
|
|
data_in => ctrl_data_out,
|
240 |
|
|
write_on_out => ctrl_write_on_in,
|
241 |
|
|
busy_out => ctrl_busy_in,
|
242 |
|
|
output_we_out => ctrl_output_we_in,
|
243 |
|
|
input_re_out => ctrl_input_re_in,
|
244 |
|
|
data_out => ctrl_data_in,
|
245 |
|
|
sdram_data_inout => sdram_data_inout,
|
246 |
|
|
sdram_cke_out => sdram_cke_out,
|
247 |
|
|
sdram_cs_n_out => sdram_cs_n_out,
|
248 |
|
|
sdram_we_n_out => sdram_we_n_out,
|
249 |
|
|
sdram_ras_n_out => sdram_ras_n_out,
|
250 |
|
|
sdram_cas_n_out => sdram_cas_n_out,
|
251 |
|
|
sdram_dqm_out => sdram_dqm_out,
|
252 |
|
|
sdram_ba_out => sdram_ba_out,
|
253 |
|
|
sdram_address_out => sdram_address_out);
|
254 |
|
|
|
255 |
|
|
-- The DUT:
|
256 |
|
|
wra_16sdram_32hibi_1: wra_16sdram_32hibi
|
257 |
|
|
generic map (
|
258 |
|
|
mem_addr_width_g => 22)
|
259 |
|
|
port map (
|
260 |
|
|
clk => clk,
|
261 |
|
|
rst_n => rst_n,
|
262 |
|
|
-- connected to the test case (that is, fifos):
|
263 |
|
|
sdram2hibi_write_on_out => write_on,
|
264 |
|
|
sdram2hibi_comm_in => command_to_sdram_ctrl,
|
265 |
|
|
sdram2hibi_addr_in => address_to_sdram_ctrl,
|
266 |
|
|
sdram2hibi_data_amount_in => data_amount_to_sdram_ctrl,
|
267 |
|
|
sdram2hibi_input_one_d_in => fifo_to_sdram_one_d,
|
268 |
|
|
sdram2hibi_input_empty_in => fifo_to_sdram_empty,
|
269 |
|
|
sdram2hibi_output_full_in => fifo_from_sdram_full,
|
270 |
|
|
sdram2hibi_busy_out => busy,
|
271 |
|
|
sdram2hibi_re_out => fifo_to_sdram_re,
|
272 |
|
|
sdram2hibi_we_out => fifo_from_sdram_we,
|
273 |
|
|
sdram2hibi_data_in => fifo_to_sdram_data,
|
274 |
|
|
sdram2hibi_data_out => fifo_from_sdram_data,
|
275 |
|
|
-- connected directly to the sdram controller:
|
276 |
|
|
ctrl_command_out => ctrl_command_out,
|
277 |
|
|
ctrl_address_out => ctrl_address_out,
|
278 |
|
|
ctrl_data_amount_out => ctrl_data_amount_out,
|
279 |
|
|
ctrl_byte_select_out => ctrl_byte_select_out,
|
280 |
|
|
ctrl_input_empty_out => ctrl_input_empty_out,
|
281 |
|
|
ctrl_input_one_d_out => ctrl_input_one_d_out,
|
282 |
|
|
ctrl_output_full_out => ctrl_output_full_out,
|
283 |
|
|
ctrl_data_out => ctrl_data_out,
|
284 |
|
|
ctrl_write_on_in => ctrl_write_on_in,
|
285 |
|
|
ctrl_busy_in => ctrl_busy_in,
|
286 |
|
|
ctrl_output_we_in => ctrl_output_we_in,
|
287 |
|
|
ctrl_input_re_in => ctrl_input_re_in,
|
288 |
|
|
ctrl_data_in => ctrl_data_in);
|
289 |
|
|
|
290 |
|
|
fifo_to_sdram: fifo
|
291 |
|
|
generic map (
|
292 |
|
|
data_width_g => 32,
|
293 |
|
|
depth_g => 8)
|
294 |
|
|
port map (
|
295 |
|
|
clk => clk,
|
296 |
|
|
rst_n => rst_n,
|
297 |
|
|
data_in => data_to_write_r,
|
298 |
|
|
we_in => we_r,
|
299 |
|
|
full_out => fifo_full,
|
300 |
|
|
one_p_out => open,
|
301 |
|
|
re_in => fifo_to_sdram_re,
|
302 |
|
|
data_out => fifo_to_sdram_data,
|
303 |
|
|
empty_out => fifo_to_sdram_empty,
|
304 |
|
|
one_d_out => fifo_to_sdram_one_d);
|
305 |
|
|
|
306 |
|
|
fifo_from_sdram: fifo
|
307 |
|
|
generic map (
|
308 |
|
|
data_width_g => 32,
|
309 |
|
|
depth_g => 8)
|
310 |
|
|
port map (
|
311 |
|
|
clk => clk,
|
312 |
|
|
rst_n => rst_n,
|
313 |
|
|
data_in => fifo_from_sdram_data,
|
314 |
|
|
we_in => fifo_from_sdram_we,
|
315 |
|
|
full_out => fifo_from_sdram_full,
|
316 |
|
|
one_p_out => open,
|
317 |
|
|
re_in => re_r,
|
318 |
|
|
data_out => data_to_read,
|
319 |
|
|
empty_out => empty_from_fifo,
|
320 |
|
|
one_d_out => open);
|
321 |
|
|
|
322 |
|
|
tester: process (clk, rst_n)
|
323 |
|
|
begin -- process tester
|
324 |
|
|
if rst_n = '0' then -- asynchronous reset (active low)
|
325 |
|
|
|
326 |
|
|
state_r <= 0;
|
327 |
|
|
read_cnt_r <= 0;
|
328 |
|
|
|
329 |
|
|
command_to_sdram_ctrl <= "00";
|
330 |
|
|
|
331 |
|
|
LEDR <= (others => '0');
|
332 |
|
|
LEDG <= (others => '0');
|
333 |
|
|
|
334 |
|
|
elsif clk'event and clk = '1' then -- rising clock edge
|
335 |
|
|
|
336 |
|
|
-- Wait for initialization.
|
337 |
|
|
if state_r = 0 and busy = '0' then
|
338 |
|
|
state_r <= 1;
|
339 |
|
|
end if;
|
340 |
|
|
|
341 |
|
|
if state_r = 1 then
|
342 |
|
|
data_to_write_r <= x"1234ABCD";
|
343 |
|
|
we_r <= '1';
|
344 |
|
|
state_r <= 2;
|
345 |
|
|
end if;
|
346 |
|
|
|
347 |
|
|
if state_r = 2 then
|
348 |
|
|
data_to_write_r <= x"5678EFAB";
|
349 |
|
|
we_r <= '1';
|
350 |
|
|
state_r <= 3;
|
351 |
|
|
end if;
|
352 |
|
|
|
353 |
|
|
if state_r = 3 then
|
354 |
|
|
data_to_write_r <= x"3210" & SW;
|
355 |
|
|
we_r <= '1';
|
356 |
|
|
state_r <= 4;
|
357 |
|
|
end if;
|
358 |
|
|
|
359 |
|
|
if state_r = 4 then
|
360 |
|
|
data_to_write_r <= x"01239ABC";
|
361 |
|
|
we_r <= '1';
|
362 |
|
|
state_r <= 5;
|
363 |
|
|
end if;
|
364 |
|
|
|
365 |
|
|
if state_r = 5 then
|
366 |
|
|
we_r <= '0';
|
367 |
|
|
command_to_sdram_ctrl <= "10"; -- WRITE COMMAND.
|
368 |
|
|
address_to_sdram_ctrl <= "0000000000010011010010"; -- just a test address.
|
369 |
|
|
data_amount_to_sdram_ctrl <= std_logic_vector(to_unsigned(4, 22)); -- Write four.
|
370 |
|
|
state_r <= 6;
|
371 |
|
|
LEDR(0) <= '1';
|
372 |
|
|
end if;
|
373 |
|
|
|
374 |
|
|
if state_r = 6 then
|
375 |
|
|
command_to_sdram_ctrl <= "00";
|
376 |
|
|
if busy = '0' then
|
377 |
|
|
state_r <= 7;
|
378 |
|
|
end if;
|
379 |
|
|
end if;
|
380 |
|
|
|
381 |
|
|
if state_r = 7 then
|
382 |
|
|
command_to_sdram_ctrl <= "00";
|
383 |
|
|
if busy = '0' then
|
384 |
|
|
state_r <= 8;
|
385 |
|
|
end if;
|
386 |
|
|
end if;
|
387 |
|
|
|
388 |
|
|
if state_r = 8 then
|
389 |
|
|
command_to_sdram_ctrl <= "00";
|
390 |
|
|
if busy = '0' then
|
391 |
|
|
state_r <= 9;
|
392 |
|
|
end if;
|
393 |
|
|
end if;
|
394 |
|
|
|
395 |
|
|
if state_r = 9 then
|
396 |
|
|
if busy = '0' then
|
397 |
|
|
command_to_sdram_ctrl <= "01"; -- READ COMMAND.
|
398 |
|
|
address_to_sdram_ctrl <= "0000000000010011010010";
|
399 |
|
|
data_amount_to_sdram_ctrl <= std_logic_vector(to_unsigned(4, 22));
|
400 |
|
|
state_r <= 10;
|
401 |
|
|
LEDR(1) <= '1';
|
402 |
|
|
end if;
|
403 |
|
|
|
404 |
|
|
end if;
|
405 |
|
|
|
406 |
|
|
if state_r = 10 then
|
407 |
|
|
command_to_sdram_ctrl <= "00";
|
408 |
|
|
state_r <= 11;
|
409 |
|
|
end if;
|
410 |
|
|
|
411 |
|
|
if empty_from_fifo = '0' and state_r < 10 then
|
412 |
|
|
-- Error led: SDRAM controller gave data before it was asked for.
|
413 |
|
|
LEDG(0) <= '1';
|
414 |
|
|
end if;
|
415 |
|
|
|
416 |
|
|
re_r <= '0';
|
417 |
|
|
|
418 |
|
|
if empty_from_fifo = '0' and re_r = '0' then
|
419 |
|
|
read_cnt_r <= read_cnt_r + 1;
|
420 |
|
|
LEDR(read_cnt_r + 10) <= '1';
|
421 |
|
|
re_r <= '1';
|
422 |
|
|
case read_cnt_r is
|
423 |
|
|
when 0 => if data_to_read /= x"1234ABCD" then
|
424 |
|
|
LEDG(1) <= '1';
|
425 |
|
|
end if;
|
426 |
|
|
when 1 => if data_to_read /= x"5678EFAB" then
|
427 |
|
|
LEDG(2) <= '1';
|
428 |
|
|
end if;
|
429 |
|
|
when 2 => if data_to_read /= x"3210" & "0101010101010101" then
|
430 |
|
|
LEDG(3) <= '1';
|
431 |
|
|
end if;
|
432 |
|
|
when 3 => if data_to_read /= x"01239ABC" then
|
433 |
|
|
LEDG(4) <= '1';
|
434 |
|
|
end if;
|
435 |
|
|
when 4 => LEDG(5) <= '1'; -- Too much data came from the ctrl.
|
436 |
|
|
|
437 |
|
|
when others => null;
|
438 |
|
|
end case;
|
439 |
|
|
end if;
|
440 |
|
|
|
441 |
|
|
|
442 |
|
|
end if;
|
443 |
|
|
end process tester;
|
444 |
|
|
|
445 |
|
|
end rtl;
|