1 |
42 |
magro732 |
-------------------------------------------------------------------------------
|
2 |
|
|
--
|
3 |
|
|
-- RapidIO IP Library Core
|
4 |
|
|
--
|
5 |
|
|
-- This file is part of the RapidIO IP library project
|
6 |
|
|
-- http://www.opencores.org/cores/rio/
|
7 |
|
|
--
|
8 |
|
|
-- Description
|
9 |
|
|
-- Contains automatic test code to verify a RioWbBridge implementation.
|
10 |
|
|
--
|
11 |
|
|
-- To Do:
|
12 |
47 |
magro732 |
-- - Move the testport package and entities to a seperate file.
|
13 |
|
|
-- - Add testcases to NWRITE to cover all possible access lengths, not just the
|
14 |
|
|
-- maximum as presently.
|
15 |
42 |
magro732 |
--
|
16 |
|
|
-- Author(s):
|
17 |
|
|
-- - Magnus Rosenius, magro732@opencores.org
|
18 |
|
|
--
|
19 |
|
|
-------------------------------------------------------------------------------
|
20 |
|
|
--
|
21 |
|
|
-- Copyright (C) 2013 Authors and OPENCORES.ORG
|
22 |
|
|
--
|
23 |
|
|
-- This source file may be used and distributed without
|
24 |
|
|
-- restriction provided that this copyright statement is not
|
25 |
|
|
-- removed from the file and that any derivative work contains
|
26 |
|
|
-- the original copyright notice and the associated disclaimer.
|
27 |
|
|
--
|
28 |
|
|
-- This source file is free software; you can redistribute it
|
29 |
|
|
-- and/or modify it under the terms of the GNU Lesser General
|
30 |
|
|
-- Public License as published by the Free Software Foundation;
|
31 |
|
|
-- either version 2.1 of the License, or (at your option) any
|
32 |
|
|
-- later version.
|
33 |
|
|
--
|
34 |
|
|
-- This source is distributed in the hope that it will be
|
35 |
|
|
-- useful, but WITHOUT ANY WARRANTY; without even the implied
|
36 |
|
|
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
37 |
|
|
-- PURPOSE. See the GNU Lesser General Public License for more
|
38 |
|
|
-- details.
|
39 |
|
|
--
|
40 |
|
|
-- You should have received a copy of the GNU Lesser General
|
41 |
|
|
-- Public License along with this source; if not, download it
|
42 |
|
|
-- from http://www.opencores.org/lgpl.shtml
|
43 |
|
|
--
|
44 |
|
|
-------------------------------------------------------------------------------
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
-------------------------------------------------------------------------------
|
48 |
|
|
-- TestRioWbBridge.
|
49 |
|
|
-------------------------------------------------------------------------------
|
50 |
|
|
|
51 |
|
|
library ieee;
|
52 |
|
|
use ieee.std_logic_1164.all;
|
53 |
|
|
use ieee.numeric_std.all;
|
54 |
|
|
use ieee.math_real.all;
|
55 |
|
|
library std;
|
56 |
|
|
use std.textio.all;
|
57 |
|
|
use work.rio_common.all;
|
58 |
|
|
use work.TestPortPackage.all;
|
59 |
|
|
|
60 |
|
|
|
61 |
|
|
-------------------------------------------------------------------------------
|
62 |
|
|
-- Entity for TestRioWbBridge.
|
63 |
|
|
-------------------------------------------------------------------------------
|
64 |
|
|
entity TestRioWbBridge is
|
65 |
|
|
end entity;
|
66 |
|
|
|
67 |
|
|
|
68 |
|
|
-------------------------------------------------------------------------------
|
69 |
|
|
-- Architecture for TestRioWbBridge.
|
70 |
|
|
-------------------------------------------------------------------------------
|
71 |
|
|
architecture TestRioWbBridgeImpl of TestRioWbBridge is
|
72 |
|
|
|
73 |
|
|
component RioWbBridge is
|
74 |
|
|
generic(
|
75 |
|
|
EXTENDED_ADDRESS : natural range 0 to 2 := 0;
|
76 |
|
|
DEVICE_IDENTITY : std_logic_vector(15 downto 0);
|
77 |
|
|
DEVICE_VENDOR_IDENTITY : std_logic_vector(15 downto 0);
|
78 |
|
|
DEVICE_REV : std_logic_vector(31 downto 0);
|
79 |
|
|
ASSY_IDENTITY : std_logic_vector(15 downto 0);
|
80 |
|
|
ASSY_VENDOR_IDENTITY : std_logic_vector(15 downto 0);
|
81 |
|
|
ASSY_REV : std_logic_vector(15 downto 0));
|
82 |
|
|
port(
|
83 |
|
|
clk : in std_logic;
|
84 |
|
|
areset_n : in std_logic;
|
85 |
44 |
magro732 |
enable : in std_logic;
|
86 |
42 |
magro732 |
|
87 |
|
|
readFrameEmpty_i : in std_logic;
|
88 |
|
|
readFrame_o : out std_logic;
|
89 |
|
|
readContent_o : out std_logic;
|
90 |
|
|
readContentEnd_i : in std_logic;
|
91 |
|
|
readContentData_i : in std_logic_vector(31 downto 0);
|
92 |
|
|
writeFrameFull_i : in std_logic;
|
93 |
|
|
writeFrame_o : out std_logic;
|
94 |
|
|
writeFrameAbort_o : out std_logic;
|
95 |
|
|
writeContent_o : out std_logic;
|
96 |
|
|
writeContentData_o : out std_logic_vector(31 downto 0);
|
97 |
|
|
|
98 |
|
|
cyc_o : out std_logic;
|
99 |
|
|
stb_o : out std_logic;
|
100 |
|
|
we_o : out std_logic;
|
101 |
|
|
adr_o : out std_logic_vector(16*EXTENDED_ADDRESS+30 downto 0);
|
102 |
|
|
sel_o : out std_logic_vector(7 downto 0);
|
103 |
|
|
dat_o : out std_logic_vector(63 downto 0);
|
104 |
|
|
dat_i : in std_logic_vector(63 downto 0);
|
105 |
|
|
err_i : in std_logic;
|
106 |
|
|
ack_i : in std_logic);
|
107 |
|
|
end component;
|
108 |
|
|
|
109 |
|
|
-----------------------------------------------------------------------------
|
110 |
|
|
--
|
111 |
|
|
-----------------------------------------------------------------------------
|
112 |
|
|
|
113 |
|
|
signal clk : std_logic;
|
114 |
|
|
signal areset_n : std_logic;
|
115 |
|
|
signal enable : std_logic;
|
116 |
|
|
|
117 |
|
|
signal writeFrameFull : std_logic;
|
118 |
|
|
signal writeFrame : std_logic;
|
119 |
|
|
signal writeFrameAbort : std_logic;
|
120 |
|
|
signal writeContent : std_logic;
|
121 |
|
|
signal writeContentData : std_logic_vector(31 downto 0);
|
122 |
|
|
|
123 |
|
|
signal readFrameEmpty : std_logic;
|
124 |
|
|
signal readFrame : std_logic;
|
125 |
|
|
signal readFrameRestart : std_logic;
|
126 |
|
|
signal readFrameAborted : std_logic;
|
127 |
|
|
signal readContentEmpty : std_logic;
|
128 |
|
|
signal readContent : std_logic;
|
129 |
|
|
signal readContentEnd : std_logic;
|
130 |
|
|
signal readContentData : std_logic_vector(31 downto 0);
|
131 |
|
|
|
132 |
|
|
signal wbCyc : std_logic;
|
133 |
|
|
signal wbStb : std_logic;
|
134 |
|
|
signal wbWe : std_logic;
|
135 |
|
|
signal wbAdr : std_logic_vector(30 downto 0);
|
136 |
|
|
signal wbSel : std_logic_vector(7 downto 0);
|
137 |
|
|
signal wbDatWrite : std_logic_vector(63 downto 0);
|
138 |
|
|
signal wbDatRead : std_logic_vector(63 downto 0);
|
139 |
|
|
signal wbAck : std_logic;
|
140 |
|
|
signal wbErr : std_logic;
|
141 |
|
|
|
142 |
|
|
signal outboundEmpty : std_logic;
|
143 |
|
|
signal outboundWrite : std_logic;
|
144 |
|
|
signal outboundMessage : TestPortMessagePacketBuffer;
|
145 |
|
|
signal outboundAck : std_logic;
|
146 |
|
|
|
147 |
|
|
signal inboundEmpty : std_logic;
|
148 |
|
|
signal inboundWrite : std_logic;
|
149 |
|
|
signal inboundMessage : TestPortMessagePacketBuffer;
|
150 |
|
|
signal inboundAck : std_logic;
|
151 |
|
|
|
152 |
|
|
signal wbMessageEmpty : std_logic;
|
153 |
|
|
signal wbMessageWrite : std_logic;
|
154 |
|
|
signal wbMessage : TestPortMessageWishbone;
|
155 |
|
|
signal wbMessageAck : std_logic;
|
156 |
|
|
|
157 |
|
|
begin
|
158 |
|
|
|
159 |
|
|
-----------------------------------------------------------------------------
|
160 |
|
|
-- Clock generation.
|
161 |
|
|
-----------------------------------------------------------------------------
|
162 |
|
|
ClockGenerator: process
|
163 |
|
|
begin
|
164 |
|
|
clk <= '0';
|
165 |
|
|
wait for 20 ns;
|
166 |
|
|
clk <= '1';
|
167 |
|
|
wait for 20 ns;
|
168 |
|
|
end process;
|
169 |
|
|
|
170 |
|
|
|
171 |
|
|
-----------------------------------------------------------------------------
|
172 |
|
|
-- Serial port emulator.
|
173 |
|
|
-----------------------------------------------------------------------------
|
174 |
|
|
TestDriver: process
|
175 |
|
|
|
176 |
|
|
-----------------------------------------------------------------------------
|
177 |
|
|
-- Procedures to handle outbound and inbound packets.
|
178 |
|
|
-----------------------------------------------------------------------------
|
179 |
|
|
procedure OutboundFrame(constant frame : in RioFrame) is
|
180 |
|
|
begin
|
181 |
|
|
TestPortPacketBufferWrite(outboundWrite, outboundMessage, outboundAck,
|
182 |
|
|
frame, false);
|
183 |
|
|
end procedure;
|
184 |
|
|
|
185 |
|
|
procedure InboundFrame(constant frame : in RioFrame) is
|
186 |
|
|
begin
|
187 |
|
|
TestPortPacketBufferWrite(inboundWrite, inboundMessage, inboundAck,
|
188 |
|
|
frame, false);
|
189 |
|
|
end procedure;
|
190 |
|
|
|
191 |
|
|
---------------------------------------------------------------------------
|
192 |
|
|
-- Procedure to handle wishbone accesses.
|
193 |
|
|
---------------------------------------------------------------------------
|
194 |
|
|
procedure SetSlaveAccess(constant writeAccess : in boolean;
|
195 |
47 |
magro732 |
constant addressIn : in std_logic_vector(30 downto 0);
|
196 |
42 |
magro732 |
constant byteSelect : in std_logic_vector(7 downto 0);
|
197 |
47 |
magro732 |
constant length : in natural range 1 to 32;
|
198 |
|
|
constant dataIn : in DoublewordArray(0 to 31);
|
199 |
44 |
magro732 |
constant latency : natural := 1) is
|
200 |
47 |
magro732 |
variable address : std_logic_vector(ADDRESS_WIDTH_MAX-1 downto 0);
|
201 |
42 |
magro732 |
begin
|
202 |
47 |
magro732 |
address := x"00000000" & '0' & addressIn;
|
203 |
|
|
for i in 0 to length-1 loop
|
204 |
|
|
if (i = (length-1)) then
|
205 |
|
|
TestPortWishboneWrite(wbMessageWrite, wbMessage, wbMessageAck,
|
206 |
|
|
writeAccess, address, byteSelect, dataIn(i), false, latency);
|
207 |
|
|
else
|
208 |
|
|
TestPortWishboneWrite(wbMessageWrite, wbMessage, wbMessageAck,
|
209 |
|
|
writeAccess, address, byteSelect, dataIn(i), true, latency);
|
210 |
|
|
address := std_logic_vector(unsigned(address)+1);
|
211 |
|
|
end if;
|
212 |
|
|
end loop;
|
213 |
42 |
magro732 |
end procedure;
|
214 |
44 |
magro732 |
|
215 |
|
|
---------------------------------------------------------------------------
|
216 |
|
|
--
|
217 |
|
|
---------------------------------------------------------------------------
|
218 |
|
|
function getReadSize(constant rdsize : in std_logic_vector(3 downto 0);
|
219 |
|
|
constant wdptr : in std_logic) return natural is
|
220 |
|
|
begin
|
221 |
|
|
case rdsize is
|
222 |
|
|
when "0000" | "0001" | "0010" | "0011" =>
|
223 |
|
|
return 1;
|
224 |
|
|
when "0100" | "0110" =>
|
225 |
|
|
return 1;
|
226 |
|
|
when "0101" =>
|
227 |
|
|
return 1;
|
228 |
|
|
when "1000" =>
|
229 |
|
|
return 1;
|
230 |
|
|
when "0111" =>
|
231 |
|
|
return 1;
|
232 |
|
|
when "1001" =>
|
233 |
|
|
return 1;
|
234 |
|
|
when "1010" =>
|
235 |
|
|
return 1;
|
236 |
|
|
when "1011" =>
|
237 |
|
|
if (wdptr = '0') then
|
238 |
|
|
return 1;
|
239 |
|
|
else
|
240 |
|
|
return 2;
|
241 |
|
|
end if;
|
242 |
|
|
when "1100" =>
|
243 |
|
|
if (wdptr = '0') then
|
244 |
|
|
return 4;
|
245 |
|
|
else
|
246 |
|
|
return 8;
|
247 |
|
|
end if;
|
248 |
|
|
when "1101" =>
|
249 |
|
|
if (wdptr = '0') then
|
250 |
|
|
return 12;
|
251 |
|
|
else
|
252 |
|
|
return 16;
|
253 |
|
|
end if;
|
254 |
|
|
when "1110" =>
|
255 |
|
|
if (wdptr = '0') then
|
256 |
|
|
return 20;
|
257 |
|
|
else
|
258 |
|
|
return 24;
|
259 |
|
|
end if;
|
260 |
|
|
when "1111" =>
|
261 |
|
|
if (wdptr = '0') then
|
262 |
|
|
return 28;
|
263 |
|
|
else
|
264 |
|
|
return 32;
|
265 |
|
|
end if;
|
266 |
|
|
when others =>
|
267 |
|
|
return 0;
|
268 |
|
|
end case;
|
269 |
|
|
end function;
|
270 |
42 |
magro732 |
|
271 |
44 |
magro732 |
function getReadMask(constant rdsize : in std_logic_vector(3 downto 0);
|
272 |
|
|
constant wdptr : in std_logic) return std_logic_vector is
|
273 |
|
|
begin
|
274 |
|
|
case rdsize is
|
275 |
|
|
when "0000" =>
|
276 |
|
|
if (wdptr = '0') then
|
277 |
|
|
return "10000000";
|
278 |
|
|
else
|
279 |
|
|
return "00001000";
|
280 |
|
|
end if;
|
281 |
|
|
when "0001" =>
|
282 |
|
|
if (wdptr = '0') then
|
283 |
|
|
return "01000000";
|
284 |
|
|
else
|
285 |
|
|
return "00000100";
|
286 |
|
|
end if;
|
287 |
|
|
when "0010" =>
|
288 |
|
|
if (wdptr = '0') then
|
289 |
|
|
return "00100000";
|
290 |
|
|
else
|
291 |
|
|
return "00000010";
|
292 |
|
|
end if;
|
293 |
|
|
when "0011" =>
|
294 |
|
|
if (wdptr = '0') then
|
295 |
|
|
return "00010000";
|
296 |
|
|
else
|
297 |
|
|
return "00000001";
|
298 |
|
|
end if;
|
299 |
|
|
when "0100" =>
|
300 |
|
|
if (wdptr = '0') then
|
301 |
|
|
return "11000000";
|
302 |
|
|
else
|
303 |
|
|
return "00001100";
|
304 |
|
|
end if;
|
305 |
|
|
when "0110" =>
|
306 |
|
|
if (wdptr = '0') then
|
307 |
|
|
return "00110000";
|
308 |
|
|
else
|
309 |
|
|
return "00000011";
|
310 |
|
|
end if;
|
311 |
|
|
when "0101" =>
|
312 |
|
|
if (wdptr = '0') then
|
313 |
|
|
return "11100000";
|
314 |
|
|
else
|
315 |
|
|
return "00000111";
|
316 |
|
|
end if;
|
317 |
|
|
when "1000" =>
|
318 |
|
|
if (wdptr = '0') then
|
319 |
|
|
return "11110000";
|
320 |
|
|
else
|
321 |
|
|
return "00001111";
|
322 |
|
|
end if;
|
323 |
|
|
when "0111" =>
|
324 |
|
|
if (wdptr = '0') then
|
325 |
|
|
return "11111000";
|
326 |
|
|
else
|
327 |
|
|
return "00011111";
|
328 |
|
|
end if;
|
329 |
|
|
when "1001" =>
|
330 |
|
|
if (wdptr = '0') then
|
331 |
|
|
return "11111100";
|
332 |
|
|
else
|
333 |
|
|
return "00111111";
|
334 |
|
|
end if;
|
335 |
|
|
when "1010" =>
|
336 |
|
|
if (wdptr = '0') then
|
337 |
|
|
return "11111110";
|
338 |
|
|
else
|
339 |
|
|
return "01111111";
|
340 |
|
|
end if;
|
341 |
|
|
when others =>
|
342 |
|
|
return "11111111";
|
343 |
|
|
end case;
|
344 |
|
|
end function;
|
345 |
42 |
magro732 |
|
346 |
|
|
---------------------------------------------------------------------------
|
347 |
45 |
magro732 |
-- Local variables.
|
348 |
42 |
magro732 |
---------------------------------------------------------------------------
|
349 |
|
|
variable seed1 : positive := 1;
|
350 |
|
|
variable seed2: positive := 1;
|
351 |
|
|
|
352 |
44 |
magro732 |
variable rdsize : std_logic_vector(3 downto 0);
|
353 |
45 |
magro732 |
variable wrsize : std_logic_vector(3 downto 0);
|
354 |
44 |
magro732 |
variable wdptr : std_logic;
|
355 |
45 |
magro732 |
variable maintData : DoubleWordArray(0 to 7);
|
356 |
42 |
magro732 |
variable ioData : DoubleWordArray(0 to 31);
|
357 |
|
|
variable frame : RioFrame;
|
358 |
|
|
|
359 |
|
|
begin
|
360 |
|
|
areset_n <= '0';
|
361 |
44 |
magro732 |
enable <= '1';
|
362 |
42 |
magro732 |
|
363 |
44 |
magro732 |
inboundWrite <= '0';
|
364 |
|
|
outboundWrite <= '0';
|
365 |
|
|
wbMessageWrite <= '0';
|
366 |
|
|
|
367 |
42 |
magro732 |
writeFrameFull <= '0';
|
368 |
|
|
|
369 |
|
|
wait until clk'event and clk = '1';
|
370 |
|
|
wait until clk'event and clk = '1';
|
371 |
|
|
areset_n <= '1';
|
372 |
|
|
wait until clk'event and clk = '1';
|
373 |
|
|
wait until clk'event and clk = '1';
|
374 |
|
|
|
375 |
|
|
---------------------------------------------------------------------------
|
376 |
|
|
PrintS("-----------------------------------------------------------------");
|
377 |
44 |
magro732 |
PrintS("TG_RioWbBridge");
|
378 |
42 |
magro732 |
PrintS("-----------------------------------------------------------------");
|
379 |
44 |
magro732 |
PrintS("TG_RioWbBridge-TC1");
|
380 |
|
|
PrintS("Description: Test maintenance requests.");
|
381 |
42 |
magro732 |
PrintS("Requirement: XXXXX");
|
382 |
|
|
PrintS("-----------------------------------------------------------------");
|
383 |
|
|
PrintS("Step 1:");
|
384 |
|
|
PrintS("Action: Send maintenance read request for one word on even offset.");
|
385 |
|
|
PrintS("Result: Check the accesses on the external configuration port.");
|
386 |
|
|
PrintS("-----------------------------------------------------------------");
|
387 |
|
|
---------------------------------------------------------------------------
|
388 |
44 |
magro732 |
PrintR("TG_RioWbBridge-TC1-Step1");
|
389 |
42 |
magro732 |
---------------------------------------------------------------------------
|
390 |
45 |
magro732 |
|
391 |
|
|
InboundFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
|
392 |
|
|
tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
|
393 |
|
|
sourceId=>x"dead", destId=>x"beef",
|
394 |
|
|
payload=>RioMaintenance(transaction=>"0000",
|
395 |
|
|
size=>"1000",
|
396 |
|
|
tid=>x"aa",
|
397 |
|
|
hopCount=>x"ff",
|
398 |
|
|
configOffset=>"000000000000000000000",
|
399 |
|
|
wdptr=>'0',
|
400 |
|
|
dataLength=>0,
|
401 |
|
|
data=>maintData)));
|
402 |
|
|
|
403 |
|
|
maintData(0) := x"deadbeef00000000";
|
404 |
|
|
OutboundFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
|
405 |
|
|
tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
|
406 |
|
|
sourceId=>x"beef", destId=>x"dead",
|
407 |
|
|
payload=>RioMaintenance(transaction=>"0010",
|
408 |
|
|
size=>"0000",
|
409 |
|
|
tid=>x"aa",
|
410 |
|
|
hopCount=>x"ff",
|
411 |
|
|
configOffset=>"000000000000000000000",
|
412 |
|
|
wdptr=>'0',
|
413 |
|
|
dataLength=>1,
|
414 |
|
|
data=>maintData)));
|
415 |
42 |
magro732 |
|
416 |
45 |
magro732 |
TestWait(inboundEmpty, '1', "inbound frame");
|
417 |
|
|
TestWait(outboundEmpty, '1', "outbound frame");
|
418 |
|
|
|
419 |
44 |
magro732 |
---------------------------------------------------------------------------
|
420 |
|
|
PrintS("-----------------------------------------------------------------");
|
421 |
|
|
PrintS("TG_RioWbBridge-TC2");
|
422 |
|
|
PrintS("Description: Test request class packets.");
|
423 |
|
|
PrintS("Requirement: XXXXX");
|
424 |
|
|
PrintS("-----------------------------------------------------------------");
|
425 |
|
|
PrintS("Step 1:");
|
426 |
45 |
magro732 |
PrintS("Action: Send request class NREAD packets for all sizes.");
|
427 |
|
|
PrintS("Result: The Wishbone access should match the inbound packet.");
|
428 |
44 |
magro732 |
PrintS("-----------------------------------------------------------------");
|
429 |
|
|
---------------------------------------------------------------------------
|
430 |
|
|
PrintR("TG_RioWbBridge-TC2-Step1");
|
431 |
|
|
---------------------------------------------------------------------------
|
432 |
45 |
magro732 |
-- REMARK: Change the address and tid also...
|
433 |
44 |
magro732 |
for i in 0 to 15 loop
|
434 |
|
|
for j in 0 to 1 loop
|
435 |
|
|
rdsize := std_logic_vector(to_unsigned(i, 4));
|
436 |
|
|
if (j = 0) then
|
437 |
|
|
wdptr := '0';
|
438 |
|
|
else
|
439 |
47 |
magro732 |
wdptr := '1';
|
440 |
44 |
magro732 |
end if;
|
441 |
|
|
|
442 |
|
|
CreateRandomPayload(ioData, seed1, seed2);
|
443 |
42 |
magro732 |
|
444 |
44 |
magro732 |
InboundFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
|
445 |
|
|
tt=>"01", ftype=>FTYPE_REQUEST_CLASS,
|
446 |
|
|
sourceId=>x"dead", destId=>x"beef",
|
447 |
|
|
payload=>RioNread(rdsize=>rdsize,
|
448 |
42 |
magro732 |
tid=>x"aa",
|
449 |
44 |
magro732 |
address=>"00000000000000000000000000000",
|
450 |
|
|
wdptr=>wdptr,
|
451 |
|
|
xamsbs=>"00")));
|
452 |
42 |
magro732 |
|
453 |
44 |
magro732 |
OutboundFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
|
454 |
|
|
tt=>"01", ftype=>FTYPE_RESPONSE_CLASS,
|
455 |
|
|
sourceId=>x"beef", destId=>x"dead",
|
456 |
|
|
payload=>RioResponse(status=>"0000",
|
457 |
|
|
tid=>x"aa",
|
458 |
|
|
dataLength=>getReadSize(rdsize, wdptr),
|
459 |
|
|
data=>ioData)));
|
460 |
42 |
magro732 |
|
461 |
44 |
magro732 |
SetSlaveAccess(false, "0000000000000000000000000000000",
|
462 |
|
|
getReadMask(rdsize, wdptr),
|
463 |
|
|
getReadSize(rdsize, wdptr),
|
464 |
|
|
ioData);
|
465 |
|
|
|
466 |
|
|
TestWait(inboundEmpty, '1', "inbound frame");
|
467 |
|
|
TestWait(outboundEmpty, '1', "outbound frame");
|
468 |
|
|
TestWait(wbMessageEmpty, '1', "wishbone access");
|
469 |
|
|
end loop;
|
470 |
|
|
end loop;
|
471 |
42 |
magro732 |
|
472 |
|
|
---------------------------------------------------------------------------
|
473 |
45 |
magro732 |
PrintS("-----------------------------------------------------------------");
|
474 |
|
|
PrintS("TG_RioWbBridge-TC3");
|
475 |
|
|
PrintS("Description: Test write class packets.");
|
476 |
|
|
PrintS("Requirement: XXXXX");
|
477 |
|
|
PrintS("-----------------------------------------------------------------");
|
478 |
|
|
PrintS("Step 1:");
|
479 |
|
|
PrintS("Action: Send write class NWRITER packets for all sizes.");
|
480 |
|
|
PrintS("Result: The Wishbone access should match the inbound packet and a ");
|
481 |
|
|
PrintS(" response should be sent.");
|
482 |
|
|
PrintS("-----------------------------------------------------------------");
|
483 |
|
|
---------------------------------------------------------------------------
|
484 |
|
|
PrintR("TG_RioWbBridge-TC3-Step1");
|
485 |
|
|
---------------------------------------------------------------------------
|
486 |
|
|
-- REMARK: Change the address and tid also...
|
487 |
47 |
magro732 |
-- REMARK: Not really all sizes, add sizes in between the fixed as well.
|
488 |
45 |
magro732 |
for i in 0 to 15 loop
|
489 |
|
|
for j in 0 to 1 loop
|
490 |
|
|
wrsize := std_logic_vector(to_unsigned(i, 4));
|
491 |
|
|
if (j = 0) then
|
492 |
|
|
wdptr := '0';
|
493 |
|
|
else
|
494 |
47 |
magro732 |
wdptr := '1';
|
495 |
45 |
magro732 |
end if;
|
496 |
|
|
|
497 |
|
|
CreateRandomPayload(ioData, seed1, seed2);
|
498 |
|
|
|
499 |
|
|
InboundFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
|
500 |
|
|
tt=>"01", ftype=>FTYPE_WRITE_CLASS,
|
501 |
|
|
sourceId=>x"dead", destId=>x"beef",
|
502 |
|
|
payload=>RioNwriteR(wrsize=>wrsize,
|
503 |
|
|
tid=>x"aa",
|
504 |
|
|
address=>"00000000000000000000000000000",
|
505 |
|
|
wdptr=>wdptr,
|
506 |
|
|
xamsbs=>"00",
|
507 |
|
|
dataLength=>getReadSize(wrsize, wdptr),
|
508 |
|
|
data=>ioData)));
|
509 |
|
|
|
510 |
|
|
OutboundFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
|
511 |
|
|
tt=>"01", ftype=>FTYPE_RESPONSE_CLASS,
|
512 |
|
|
sourceId=>x"beef", destId=>x"dead",
|
513 |
|
|
payload=>RioResponse(status=>"0000",
|
514 |
|
|
tid=>x"aa",
|
515 |
|
|
dataLength=>0,
|
516 |
|
|
data=>ioData)));
|
517 |
|
|
|
518 |
|
|
SetSlaveAccess(true, "0000000000000000000000000000000",
|
519 |
|
|
getReadMask(wrsize, wdptr),
|
520 |
|
|
getReadSize(wrsize, wdptr),
|
521 |
|
|
ioData);
|
522 |
|
|
|
523 |
|
|
TestWait(inboundEmpty, '1', "inbound frame");
|
524 |
|
|
TestWait(outboundEmpty, '1', "outbound frame");
|
525 |
|
|
TestWait(wbMessageEmpty, '1', "wishbone access");
|
526 |
|
|
end loop;
|
527 |
|
|
end loop;
|
528 |
|
|
|
529 |
|
|
---------------------------------------------------------------------------
|
530 |
|
|
PrintS("-----------------------------------------------------------------");
|
531 |
|
|
PrintS("Step 2:");
|
532 |
|
|
PrintS("Action: Send write class NWRITE packets for all sizes.");
|
533 |
|
|
PrintS("Result: The Wishbone access should match the inbound packet.");
|
534 |
|
|
PrintS("-----------------------------------------------------------------");
|
535 |
|
|
---------------------------------------------------------------------------
|
536 |
|
|
PrintR("TG_RioWbBridge-TC3-Step2");
|
537 |
|
|
---------------------------------------------------------------------------
|
538 |
|
|
-- REMARK: Change the address and tid also...
|
539 |
|
|
for i in 0 to 15 loop
|
540 |
|
|
for j in 0 to 1 loop
|
541 |
|
|
wrsize := std_logic_vector(to_unsigned(i, 4));
|
542 |
|
|
if (j = 0) then
|
543 |
|
|
wdptr := '0';
|
544 |
|
|
else
|
545 |
|
|
wdptr:= '1';
|
546 |
|
|
end if;
|
547 |
|
|
|
548 |
|
|
CreateRandomPayload(ioData, seed1, seed2);
|
549 |
|
|
|
550 |
|
|
InboundFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
|
551 |
|
|
tt=>"01", ftype=>FTYPE_WRITE_CLASS,
|
552 |
|
|
sourceId=>x"dead", destId=>x"beef",
|
553 |
|
|
payload=>RioNwrite(wrsize=>wrsize,
|
554 |
|
|
address=>"00000000000000000000000000000",
|
555 |
|
|
wdptr=>wdptr,
|
556 |
|
|
xamsbs=>"00",
|
557 |
|
|
dataLength=>getReadSize(wrsize, wdptr),
|
558 |
|
|
data=>ioData)));
|
559 |
|
|
|
560 |
|
|
SetSlaveAccess(true, "0000000000000000000000000000000",
|
561 |
|
|
getReadMask(wrsize, wdptr),
|
562 |
|
|
getReadSize(wrsize, wdptr),
|
563 |
|
|
ioData);
|
564 |
|
|
|
565 |
|
|
TestWait(inboundEmpty, '1', "inbound frame");
|
566 |
|
|
TestWait(outboundEmpty, '1', "outbound frame");
|
567 |
|
|
TestWait(wbMessageEmpty, '1', "wishbone access");
|
568 |
|
|
end loop;
|
569 |
|
|
end loop;
|
570 |
|
|
|
571 |
|
|
---------------------------------------------------------------------------
|
572 |
42 |
magro732 |
-- Test completed.
|
573 |
|
|
---------------------------------------------------------------------------
|
574 |
|
|
|
575 |
|
|
TestEnd;
|
576 |
|
|
end process;
|
577 |
|
|
|
578 |
|
|
-----------------------------------------------------------------------------
|
579 |
|
|
-- Instantiate the test object.
|
580 |
|
|
-----------------------------------------------------------------------------
|
581 |
|
|
TestObject: RioWbBridge
|
582 |
|
|
generic map(
|
583 |
44 |
magro732 |
EXTENDED_ADDRESS=>0,
|
584 |
|
|
DEVICE_IDENTITY=>x"dead",
|
585 |
|
|
DEVICE_VENDOR_IDENTITY=>x"beef",
|
586 |
|
|
DEVICE_REV=>x"c0debabe",
|
587 |
|
|
ASSY_IDENTITY=>x"1111",
|
588 |
|
|
ASSY_VENDOR_IDENTITY=>x"2222",
|
589 |
|
|
ASSY_REV=>x"3333")
|
590 |
42 |
magro732 |
port map(
|
591 |
|
|
clk=>clk,
|
592 |
44 |
magro732 |
areset_n=>areset_n,
|
593 |
|
|
enable=>enable,
|
594 |
42 |
magro732 |
readFrameEmpty_i=>readFrameEmpty,
|
595 |
|
|
readFrame_o=>readFrame,
|
596 |
|
|
readContent_o=>readContent,
|
597 |
|
|
readContentEnd_i=>readContentEnd,
|
598 |
|
|
readContentData_i=>readContentData,
|
599 |
|
|
writeFrameFull_i=>writeFrameFull,
|
600 |
|
|
writeFrame_o=>writeFrame,
|
601 |
|
|
writeFrameAbort_o=>writeFrameAbort,
|
602 |
|
|
writeContent_o=>writeContent,
|
603 |
|
|
writeContentData_o=>writeContentData,
|
604 |
|
|
cyc_o=>wbCyc,
|
605 |
|
|
stb_o=>wbStb,
|
606 |
|
|
we_o=>wbWe,
|
607 |
|
|
adr_o=>wbAdr,
|
608 |
|
|
sel_o=>wbSel,
|
609 |
|
|
dat_o=>wbDatWrite,
|
610 |
|
|
dat_i=>wbDatRead,
|
611 |
|
|
err_i=>wbErr,
|
612 |
|
|
ack_i=>wbAck);
|
613 |
|
|
|
614 |
|
|
-----------------------------------------------------------------------------
|
615 |
|
|
-- Instantiate the test ports.
|
616 |
|
|
-----------------------------------------------------------------------------
|
617 |
|
|
|
618 |
|
|
TestPortPacketBufferInst: TestPortPacketBuffer
|
619 |
47 |
magro732 |
generic map(READ_CONTENT_END_DATA_VALID=>false)
|
620 |
42 |
magro732 |
port map(
|
621 |
|
|
clk=>clk, areset_n=>areset_n,
|
622 |
44 |
magro732 |
readEmpty_o=>inboundEmpty,
|
623 |
|
|
readWrite_i=>inboundWrite,
|
624 |
|
|
readMessage_i=>inboundMessage,
|
625 |
|
|
readAck_o=>inboundAck,
|
626 |
|
|
writeEmpty_o=>outboundEmpty,
|
627 |
|
|
writeWrite_i=>outboundWrite,
|
628 |
|
|
writeMessage_i=>outboundMessage,
|
629 |
|
|
writeAck_o=>outboundAck,
|
630 |
42 |
magro732 |
readFrameEmpty_o=>readFrameEmpty,
|
631 |
|
|
readFrame_i=>readFrame,
|
632 |
44 |
magro732 |
readFrameRestart_i=>'0',
|
633 |
|
|
readFrameAborted_o=>readFrameAborted,
|
634 |
|
|
readWindowEmpty_o=>open,
|
635 |
|
|
readWindowReset_i=>'0',
|
636 |
|
|
readWindowNext_i=>readFrame,
|
637 |
42 |
magro732 |
readContentEmpty_o=>readContentEmpty,
|
638 |
|
|
readContent_i=>readContent,
|
639 |
|
|
readContentEnd_o=>readContentEnd,
|
640 |
|
|
readContentData_o=>readContentData,
|
641 |
|
|
writeFrame_i=>writeFrame,
|
642 |
|
|
writeFrameAbort_i=>writeFrameAbort,
|
643 |
|
|
writeContent_i=>writeContent,
|
644 |
|
|
writeContentData_i=>writeContentData);
|
645 |
|
|
|
646 |
|
|
TestPortWishboneInst: TestPortWishbone
|
647 |
|
|
port map(
|
648 |
|
|
clk=>clk,
|
649 |
|
|
areset_n=>areset_n,
|
650 |
|
|
messageEmpty_o=>wbMessageEmpty,
|
651 |
|
|
messageWrite_i=>wbMessageWrite,
|
652 |
|
|
message_i=>wbMessage,
|
653 |
|
|
messageAck_o=>wbMessageAck,
|
654 |
|
|
cyc_i=>wbCyc,
|
655 |
|
|
stb_i=>wbStb,
|
656 |
|
|
we_i=>wbWe,
|
657 |
|
|
adr_i=>wbAdr,
|
658 |
|
|
sel_i=>wbSel,
|
659 |
|
|
dat_i=>wbDatWrite,
|
660 |
|
|
dat_o=>wbDatRead,
|
661 |
|
|
err_o=>wbErr,
|
662 |
|
|
ack_o=>wbAck);
|
663 |
|
|
|
664 |
|
|
end architecture;
|