1 |
2 |
galland |
----------------------------------------------------------------------------------
|
2 |
3 |
galland |
-- Company: VISENGI S.L. (www.visengi.com) - URJC FRAV Group (www.frav.es)
|
3 |
|
|
-- Engineer: Victor Lopez Lorenzo (victor.lopez (at) visengi (dot) com)
|
4 |
2 |
galland |
--
|
5 |
|
|
-- Create Date: 12:39:50 06-Oct-2008
|
6 |
|
|
-- Project Name: ZBT SRAM WISHBONE Controller
|
7 |
|
|
-- Target Devices: Xilinx ML506 board
|
8 |
|
|
-- Tool versions: Xilinx ISE 9.2i
|
9 |
|
|
-- Description: This is a ZBT SRAM controller which is Wishbone rev B.3 compatible (classic + burst r/w operations).
|
10 |
|
|
--
|
11 |
|
|
-- Dependencies: It may be run on any board/FPGA with a ZBT SRAM pin compatible (or at least in the control signals)
|
12 |
|
|
-- with the one on the ML506 board (ISSI IS61NLP 256kx36 ZBT SRAM)
|
13 |
|
|
--
|
14 |
|
|
--
|
15 |
4 |
galland |
-- LICENSE TERMS: (CCPL) Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported.
|
16 |
|
|
-- http://creativecommons.org/licenses/by-nc-sa/3.0/
|
17 |
3 |
galland |
--
|
18 |
|
|
-- That is you may use it only in NON-COMMERCIAL projects.
|
19 |
4 |
galland |
-- You are required to include in the copyrights/about section
|
20 |
|
|
-- that your system contains a "ZBT SRAM Controller (C) Victor Lopez Lorenzo under CCPL license"
|
21 |
2 |
galland |
-- This holds also in the case where you modify the core, as the resulting core
|
22 |
|
|
-- would be a derived work.
|
23 |
3 |
galland |
-- Also, we would like to know if you use this core in a project of yours, just an email will do.
|
24 |
2 |
galland |
--
|
25 |
4 |
galland |
-- Please take good note of the disclaimer section of the CCPL license, as we don't
|
26 |
2 |
galland |
-- take any responsability for anything that this core does.
|
27 |
|
|
----------------------------------------------------------------------------------
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
LIBRARY ieee;
|
31 |
|
|
USE ieee.std_logic_1164.ALL;
|
32 |
|
|
USE ieee.std_logic_unsigned.all;
|
33 |
|
|
USE ieee.numeric_std.ALL;
|
34 |
|
|
USE ieee.std_logic_arith.all;
|
35 |
|
|
|
36 |
|
|
ENTITY tb_zbt_top_vhd IS
|
37 |
|
|
END tb_zbt_top_vhd;
|
38 |
|
|
|
39 |
|
|
ARCHITECTURE behavior OF tb_zbt_top_vhd IS
|
40 |
|
|
|
41 |
|
|
-- Component Declaration for the Unit Under Test (UUT)
|
42 |
|
|
COMPONENT zbt_top
|
43 |
|
|
PORT(
|
44 |
|
|
clk : IN std_logic;
|
45 |
|
|
reset : IN std_logic;
|
46 |
|
|
wb_adr_i : IN std_logic_vector(17 downto 0);
|
47 |
|
|
wb_we_i : IN std_logic;
|
48 |
|
|
wb_dat_i : IN std_logic_vector(35 downto 0);
|
49 |
|
|
wb_sel_i : IN std_logic_vector(3 downto 0);
|
50 |
|
|
wb_cyc_i : IN std_logic;
|
51 |
|
|
wb_stb_i : IN std_logic;
|
52 |
|
|
wb_cti_i : IN std_logic_vector(2 downto 0);
|
53 |
|
|
wb_bte_i : IN std_logic_vector(1 downto 0);
|
54 |
|
|
wb_tga_i : IN std_logic;
|
55 |
|
|
SRAM_FLASH_D0 : INOUT std_logic;
|
56 |
|
|
SRAM_FLASH_D1 : INOUT std_logic;
|
57 |
|
|
SRAM_FLASH_D2 : INOUT std_logic;
|
58 |
|
|
SRAM_FLASH_D3 : INOUT std_logic;
|
59 |
|
|
SRAM_FLASH_D4 : INOUT std_logic;
|
60 |
|
|
SRAM_FLASH_D5 : INOUT std_logic;
|
61 |
|
|
SRAM_FLASH_D6 : INOUT std_logic;
|
62 |
|
|
SRAM_FLASH_D7 : INOUT std_logic;
|
63 |
|
|
SRAM_FLASH_D8 : INOUT std_logic;
|
64 |
|
|
SRAM_FLASH_D9 : INOUT std_logic;
|
65 |
|
|
SRAM_FLASH_D10 : INOUT std_logic;
|
66 |
|
|
SRAM_FLASH_D11 : INOUT std_logic;
|
67 |
|
|
SRAM_FLASH_D12 : INOUT std_logic;
|
68 |
|
|
SRAM_FLASH_D13 : INOUT std_logic;
|
69 |
|
|
SRAM_FLASH_D14 : INOUT std_logic;
|
70 |
|
|
SRAM_FLASH_D15 : INOUT std_logic;
|
71 |
|
|
SRAM_D16 : INOUT std_logic;
|
72 |
|
|
SRAM_D17 : INOUT std_logic;
|
73 |
|
|
SRAM_D18 : INOUT std_logic;
|
74 |
|
|
SRAM_D19 : INOUT std_logic;
|
75 |
|
|
SRAM_D20 : INOUT std_logic;
|
76 |
|
|
SRAM_D21 : INOUT std_logic;
|
77 |
|
|
SRAM_D22 : INOUT std_logic;
|
78 |
|
|
SRAM_D23 : INOUT std_logic;
|
79 |
|
|
SRAM_D24 : INOUT std_logic;
|
80 |
|
|
SRAM_D25 : INOUT std_logic;
|
81 |
|
|
SRAM_D26 : INOUT std_logic;
|
82 |
|
|
SRAM_D27 : INOUT std_logic;
|
83 |
|
|
SRAM_D28 : INOUT std_logic;
|
84 |
|
|
SRAM_D29 : INOUT std_logic;
|
85 |
|
|
SRAM_D30 : INOUT std_logic;
|
86 |
|
|
SRAM_D31 : INOUT std_logic;
|
87 |
|
|
SRAM_DQP0 : INOUT std_logic;
|
88 |
|
|
SRAM_DQP1 : INOUT std_logic;
|
89 |
|
|
SRAM_DQP2 : INOUT std_logic;
|
90 |
|
|
SRAM_DQP3 : INOUT std_logic;
|
91 |
|
|
SRAM_CLK : OUT std_logic;
|
92 |
|
|
SRAM_MODE : OUT std_logic;
|
93 |
|
|
SRAM_CS_B : OUT std_logic;
|
94 |
|
|
SRAM_OE_B : OUT std_logic;
|
95 |
|
|
SRAM_FLASH_WE_B : OUT std_logic;
|
96 |
|
|
SRAM_ADV_LD_B : OUT std_logic;
|
97 |
|
|
SRAM_BW0 : OUT std_logic;
|
98 |
|
|
SRAM_BW1 : OUT std_logic;
|
99 |
|
|
SRAM_BW2 : OUT std_logic;
|
100 |
|
|
SRAM_BW3 : OUT std_logic;
|
101 |
|
|
SRAM_FLASH_A1 : OUT std_logic;
|
102 |
|
|
SRAM_FLASH_A2 : OUT std_logic;
|
103 |
|
|
SRAM_FLASH_A3 : OUT std_logic;
|
104 |
|
|
SRAM_FLASH_A4 : OUT std_logic;
|
105 |
|
|
SRAM_FLASH_A5 : OUT std_logic;
|
106 |
|
|
SRAM_FLASH_A6 : OUT std_logic;
|
107 |
|
|
SRAM_FLASH_A7 : OUT std_logic;
|
108 |
|
|
SRAM_FLASH_A8 : OUT std_logic;
|
109 |
|
|
SRAM_FLASH_A9 : OUT std_logic;
|
110 |
|
|
SRAM_FLASH_A10 : OUT std_logic;
|
111 |
|
|
SRAM_FLASH_A11 : OUT std_logic;
|
112 |
|
|
SRAM_FLASH_A12 : OUT std_logic;
|
113 |
|
|
SRAM_FLASH_A13 : OUT std_logic;
|
114 |
|
|
SRAM_FLASH_A14 : OUT std_logic;
|
115 |
|
|
SRAM_FLASH_A15 : OUT std_logic;
|
116 |
|
|
SRAM_FLASH_A16 : OUT std_logic;
|
117 |
|
|
SRAM_FLASH_A17 : OUT std_logic;
|
118 |
|
|
SRAM_FLASH_A18 : OUT std_logic;
|
119 |
|
|
wb_dat_o : OUT std_logic_vector(35 downto 0);
|
120 |
|
|
wb_ack_o : OUT std_logic;
|
121 |
|
|
wb_err_o : OUT std_logic
|
122 |
|
|
);
|
123 |
|
|
END COMPONENT;
|
124 |
|
|
|
125 |
|
|
--Inputs
|
126 |
|
|
SIGNAL clk : std_logic := '0';
|
127 |
|
|
SIGNAL reset : std_logic := '0';
|
128 |
|
|
SIGNAL wb_we_i : std_logic := '0';
|
129 |
|
|
SIGNAL wb_cyc_i : std_logic := '0';
|
130 |
|
|
SIGNAL wb_stb_i : std_logic := '0';
|
131 |
|
|
SIGNAL wb_tga_i : std_logic := '0';
|
132 |
|
|
SIGNAL wb_adr_i, ZBT_ADDR : std_logic_vector(17 downto 0) := (others=>'0');
|
133 |
|
|
SIGNAL wb_dat_i : std_logic_vector(35 downto 0) := (others=>'0');
|
134 |
|
|
SIGNAL wb_sel_i : std_logic_vector(3 downto 0) := (others=>'0');
|
135 |
|
|
SIGNAL wb_cti_i : std_logic_vector(2 downto 0) := (others=>'0');
|
136 |
|
|
SIGNAL wb_bte_i : std_logic_vector(1 downto 0) := (others=>'0');
|
137 |
|
|
|
138 |
|
|
--BiDirs
|
139 |
|
|
SIGNAL SRAM_FLASH_D0 : std_logic;
|
140 |
|
|
SIGNAL SRAM_FLASH_D1 : std_logic;
|
141 |
|
|
SIGNAL SRAM_FLASH_D2 : std_logic;
|
142 |
|
|
SIGNAL SRAM_FLASH_D3 : std_logic;
|
143 |
|
|
SIGNAL SRAM_FLASH_D4 : std_logic;
|
144 |
|
|
SIGNAL SRAM_FLASH_D5 : std_logic;
|
145 |
|
|
SIGNAL SRAM_FLASH_D6 : std_logic;
|
146 |
|
|
SIGNAL SRAM_FLASH_D7 : std_logic;
|
147 |
|
|
SIGNAL SRAM_FLASH_D8 : std_logic;
|
148 |
|
|
SIGNAL SRAM_FLASH_D9 : std_logic;
|
149 |
|
|
SIGNAL SRAM_FLASH_D10 : std_logic;
|
150 |
|
|
SIGNAL SRAM_FLASH_D11 : std_logic;
|
151 |
|
|
SIGNAL SRAM_FLASH_D12 : std_logic;
|
152 |
|
|
SIGNAL SRAM_FLASH_D13 : std_logic;
|
153 |
|
|
SIGNAL SRAM_FLASH_D14 : std_logic;
|
154 |
|
|
SIGNAL SRAM_FLASH_D15 : std_logic;
|
155 |
|
|
SIGNAL SRAM_D16 : std_logic;
|
156 |
|
|
SIGNAL SRAM_D17 : std_logic;
|
157 |
|
|
SIGNAL SRAM_D18 : std_logic;
|
158 |
|
|
SIGNAL SRAM_D19 : std_logic;
|
159 |
|
|
SIGNAL SRAM_D20 : std_logic;
|
160 |
|
|
SIGNAL SRAM_D21 : std_logic;
|
161 |
|
|
SIGNAL SRAM_D22 : std_logic;
|
162 |
|
|
SIGNAL SRAM_D23 : std_logic;
|
163 |
|
|
SIGNAL SRAM_D24 : std_logic;
|
164 |
|
|
SIGNAL SRAM_D25 : std_logic;
|
165 |
|
|
SIGNAL SRAM_D26 : std_logic;
|
166 |
|
|
SIGNAL SRAM_D27 : std_logic;
|
167 |
|
|
SIGNAL SRAM_D28 : std_logic;
|
168 |
|
|
SIGNAL SRAM_D29 : std_logic;
|
169 |
|
|
SIGNAL SRAM_D30 : std_logic;
|
170 |
|
|
SIGNAL SRAM_D31 : std_logic;
|
171 |
|
|
SIGNAL SRAM_DQP0 : std_logic;
|
172 |
|
|
SIGNAL SRAM_DQP1 : std_logic;
|
173 |
|
|
SIGNAL SRAM_DQP2 : std_logic;
|
174 |
|
|
SIGNAL SRAM_DQP3 : std_logic;
|
175 |
|
|
|
176 |
|
|
--Outputs
|
177 |
|
|
SIGNAL SRAM_CLK : std_logic;
|
178 |
|
|
SIGNAL SRAM_MODE : std_logic;
|
179 |
|
|
SIGNAL SRAM_CS_B : std_logic;
|
180 |
|
|
SIGNAL SRAM_OE_B : std_logic;
|
181 |
|
|
SIGNAL SRAM_FLASH_WE_B : std_logic;
|
182 |
|
|
SIGNAL SRAM_ADV_LD_B : std_logic;
|
183 |
|
|
SIGNAL SRAM_BW0 : std_logic;
|
184 |
|
|
SIGNAL SRAM_BW1 : std_logic;
|
185 |
|
|
SIGNAL SRAM_BW2 : std_logic;
|
186 |
|
|
SIGNAL SRAM_BW3 : std_logic;
|
187 |
|
|
SIGNAL SRAM_FLASH_A1 : std_logic;
|
188 |
|
|
SIGNAL SRAM_FLASH_A2 : std_logic;
|
189 |
|
|
SIGNAL SRAM_FLASH_A3 : std_logic;
|
190 |
|
|
SIGNAL SRAM_FLASH_A4 : std_logic;
|
191 |
|
|
SIGNAL SRAM_FLASH_A5 : std_logic;
|
192 |
|
|
SIGNAL SRAM_FLASH_A6 : std_logic;
|
193 |
|
|
SIGNAL SRAM_FLASH_A7 : std_logic;
|
194 |
|
|
SIGNAL SRAM_FLASH_A8 : std_logic;
|
195 |
|
|
SIGNAL SRAM_FLASH_A9 : std_logic;
|
196 |
|
|
SIGNAL SRAM_FLASH_A10 : std_logic;
|
197 |
|
|
SIGNAL SRAM_FLASH_A11 : std_logic;
|
198 |
|
|
SIGNAL SRAM_FLASH_A12 : std_logic;
|
199 |
|
|
SIGNAL SRAM_FLASH_A13 : std_logic;
|
200 |
|
|
SIGNAL SRAM_FLASH_A14 : std_logic;
|
201 |
|
|
SIGNAL SRAM_FLASH_A15 : std_logic;
|
202 |
|
|
SIGNAL SRAM_FLASH_A16 : std_logic;
|
203 |
|
|
SIGNAL SRAM_FLASH_A17 : std_logic;
|
204 |
|
|
SIGNAL SRAM_FLASH_A18 : std_logic;
|
205 |
|
|
SIGNAL wb_dat_o, ZBT_OUT, ZBT_IN : std_logic_vector(35 downto 0);
|
206 |
|
|
SIGNAL wb_ack_o : std_logic;
|
207 |
|
|
SIGNAL wb_err_o : std_logic;
|
208 |
|
|
|
209 |
|
|
BEGIN
|
210 |
|
|
|
211 |
|
|
-- Instantiate the Unit Under Test (UUT)
|
212 |
|
|
uut: zbt_top PORT MAP(
|
213 |
|
|
clk => clk,
|
214 |
|
|
reset => reset,
|
215 |
|
|
SRAM_CLK => SRAM_CLK,
|
216 |
|
|
SRAM_MODE => SRAM_MODE,
|
217 |
|
|
SRAM_CS_B => SRAM_CS_B,
|
218 |
|
|
SRAM_OE_B => SRAM_OE_B,
|
219 |
|
|
SRAM_FLASH_WE_B => SRAM_FLASH_WE_B,
|
220 |
|
|
SRAM_ADV_LD_B => SRAM_ADV_LD_B,
|
221 |
|
|
SRAM_BW0 => SRAM_BW0,
|
222 |
|
|
SRAM_BW1 => SRAM_BW1,
|
223 |
|
|
SRAM_BW2 => SRAM_BW2,
|
224 |
|
|
SRAM_BW3 => SRAM_BW3,
|
225 |
|
|
SRAM_FLASH_A1 => SRAM_FLASH_A1,
|
226 |
|
|
SRAM_FLASH_A2 => SRAM_FLASH_A2,
|
227 |
|
|
SRAM_FLASH_A3 => SRAM_FLASH_A3,
|
228 |
|
|
SRAM_FLASH_A4 => SRAM_FLASH_A4,
|
229 |
|
|
SRAM_FLASH_A5 => SRAM_FLASH_A5,
|
230 |
|
|
SRAM_FLASH_A6 => SRAM_FLASH_A6,
|
231 |
|
|
SRAM_FLASH_A7 => SRAM_FLASH_A7,
|
232 |
|
|
SRAM_FLASH_A8 => SRAM_FLASH_A8,
|
233 |
|
|
SRAM_FLASH_A9 => SRAM_FLASH_A9,
|
234 |
|
|
SRAM_FLASH_A10 => SRAM_FLASH_A10,
|
235 |
|
|
SRAM_FLASH_A11 => SRAM_FLASH_A11,
|
236 |
|
|
SRAM_FLASH_A12 => SRAM_FLASH_A12,
|
237 |
|
|
SRAM_FLASH_A13 => SRAM_FLASH_A13,
|
238 |
|
|
SRAM_FLASH_A14 => SRAM_FLASH_A14,
|
239 |
|
|
SRAM_FLASH_A15 => SRAM_FLASH_A15,
|
240 |
|
|
SRAM_FLASH_A16 => SRAM_FLASH_A16,
|
241 |
|
|
SRAM_FLASH_A17 => SRAM_FLASH_A17,
|
242 |
|
|
SRAM_FLASH_A18 => SRAM_FLASH_A18,
|
243 |
|
|
SRAM_FLASH_D0 => SRAM_FLASH_D0,
|
244 |
|
|
SRAM_FLASH_D1 => SRAM_FLASH_D1,
|
245 |
|
|
SRAM_FLASH_D2 => SRAM_FLASH_D2,
|
246 |
|
|
SRAM_FLASH_D3 => SRAM_FLASH_D3,
|
247 |
|
|
SRAM_FLASH_D4 => SRAM_FLASH_D4,
|
248 |
|
|
SRAM_FLASH_D5 => SRAM_FLASH_D5,
|
249 |
|
|
SRAM_FLASH_D6 => SRAM_FLASH_D6,
|
250 |
|
|
SRAM_FLASH_D7 => SRAM_FLASH_D7,
|
251 |
|
|
SRAM_FLASH_D8 => SRAM_FLASH_D8,
|
252 |
|
|
SRAM_FLASH_D9 => SRAM_FLASH_D9,
|
253 |
|
|
SRAM_FLASH_D10 => SRAM_FLASH_D10,
|
254 |
|
|
SRAM_FLASH_D11 => SRAM_FLASH_D11,
|
255 |
|
|
SRAM_FLASH_D12 => SRAM_FLASH_D12,
|
256 |
|
|
SRAM_FLASH_D13 => SRAM_FLASH_D13,
|
257 |
|
|
SRAM_FLASH_D14 => SRAM_FLASH_D14,
|
258 |
|
|
SRAM_FLASH_D15 => SRAM_FLASH_D15,
|
259 |
|
|
SRAM_D16 => SRAM_D16,
|
260 |
|
|
SRAM_D17 => SRAM_D17,
|
261 |
|
|
SRAM_D18 => SRAM_D18,
|
262 |
|
|
SRAM_D19 => SRAM_D19,
|
263 |
|
|
SRAM_D20 => SRAM_D20,
|
264 |
|
|
SRAM_D21 => SRAM_D21,
|
265 |
|
|
SRAM_D22 => SRAM_D22,
|
266 |
|
|
SRAM_D23 => SRAM_D23,
|
267 |
|
|
SRAM_D24 => SRAM_D24,
|
268 |
|
|
SRAM_D25 => SRAM_D25,
|
269 |
|
|
SRAM_D26 => SRAM_D26,
|
270 |
|
|
SRAM_D27 => SRAM_D27,
|
271 |
|
|
SRAM_D28 => SRAM_D28,
|
272 |
|
|
SRAM_D29 => SRAM_D29,
|
273 |
|
|
SRAM_D30 => SRAM_D30,
|
274 |
|
|
SRAM_D31 => SRAM_D31,
|
275 |
|
|
SRAM_DQP0 => SRAM_DQP0,
|
276 |
|
|
SRAM_DQP1 => SRAM_DQP1,
|
277 |
|
|
SRAM_DQP2 => SRAM_DQP2,
|
278 |
|
|
SRAM_DQP3 => SRAM_DQP3,
|
279 |
|
|
wb_adr_i => wb_adr_i,
|
280 |
|
|
wb_we_i => wb_we_i,
|
281 |
|
|
wb_dat_i => wb_dat_i,
|
282 |
|
|
wb_sel_i => wb_sel_i,
|
283 |
|
|
wb_dat_o => wb_dat_o,
|
284 |
|
|
wb_cyc_i => wb_cyc_i,
|
285 |
|
|
wb_stb_i => wb_stb_i,
|
286 |
|
|
wb_cti_i => wb_cti_i,
|
287 |
|
|
wb_bte_i => wb_bte_i,
|
288 |
|
|
wb_ack_o => wb_ack_o,
|
289 |
|
|
wb_err_o => wb_err_o,
|
290 |
|
|
wb_tga_i => wb_tga_i
|
291 |
|
|
);
|
292 |
|
|
|
293 |
|
|
|
294 |
|
|
reset <= '1', '0' after 40 ns; --active high reset
|
295 |
|
|
|
296 |
|
|
Clocking : process
|
297 |
|
|
begin
|
298 |
|
|
clk <= '1'; wait for 10 ns;
|
299 |
|
|
clk <= '0'; wait for 10 ns;
|
300 |
|
|
end process;
|
301 |
|
|
|
302 |
|
|
|
303 |
|
|
ZBT_dout : process (reset, clk)
|
304 |
|
|
variable GetDin, GetWords : integer;
|
305 |
|
|
variable SRAM_BW4 : std_logic_vector(3 downto 0);
|
306 |
|
|
begin
|
307 |
|
|
if (reset = '1') then
|
308 |
|
|
ZBT_OUT <= (others => '0');
|
309 |
|
|
GetDin := 5;
|
310 |
|
|
GetWords := 0;
|
311 |
|
|
SRAM_BW4 := "0000";
|
312 |
|
|
elsif (clk = '1' and clk'event) then
|
313 |
|
|
GetDin := GetDin + 1;
|
314 |
|
|
if (GetDin >= 1 and GetDin <=3 and SRAM_ADV_LD_B = '1') then GetWords := GetWords + 1; end if;
|
315 |
|
|
if (SRAM_FLASH_WE_B = '0' and SRAM_CS_B = '0' and SRAM_ADV_LD_B = '0') then
|
316 |
|
|
GetDin := 1;
|
317 |
|
|
GetWords := 1;
|
318 |
|
|
SRAM_BW4 := SRAM_BW3 & SRAM_BW2 & SRAM_BW1 & SRAM_BW0; --active low
|
319 |
|
|
end if;
|
320 |
|
|
if (GetDin >= 3 and GetWords > 0) then
|
321 |
|
|
if (SRAM_BW4(3) = '0') then ZBT_OUT(35) <= ZBT_IN(35); ZBT_OUT(31 downto 24) <= ZBT_IN(31 downto 24); end if;
|
322 |
|
|
if (SRAM_BW4(2) = '0') then ZBT_OUT(34) <= ZBT_IN(34); ZBT_OUT(23 downto 16) <= ZBT_IN(23 downto 16); end if;
|
323 |
|
|
if (SRAM_BW4(1) = '0') then ZBT_OUT(33) <= ZBT_IN(33); ZBT_OUT(15 downto 8) <= ZBT_IN(15 downto 8); end if;
|
324 |
|
|
if (SRAM_BW4(0) = '0') then ZBT_OUT(32) <= ZBT_IN(32); ZBT_OUT(7 downto 0) <= ZBT_IN(7 downto 0); end if;
|
325 |
|
|
GetWords := GetWords - 1;
|
326 |
|
|
end if;
|
327 |
|
|
end if;
|
328 |
|
|
end process ZBT_dout;
|
329 |
|
|
|
330 |
|
|
|
331 |
|
|
|
332 |
|
|
Control : process (reset, clk)
|
333 |
|
|
variable WaitACK : std_logic;
|
334 |
|
|
variable State, ack_count : integer;
|
335 |
|
|
variable wb_adr_i2 : std_logic_vector(15 downto 0);
|
336 |
|
|
begin
|
337 |
|
|
if (reset = '1') then
|
338 |
|
|
wb_adr_i2 := x"0000";
|
339 |
|
|
wb_adr_i <= (others => '0');
|
340 |
|
|
wb_dat_i <= (others => '0');
|
341 |
|
|
wb_sel_i <= (others => '0');
|
342 |
|
|
wb_cti_i <= (others => '0');
|
343 |
|
|
wb_bte_i <= (others => '0');
|
344 |
|
|
wb_cyc_i <= '0';
|
345 |
|
|
wb_stb_i <= '0';
|
346 |
|
|
wb_we_i <= '0';
|
347 |
|
|
wb_tga_i <= '0';
|
348 |
|
|
|
349 |
|
|
ack_count := 0;
|
350 |
|
|
WaitACK := '0';
|
351 |
|
|
State := 0;
|
352 |
|
|
elsif (clk = '1' and clk'event) then
|
353 |
|
|
if (WaitACK = '1') then
|
354 |
|
|
if (wb_ack_o = '1') then
|
355 |
|
|
if (ack_count /= 0) then
|
356 |
|
|
if (ack_count /= 1) then
|
357 |
|
|
if (wb_we_i='1') then wb_dat_i <= wb_dat_i + 1; end if;
|
358 |
|
|
wb_adr_i2 := wb_adr_i2 + 1;
|
359 |
|
|
end if;
|
360 |
|
|
if (ack_count = 2 and wb_tga_i = '0') then wb_cti_i <= "111"; wb_sel_i <= "0001"; end if;
|
361 |
|
|
ack_count := ack_count - 1;
|
362 |
|
|
end if;
|
363 |
|
|
|
364 |
|
|
if (ack_count = 0) then
|
365 |
|
|
WaitACK := '0';
|
366 |
|
|
wb_cyc_i <= '0';
|
367 |
|
|
wb_stb_i <= '0';
|
368 |
|
|
end if;
|
369 |
|
|
end if;
|
370 |
|
|
end if;
|
371 |
|
|
|
372 |
|
|
if (WaitACK = '0') then
|
373 |
|
|
case State is
|
374 |
|
|
when 0 => --single word write as a EOB cycle
|
375 |
|
|
wb_adr_i2 := x"1234"; wb_we_i <= '1'; wb_tga_i <= '0'; wb_cti_i <= "111";
|
376 |
|
|
wb_sel_i <= "1111"; wb_dat_i <= x"123456789"; ack_count := 0;
|
377 |
|
|
WaitACK := '1'; State := State + 1;
|
378 |
|
|
when 1 => --single word read as a classic cycle
|
379 |
|
|
wb_adr_i2 := x"ABCD"; wb_we_i <= '0'; wb_tga_i <= '0'; wb_cti_i <= "000"; --classic cycle
|
380 |
|
|
WaitACK := '1'; State := State + 1; ack_count := 0;
|
381 |
|
|
when 2 => --single half-word write as a classic cycle
|
382 |
|
|
wb_adr_i2 := x"4321"; wb_we_i <= '1'; wb_tga_i <= '0'; wb_cti_i <= "000"; --classic cycle
|
383 |
|
|
wb_sel_i <= "0011"; wb_dat_i <= x"987654321";
|
384 |
|
|
WaitACK := '1'; State := State + 1; ack_count := 0;
|
385 |
|
|
when 3 => --single word read as a EOB cycle
|
386 |
|
|
wb_adr_i2 := x"DCBA"; wb_we_i <= '0'; wb_tga_i <= '0'; wb_cti_i <= "111";
|
387 |
|
|
WaitACK := '1'; State := State + 1; ack_count := 0;
|
388 |
|
|
when 4 => --1 burst write
|
389 |
|
|
wb_adr_i2 := x"4567"; wb_we_i <= '1'; wb_tga_i <= '0'; wb_cti_i <= "010";
|
390 |
|
|
wb_sel_i <= "1111"; wb_dat_i <= wb_dat_o + 1;
|
391 |
|
|
WaitACK := '1'; State := State + 1; ack_count := 4;
|
392 |
|
|
when 5 => --3 bursts read --> first
|
393 |
|
|
wb_adr_i2 := x"90AB"; wb_we_i <= '0'; wb_tga_i <= '1'; wb_cti_i <= "010";
|
394 |
|
|
WaitACK := '1'; State := State + 1; ack_count := 4;
|
395 |
|
|
when 6 => --3 bursts read --> second
|
396 |
|
|
wb_adr_i2 := x"90AF"; wb_we_i <= '0'; wb_tga_i <= '1'; wb_cti_i <= "010";
|
397 |
|
|
WaitACK := '1'; State := State + 1; ack_count := 4;
|
398 |
|
|
when 7 => --3 bursts read --> third
|
399 |
|
|
wb_adr_i2 := x"90B3"; wb_we_i <= '0'; wb_tga_i <= '0'; wb_cti_i <= "010";
|
400 |
|
|
WaitACK := '1'; State := State + 1; ack_count := 4;
|
401 |
|
|
when others =>
|
402 |
|
|
if (State = 15) then report "NORMAL TB END." severity FAILURE; end if;
|
403 |
|
|
State := State + 1;
|
404 |
|
|
end case;
|
405 |
|
|
end if;
|
406 |
|
|
if (WaitACK = '1') then wb_cyc_i <= '1'; wb_stb_i <= '1'; end if;
|
407 |
|
|
wb_adr_i <= "00" & wb_adr_i2;
|
408 |
|
|
end if;
|
409 |
|
|
end process Control;
|
410 |
|
|
|
411 |
|
|
|
412 |
|
|
|
413 |
|
|
|
414 |
|
|
-- The following lines are to have a handy std_logic_vector to read and write data to ZBT
|
415 |
|
|
-- instead of having 72 individual signals on a wave window
|
416 |
|
|
|
417 |
|
|
---------------------------------
|
418 |
|
|
-- DATA OUT LINES
|
419 |
|
|
---------------------------------
|
420 |
|
|
SRAM_FLASH_D0 <= ZBT_OUT(0) when (SRAM_OE_B = '0') else 'Z';
|
421 |
|
|
SRAM_FLASH_D1 <= ZBT_OUT(1) when (SRAM_OE_B = '0') else 'Z';
|
422 |
|
|
SRAM_FLASH_D2 <= ZBT_OUT(2) when (SRAM_OE_B = '0') else 'Z';
|
423 |
|
|
SRAM_FLASH_D3 <= ZBT_OUT(3) when (SRAM_OE_B = '0') else 'Z';
|
424 |
|
|
SRAM_FLASH_D4 <= ZBT_OUT(4) when (SRAM_OE_B = '0') else 'Z';
|
425 |
|
|
SRAM_FLASH_D5 <= ZBT_OUT(5) when (SRAM_OE_B = '0') else 'Z';
|
426 |
|
|
SRAM_FLASH_D6 <= ZBT_OUT(6) when (SRAM_OE_B = '0') else 'Z';
|
427 |
|
|
SRAM_FLASH_D7 <= ZBT_OUT(7) when (SRAM_OE_B = '0') else 'Z';
|
428 |
|
|
SRAM_FLASH_D8 <= ZBT_OUT(8) when (SRAM_OE_B = '0') else 'Z';
|
429 |
|
|
SRAM_FLASH_D9 <= ZBT_OUT(9) when (SRAM_OE_B = '0') else 'Z';
|
430 |
|
|
SRAM_FLASH_D10 <= ZBT_OUT(10) when (SRAM_OE_B = '0') else 'Z';
|
431 |
|
|
SRAM_FLASH_D11 <= ZBT_OUT(11) when (SRAM_OE_B = '0') else 'Z';
|
432 |
|
|
SRAM_FLASH_D12 <= ZBT_OUT(12) when (SRAM_OE_B = '0') else 'Z';
|
433 |
|
|
SRAM_FLASH_D13 <= ZBT_OUT(13) when (SRAM_OE_B = '0') else 'Z';
|
434 |
|
|
SRAM_FLASH_D14 <= ZBT_OUT(14) when (SRAM_OE_B = '0') else 'Z';
|
435 |
|
|
SRAM_FLASH_D15 <= ZBT_OUT(15) when (SRAM_OE_B = '0') else 'Z';
|
436 |
|
|
SRAM_D16 <= ZBT_OUT(16) when (SRAM_OE_B = '0') else 'Z';
|
437 |
|
|
SRAM_D17 <= ZBT_OUT(17) when (SRAM_OE_B = '0') else 'Z';
|
438 |
|
|
SRAM_D18 <= ZBT_OUT(18) when (SRAM_OE_B = '0') else 'Z';
|
439 |
|
|
SRAM_D19 <= ZBT_OUT(19) when (SRAM_OE_B = '0') else 'Z';
|
440 |
|
|
SRAM_D20 <= ZBT_OUT(20) when (SRAM_OE_B = '0') else 'Z';
|
441 |
|
|
SRAM_D21 <= ZBT_OUT(21) when (SRAM_OE_B = '0') else 'Z';
|
442 |
|
|
SRAM_D22 <= ZBT_OUT(22) when (SRAM_OE_B = '0') else 'Z';
|
443 |
|
|
SRAM_D23 <= ZBT_OUT(23) when (SRAM_OE_B = '0') else 'Z';
|
444 |
|
|
SRAM_D24 <= ZBT_OUT(24) when (SRAM_OE_B = '0') else 'Z';
|
445 |
|
|
SRAM_D25 <= ZBT_OUT(25) when (SRAM_OE_B = '0') else 'Z';
|
446 |
|
|
SRAM_D26 <= ZBT_OUT(26) when (SRAM_OE_B = '0') else 'Z';
|
447 |
|
|
SRAM_D27 <= ZBT_OUT(27) when (SRAM_OE_B = '0') else 'Z';
|
448 |
|
|
SRAM_D28 <= ZBT_OUT(28) when (SRAM_OE_B = '0') else 'Z';
|
449 |
|
|
SRAM_D29 <= ZBT_OUT(29) when (SRAM_OE_B = '0') else 'Z';
|
450 |
|
|
SRAM_D30 <= ZBT_OUT(30) when (SRAM_OE_B = '0') else 'Z';
|
451 |
|
|
SRAM_D31 <= ZBT_OUT(31) when (SRAM_OE_B = '0') else 'Z';
|
452 |
|
|
SRAM_DQP0 <= ZBT_OUT(32) when (SRAM_OE_B = '0') else 'Z';
|
453 |
|
|
SRAM_DQP1 <= ZBT_OUT(33) when (SRAM_OE_B = '0') else 'Z';
|
454 |
|
|
SRAM_DQP2 <= ZBT_OUT(34) when (SRAM_OE_B = '0') else 'Z';
|
455 |
|
|
SRAM_DQP3 <= ZBT_OUT(35) when (SRAM_OE_B = '0') else 'Z';
|
456 |
|
|
|
457 |
|
|
|
458 |
|
|
---------------------------------
|
459 |
|
|
-- DATA IN LINES
|
460 |
|
|
---------------------------------
|
461 |
|
|
ZBT_IN(0) <= SRAM_FLASH_D0;
|
462 |
|
|
ZBT_IN(1) <= SRAM_FLASH_D1;
|
463 |
|
|
ZBT_IN(2) <= SRAM_FLASH_D2;
|
464 |
|
|
ZBT_IN(3) <= SRAM_FLASH_D3;
|
465 |
|
|
ZBT_IN(4) <= SRAM_FLASH_D4;
|
466 |
|
|
ZBT_IN(5) <= SRAM_FLASH_D5;
|
467 |
|
|
ZBT_IN(6) <= SRAM_FLASH_D6;
|
468 |
|
|
ZBT_IN(7) <= SRAM_FLASH_D7;
|
469 |
|
|
ZBT_IN(8) <= SRAM_FLASH_D8;
|
470 |
|
|
ZBT_IN(9) <= SRAM_FLASH_D9;
|
471 |
|
|
ZBT_IN(10) <= SRAM_FLASH_D10;
|
472 |
|
|
ZBT_IN(11) <= SRAM_FLASH_D11;
|
473 |
|
|
ZBT_IN(12) <= SRAM_FLASH_D12;
|
474 |
|
|
ZBT_IN(13) <= SRAM_FLASH_D13;
|
475 |
|
|
ZBT_IN(14) <= SRAM_FLASH_D14;
|
476 |
|
|
ZBT_IN(15) <= SRAM_FLASH_D15;
|
477 |
|
|
ZBT_IN(16) <= SRAM_D16;
|
478 |
|
|
ZBT_IN(17) <= SRAM_D17;
|
479 |
|
|
ZBT_IN(18) <= SRAM_D18;
|
480 |
|
|
ZBT_IN(19) <= SRAM_D19;
|
481 |
|
|
ZBT_IN(20) <= SRAM_D20;
|
482 |
|
|
ZBT_IN(21) <= SRAM_D21;
|
483 |
|
|
ZBT_IN(22) <= SRAM_D22;
|
484 |
|
|
ZBT_IN(23) <= SRAM_D23;
|
485 |
|
|
ZBT_IN(24) <= SRAM_D24;
|
486 |
|
|
ZBT_IN(25) <= SRAM_D25;
|
487 |
|
|
ZBT_IN(26) <= SRAM_D26;
|
488 |
|
|
ZBT_IN(27) <= SRAM_D27;
|
489 |
|
|
ZBT_IN(28) <= SRAM_D28;
|
490 |
|
|
ZBT_IN(29) <= SRAM_D29;
|
491 |
|
|
ZBT_IN(30) <= SRAM_D30;
|
492 |
|
|
ZBT_IN(31) <= SRAM_D31;
|
493 |
|
|
ZBT_IN(32) <= SRAM_DQP0;
|
494 |
|
|
ZBT_IN(33) <= SRAM_DQP1;
|
495 |
|
|
ZBT_IN(34) <= SRAM_DQP2;
|
496 |
|
|
ZBT_IN(35) <= SRAM_DQP3;
|
497 |
|
|
|
498 |
|
|
|
499 |
|
|
|
500 |
|
|
---------------------------------
|
501 |
|
|
-- ADDRESS LINES
|
502 |
|
|
---------------------------------
|
503 |
|
|
ZBT_ADDR(0) <= SRAM_FLASH_A1;
|
504 |
|
|
ZBT_ADDR(1) <= SRAM_FLASH_A2;
|
505 |
|
|
ZBT_ADDR(2) <= SRAM_FLASH_A3;
|
506 |
|
|
ZBT_ADDR(3) <= SRAM_FLASH_A4;
|
507 |
|
|
ZBT_ADDR(4) <= SRAM_FLASH_A5;
|
508 |
|
|
ZBT_ADDR(5) <= SRAM_FLASH_A6;
|
509 |
|
|
ZBT_ADDR(6) <= SRAM_FLASH_A7;
|
510 |
|
|
ZBT_ADDR(7) <= SRAM_FLASH_A8;
|
511 |
|
|
ZBT_ADDR(8) <= SRAM_FLASH_A9;
|
512 |
|
|
ZBT_ADDR(9) <= SRAM_FLASH_A10;
|
513 |
|
|
ZBT_ADDR(10) <= SRAM_FLASH_A11;
|
514 |
|
|
ZBT_ADDR(11) <= SRAM_FLASH_A12;
|
515 |
|
|
ZBT_ADDR(12) <= SRAM_FLASH_A13;
|
516 |
|
|
ZBT_ADDR(13) <= SRAM_FLASH_A14;
|
517 |
|
|
ZBT_ADDR(14) <= SRAM_FLASH_A15;
|
518 |
|
|
ZBT_ADDR(15) <= SRAM_FLASH_A16;
|
519 |
|
|
ZBT_ADDR(16) <= SRAM_FLASH_A17;
|
520 |
|
|
ZBT_ADDR(17) <= SRAM_FLASH_A18;
|
521 |
|
|
END;
|