OpenCores
URL https://opencores.org/ocsvn/rio/rio/trunk

Subversion Repositories rio

[/] [rio/] [branches/] [2.0.0-development/] [bench/] [vhdl/] [TestRioLogicalCommon.vhd] - Blame information for rev 43

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 36 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 RioLogicalCommon implementation.
10
-- 
11
-- To Do:
12
-- -
13
-- 
14
-- Author(s): 
15
-- - Magnus Rosenius, magro732@opencores.org 
16
-- 
17
-------------------------------------------------------------------------------
18
-- 
19
-- Copyright (C) 2013 Authors and OPENCORES.ORG 
20
-- 
21
-- This source file may be used and distributed without 
22
-- restriction provided that this copyright statement is not 
23
-- removed from the file and that any derivative work contains 
24
-- the original copyright notice and the associated disclaimer. 
25
-- 
26
-- This source file is free software; you can redistribute it 
27
-- and/or modify it under the terms of the GNU Lesser General 
28
-- Public License as published by the Free Software Foundation; 
29
-- either version 2.1 of the License, or (at your option) any 
30
-- later version. 
31
-- 
32
-- This source is distributed in the hope that it will be 
33
-- useful, but WITHOUT ANY WARRANTY; without even the implied 
34
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
35
-- PURPOSE. See the GNU Lesser General Public License for more 
36
-- details. 
37
-- 
38
-- You should have received a copy of the GNU Lesser General 
39
-- Public License along with this source; if not, download it 
40
-- from http://www.opencores.org/lgpl.shtml 
41
-- 
42
-------------------------------------------------------------------------------
43
 
44
 
45
-------------------------------------------------------------------------------
46
-- TestRioLogicalCommon.
47
-------------------------------------------------------------------------------
48
 
49
library ieee;
50
use ieee.std_logic_1164.all;
51
use ieee.numeric_std.all;
52
use ieee.math_real.all;
53
library std;
54
use std.textio.all;
55
use work.rio_common.all;
56
 
57
 
58
-------------------------------------------------------------------------------
59
-- Entity for TestRioLogicalCommon.
60
-------------------------------------------------------------------------------
61
entity TestRioLogicalCommon is
62
end entity;
63
 
64
 
65
-------------------------------------------------------------------------------
66
-- Architecture for TestRioLogicalCommon.
67
-------------------------------------------------------------------------------
68
architecture TestRioLogicalCommonImpl of TestRioLogicalCommon is
69
 
70
  component RioLogicalCommon is
71
    port(
72
      clk : in std_logic;
73
      areset_n : in std_logic;
74
      enable : in std_logic;
75
 
76
      readFrameEmpty_i : in std_logic;
77
      readFrame_o : out std_logic;
78
      readContent_o : out std_logic;
79
      readContentEnd_i : in std_logic;
80
      readContentData_i : in std_logic_vector(31 downto 0);
81
      writeFrameFull_i : in std_logic;
82
      writeFrame_o : out std_logic;
83
      writeFrameAbort_o : out std_logic;
84
      writeContent_o : out std_logic;
85
      writeContentData_o : out std_logic_vector(31 downto 0);
86
 
87
      configStb_o : out std_logic;
88
      configWe_o : out std_logic;
89 38 magro732
      configAdr_o : out std_logic_vector(21 downto 0);
90
      configDat_o : out std_logic_vector(31 downto 0);
91
      configDat_i : in std_logic_vector(31 downto 0);
92 36 magro732
      configAck_i : in std_logic);
93
  end component;
94
 
95
  component TestPort is
96
    port(
97
      clk : in std_logic;
98
      areset_n : in std_logic;
99
 
100
      frameValid_i : in std_logic;
101
      frameWrite_i : in RioFrame;
102
      frameComplete_o : out std_logic;
103
 
104
      frameExpected_i : in std_logic;
105
      frameRead_i : in RioFrame;
106
      frameReceived_o : out std_logic;
107
 
108
      readFrameEmpty_o : out std_logic;
109
      readFrame_i : in std_logic;
110
      readFrameRestart_i : in std_logic;
111
      readFrameAborted_o : out std_logic;
112
      readContentEmpty_o : out std_logic;
113
      readContent_i : in std_logic;
114
      readContentEnd_o : out std_logic;
115
      readContentData_o : out std_logic_vector(31 downto 0);
116
      writeFrameFull_o : out std_logic;
117
      writeFrame_i : in std_logic;
118
      writeFrameAbort_i : in std_logic;
119
      writeContent_i : in std_logic;
120
      writeContentData_i : in std_logic_vector(31 downto 0));
121
  end component;
122
 
123
  signal clk : std_logic;
124
  signal areset_n : std_logic;
125
  signal enable : std_logic;
126
 
127
  signal frameValid : std_logic;
128
  signal frameWrite : RioFrame;
129
  signal frameComplete : std_logic;
130
 
131
  signal frameExpected : std_logic;
132
  signal frameRead : RioFrame;
133
  signal frameReceived : std_logic;
134
 
135
  signal writeFrameFull : std_logic;
136
  signal writeFrame : std_logic;
137
  signal writeFrameAbort : std_logic;
138
  signal writeContent : std_logic;
139
  signal writeContentData : std_logic_vector(31 downto 0);
140
 
141
  signal readFrameEmpty : std_logic;
142
  signal readFrame : std_logic;
143
  signal readFrameRestart : std_logic;
144
  signal readFrameAborted : std_logic;
145
  signal readContentEmpty : std_logic;
146
  signal readContent : std_logic;
147
  signal readContentEnd : std_logic;
148
  signal readContentData : std_logic_vector(31 downto 0);
149
 
150
  signal configStb, configStbExpected : std_logic;
151 38 magro732
  signal configWe : std_logic;
152
  signal configAddr : std_logic_vector(21 downto 0);
153
  signal configDataWrite : std_logic_vector(31 downto 0);
154
  signal configDataRead : std_logic_vector(31 downto 0);
155
  signal configAck : std_logic;
156 36 magro732
 
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
    -- 
178
    ---------------------------------------------------------------------------
179
    procedure SendFrame(constant frame : RioFrame) is
180
    begin
181
      frameValid <= '1';
182
      frameWrite <= frame;
183
      wait until frameComplete = '1';
184
      frameValid <= '0';
185
    end procedure;
186
 
187
    ---------------------------------------------------------------------------
188
    -- 
189
    ---------------------------------------------------------------------------
190
    procedure ReceiveFrame(constant frame : RioFrame) is
191
    begin
192
      frameExpected <= '1';
193
      frameRead <= frame;
194
      wait until frameReceived = '1';
195
      frameExpected <= '0';
196
    end procedure;
197
 
198
    variable seed1 : positive := 1;
199
    variable seed2: positive := 1;
200
 
201 38 magro732
    variable maintData : DoubleWordArray(0 to 7);
202 36 magro732
    variable frame : RioFrame;
203
 
204
  begin
205
    areset_n <= '0';
206
    enable <= '1';
207
 
208
    frameValid <= '0';
209
    frameExpected <= '0';
210 37 magro732
 
211 38 magro732
    configStbExpected <= '0';
212
    configAck <= '0';
213 36 magro732
 
214
    wait until clk'event and clk = '1';
215
    wait until clk'event and clk = '1';
216
    areset_n <= '1';
217
    wait until clk'event and clk = '1';
218
    wait until clk'event and clk = '1';
219
 
220
    ---------------------------------------------------------------------------
221
    PrintS("-----------------------------------------------------------------");
222
    PrintS("TG_RioLogicalCommon");
223
    PrintS("-----------------------------------------------------------------");
224
    PrintS("TG_RioLogicalCommon-TC1");
225 38 magro732
    PrintS("Description: Test maintenance read requests.");
226 36 magro732
    PrintS("Requirement: XXXXX");
227
    PrintS("-----------------------------------------------------------------");
228 38 magro732
    PrintS("Step 1:");
229
    PrintS("Action: Send maintenance read request for one word on even offset.");
230 36 magro732
    PrintS("Result: Check the accesses on the external configuration port.");
231 38 magro732
    PrintS("-----------------------------------------------------------------");
232 36 magro732
    ---------------------------------------------------------------------------
233
    PrintR("TG_RioLogicalCommon-TC1-Step1");
234
    ---------------------------------------------------------------------------
235 38 magro732
 
236
    SendFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
237
                             tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
238
                             sourceId=>x"dead", destId=>x"beef",
239
                             payload=>RioMaintenance(transaction=>"0000",
240
                                                     size=>"1000",
241
                                                     tid=>x"aa",
242
                                                     hopCount=>x"ff",
243
                                                     configOffset=>"000000000000000000000",
244
                                                     wdptr=>'0',
245
                                                     dataLength=>0,
246
                                                     data=>maintData)));
247 36 magro732
 
248 38 magro732
    wait until configStb = '1';
249 36 magro732
    configStbExpected <= '1';
250 38 magro732
    wait until clk = '1';
251
    assert configWe = '0';
252
    assert configAddr = "0000000000000000000000";
253
    wait until clk = '1';
254
    configDataRead <= x"deadbeef";
255
    configAck <= '1';
256
    wait until clk = '1';
257
    configAck <= '0';
258
    configStbExpected <= '0';
259
    maintData(0) := x"deadbeef00000000";
260 36 magro732
 
261 38 magro732
    ReceiveFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
262
                                tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
263
                                sourceId=>x"beef", destId=>x"dead",
264
                                payload=>RioMaintenance(transaction=>"0010",
265
                                                        size=>"0000",
266
                                                        tid=>x"aa",
267
                                                        hopCount=>x"ff",
268
                                                        configOffset=>"000000000000000000000",
269
                                                        wdptr=>'0',
270
                                                        dataLength=>1,
271
                                                        data=>maintData)));
272 36 magro732
 
273 38 magro732
 
274
    ---------------------------------------------------------------------------
275
    PrintS("-----------------------------------------------------------------");
276
    PrintS("Step 2:");
277
    PrintS("Action: Send maintenance read request for one word on odd offset.");
278
    PrintS("Result: Check the accesses on the external configuration port.");
279
    PrintS("-----------------------------------------------------------------");
280
    ---------------------------------------------------------------------------
281
    PrintR("TG_RioLogicalCommon-TC1-Step2");
282
    ---------------------------------------------------------------------------
283
 
284
    SendFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
285
                             tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
286
                             sourceId=>x"dead", destId=>x"beef",
287
                             payload=>RioMaintenance(transaction=>"0000",
288
                                                     size=>"1000",
289
                                                     tid=>x"aa",
290
                                                     hopCount=>x"ff",
291
                                                     configOffset=>"000000000000000000000",
292
                                                     wdptr=>'1',
293
                                                     dataLength=>0,
294
                                                     data=>maintData)));
295
 
296
    wait until configStb = '1';
297 36 magro732
    configStbExpected <= '1';
298 38 magro732
    wait until clk = '1';
299
    assert configWe = '0' report "Unexpected config write." severity error;
300
    assert configAddr = "0000000000000000000001" report "Unexpected config address." severity error;
301
    configDataRead <= x"c0debabe";
302
    configAck <= '1';
303
    wait until clk = '1';
304
    configAck <= '0';
305
    configStbExpected <= '0';
306
    maintData(0) := x"00000000c0debabe";
307 36 magro732
 
308 38 magro732
    ReceiveFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
309
                                tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
310
                                sourceId=>x"beef", destId=>x"dead",
311
                                payload=>RioMaintenance(transaction=>"0010",
312
                                                        size=>"0000",
313
                                                        tid=>x"aa",
314
                                                        hopCount=>x"ff",
315
                                                        configOffset=>"000000000000000000000",
316
                                                        wdptr=>'0',
317
                                                        dataLength=>1,
318
                                                        data=>maintData)));
319 36 magro732
 
320
    ---------------------------------------------------------------------------
321 38 magro732
    PrintS("-----------------------------------------------------------------");
322
    PrintS("Step 3:");
323
    PrintS("Action: Send maintenance read request for two words.");
324
    PrintS("Result: Check the accesses on the external configuration port.");
325
    PrintS("-----------------------------------------------------------------");
326
    ---------------------------------------------------------------------------
327
    PrintR("TG_RioLogicalCommon-TC1-Step3");
328
    ---------------------------------------------------------------------------
329
 
330
    SendFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
331
                             tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
332
                             sourceId=>x"dead", destId=>x"beef",
333
                             payload=>RioMaintenance(transaction=>"0000",
334
                                                     size=>"1011",
335
                                                     tid=>x"cc",
336
                                                     hopCount=>x"ff",
337
                                                     configOffset=>"000000000000000000001",
338
                                                     wdptr=>'0',
339
                                                     dataLength=>0,
340
                                                     data=>maintData)));
341
 
342
    wait until configStb = '1';
343
    configStbExpected <= '1';
344
 
345
    wait until clk = '1';
346
    assert configWe = '0' report "Unexpected config write." severity error;
347
    assert configAddr = "0000000000000000000010" report "Unexpected config address." severity error;
348
    configDataRead <= x"11111111";
349
    configAck <= '1';
350
    wait until clk = '1';
351
    configAck <= '0';
352
 
353
    wait until clk = '1';
354
    assert configWe = '0' report "Unexpected config write." severity error;
355
    assert configAddr = "0000000000000000000011" report "Unexpected config address." severity error;
356
    configDataRead <= x"22222222";
357
    configAck <= '1';
358
    wait until clk = '1';
359
    configAck <= '0';
360
 
361
    configStbExpected <= '0';
362
    maintData(0) := x"1111111122222222";
363
 
364
    ReceiveFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
365
                                tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
366
                                sourceId=>x"beef", destId=>x"dead",
367
                                payload=>RioMaintenance(transaction=>"0010",
368
                                                        size=>"0000",
369
                                                        tid=>x"cc",
370
                                                        hopCount=>x"ff",
371
                                                        configOffset=>"000000000000000000000",
372
                                                        wdptr=>'0',
373
                                                        dataLength=>1,
374
                                                        data=>maintData)));
375
 
376
    ---------------------------------------------------------------------------
377
    PrintS("-----------------------------------------------------------------");
378
    PrintS("Step 4:");
379
    PrintS("Action: Send maintenance read request for four words.");
380
    PrintS("Result: Check the accesses on the external configuration port.");
381
    PrintS("-----------------------------------------------------------------");
382
    ---------------------------------------------------------------------------
383
    PrintR("TG_RioLogicalCommon-TC1-Step4");
384
    ---------------------------------------------------------------------------
385
 
386
    SendFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
387
                             tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
388
                             sourceId=>x"dead", destId=>x"beef",
389
                             payload=>RioMaintenance(transaction=>"0000",
390
                                                     size=>"1011",
391
                                                     tid=>x"cc",
392
                                                     hopCount=>x"ff",
393
                                                     configOffset=>"000000000000000000001",
394
                                                     wdptr=>'1',
395
                                                     dataLength=>0,
396
                                                     data=>maintData)));
397
 
398
    wait until configStb = '1';
399
    configStbExpected <= '1';
400
 
401
    wait until clk = '1';
402
    assert configWe = '0' report "Unexpected config write." severity error;
403
    assert configAddr = "0000000000000000000010" report "Unexpected config address." severity error;
404
    configDataRead <= x"11111111";
405
    configAck <= '1';
406
    wait until clk = '1';
407
    configAck <= '0';
408
 
409
    wait until clk = '1';
410
    assert configWe = '0' report "Unexpected config write." severity error;
411
    assert configAddr = "0000000000000000000011" report "Unexpected config address." severity error;
412
    configDataRead <= x"22222222";
413
    configAck <= '1';
414
    wait until clk = '1';
415
    configAck <= '0';
416
 
417
    wait until clk = '1';
418
    assert configWe = '0' report "Unexpected config write." severity error;
419
    assert configAddr = "0000000000000000000100" report "Unexpected config address." severity error;
420
    configDataRead <= x"33333333";
421
    configAck <= '1';
422
    wait until clk = '1';
423
    configAck <= '0';
424
 
425
    wait until clk = '1';
426
    assert configWe = '0' report "Unexpected config write." severity error;
427
    assert configAddr = "0000000000000000000101" report "Unexpected config address." severity error;
428
    configDataRead <= x"44444444";
429
    configAck <= '1';
430
    wait until clk = '1';
431
    configAck <= '0';
432
 
433
    configStbExpected <= '0';
434
    maintData(0) := x"1111111122222222";
435
    maintData(1) := x"3333333344444444";
436
 
437
    ReceiveFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
438
                                tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
439
                                sourceId=>x"beef", destId=>x"dead",
440
                                payload=>RioMaintenance(transaction=>"0010",
441
                                                        size=>"0000",
442
                                                        tid=>x"cc",
443
                                                        hopCount=>x"ff",
444
                                                        configOffset=>"000000000000000000000",
445
                                                        wdptr=>'0',
446
                                                        dataLength=>2,
447
                                                        data=>maintData)));
448
 
449
    ---------------------------------------------------------------------------
450
    PrintS("-----------------------------------------------------------------");
451
    PrintS("Step 5:");
452
    PrintS("Action: Send maintenance read request for eight words.");
453
    PrintS("Result: Check the accesses on the external configuration port.");
454
    PrintS("-----------------------------------------------------------------");
455
    ---------------------------------------------------------------------------
456
    PrintR("TG_RioLogicalCommon-TC1-Step5");
457
    ---------------------------------------------------------------------------
458
 
459
    SendFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
460
                             tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
461
                             sourceId=>x"dead", destId=>x"beef",
462
                             payload=>RioMaintenance(transaction=>"0000",
463
                                                     size=>"1100",
464
                                                     tid=>x"cc",
465
                                                     hopCount=>x"ff",
466
                                                     configOffset=>"000000000000000000001",
467
                                                     wdptr=>'0',
468
                                                     dataLength=>0,
469
                                                     data=>maintData)));
470
 
471
    wait until configStb = '1';
472
    configStbExpected <= '1';
473
 
474
    wait until clk = '1';
475
    assert configWe = '0' report "Unexpected config write." severity error;
476
    assert configAddr = "0000000000000000000010" report "Unexpected config address." severity error;
477
    configDataRead <= x"11111111";
478
    configAck <= '1';
479
    wait until clk = '1';
480
    configAck <= '0';
481
 
482
    wait until clk = '1';
483
    assert configWe = '0' report "Unexpected config write." severity error;
484
    assert configAddr = "0000000000000000000011" report "Unexpected config address." severity error;
485
    configDataRead <= x"22222222";
486
    configAck <= '1';
487
    wait until clk = '1';
488
    configAck <= '0';
489
 
490
    wait until clk = '1';
491
    assert configWe = '0' report "Unexpected config write." severity error;
492
    assert configAddr = "0000000000000000000100" report "Unexpected config address." severity error;
493
    configDataRead <= x"33333333";
494
    configAck <= '1';
495
    wait until clk = '1';
496
    configAck <= '0';
497
 
498
    wait until clk = '1';
499
    assert configWe = '0' report "Unexpected config write." severity error;
500
    assert configAddr = "0000000000000000000101" report "Unexpected config address." severity error;
501
    configDataRead <= x"44444444";
502
    configAck <= '1';
503
    wait until clk = '1';
504
    configAck <= '0';
505
 
506
    wait until clk = '1';
507
    assert configWe = '0' report "Unexpected config write." severity error;
508
    assert configAddr = "0000000000000000000110" report "Unexpected config address." severity error;
509
    configDataRead <= x"55555555";
510
    configAck <= '1';
511
    wait until clk = '1';
512
    configAck <= '0';
513
 
514
    wait until clk = '1';
515
    assert configWe = '0' report "Unexpected config write." severity error;
516
    assert configAddr = "0000000000000000000111" report "Unexpected config address." severity error;
517
    configDataRead <= x"66666666";
518
    configAck <= '1';
519
    wait until clk = '1';
520
    configAck <= '0';
521
 
522
    wait until clk = '1';
523
    assert configWe = '0' report "Unexpected config write." severity error;
524
    assert configAddr = "0000000000000000001000" report "Unexpected config address." severity error;
525
    configDataRead <= x"77777777";
526
    configAck <= '1';
527
    wait until clk = '1';
528
    configAck <= '0';
529
 
530
    wait until clk = '1';
531
    assert configWe = '0' report "Unexpected config write." severity error;
532
    assert configAddr = "0000000000000000001001" report "Unexpected config address." severity error;
533
    configDataRead <= x"88888888";
534
    configAck <= '1';
535
    wait until clk = '1';
536
    configAck <= '0';
537
 
538
    configStbExpected <= '0';
539
    maintData(0) := x"1111111122222222";
540
    maintData(1) := x"3333333344444444";
541
    maintData(2) := x"5555555566666666";
542
    maintData(3) := x"7777777788888888";
543
 
544
    ReceiveFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
545
                                tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
546
                                sourceId=>x"beef", destId=>x"dead",
547
                                payload=>RioMaintenance(transaction=>"0010",
548
                                                        size=>"0000",
549
                                                        tid=>x"cc",
550
                                                        hopCount=>x"ff",
551
                                                        configOffset=>"000000000000000000000",
552
                                                        wdptr=>'0',
553
                                                        dataLength=>4,
554
                                                        data=>maintData)));
555
 
556
    ---------------------------------------------------------------------------
557
    PrintS("-----------------------------------------------------------------");
558
    PrintS("Step 6:");
559
    PrintS("Action: Send maintenance read request for sixteen words.");
560
    PrintS("Result: Check the accesses on the external configuration port.");
561
    PrintS("-----------------------------------------------------------------");
562
    ---------------------------------------------------------------------------
563
    PrintR("TG_RioLogicalCommon-TC1-Step6");
564
    ---------------------------------------------------------------------------
565
 
566
    SendFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
567
                             tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
568
                             sourceId=>x"dead", destId=>x"beef",
569
                             payload=>RioMaintenance(transaction=>"0000",
570
                                                     size=>"1100",
571
                                                     tid=>x"cc",
572
                                                     hopCount=>x"ff",
573
                                                     configOffset=>"000000000000000000001",
574
                                                     wdptr=>'1',
575
                                                     dataLength=>0,
576
                                                     data=>maintData)));
577
 
578
    wait until configStb = '1';
579
    configStbExpected <= '1';
580
 
581
    wait until clk = '1';
582
    assert configWe = '0' report "Unexpected config write." severity error;
583
    assert configAddr = "0000000000000000000010" report "Unexpected config address." severity error;
584
    configDataRead <= x"11111111";
585
    configAck <= '1';
586
    wait until clk = '1';
587
    configAck <= '0';
588
 
589
    wait until clk = '1';
590
    assert configWe = '0' report "Unexpected config write." severity error;
591
    assert configAddr = "0000000000000000000011" report "Unexpected config address." severity error;
592
    configDataRead <= x"22222222";
593
    configAck <= '1';
594
    wait until clk = '1';
595
    configAck <= '0';
596
 
597
    wait until clk = '1';
598
    assert configWe = '0' report "Unexpected config write." severity error;
599
    assert configAddr = "0000000000000000000100" report "Unexpected config address." severity error;
600
    configDataRead <= x"33333333";
601
    configAck <= '1';
602
    wait until clk = '1';
603
    configAck <= '0';
604
 
605
    wait until clk = '1';
606
    assert configWe = '0' report "Unexpected config write." severity error;
607
    assert configAddr = "0000000000000000000101" report "Unexpected config address." severity error;
608
    configDataRead <= x"44444444";
609
    configAck <= '1';
610
    wait until clk = '1';
611
    configAck <= '0';
612
 
613
    wait until clk = '1';
614
    assert configWe = '0' report "Unexpected config write." severity error;
615
    assert configAddr = "0000000000000000000110" report "Unexpected config address." severity error;
616
    configDataRead <= x"55555555";
617
    configAck <= '1';
618
    wait until clk = '1';
619
    configAck <= '0';
620
 
621
    wait until clk = '1';
622
    assert configWe = '0' report "Unexpected config write." severity error;
623
    assert configAddr = "0000000000000000000111" report "Unexpected config address." severity error;
624
    configDataRead <= x"66666666";
625
    configAck <= '1';
626
    wait until clk = '1';
627
    configAck <= '0';
628
 
629
    wait until clk = '1';
630
    assert configWe = '0' report "Unexpected config write." severity error;
631
    assert configAddr = "0000000000000000001000" report "Unexpected config address." severity error;
632
    configDataRead <= x"77777777";
633
    configAck <= '1';
634
    wait until clk = '1';
635
    configAck <= '0';
636
 
637
    wait until clk = '1';
638
    assert configWe = '0' report "Unexpected config write." severity error;
639
    assert configAddr = "0000000000000000001001" report "Unexpected config address." severity error;
640
    configDataRead <= x"88888888";
641
    configAck <= '1';
642
    wait until clk = '1';
643
    configAck <= '0';
644
 
645
    wait until clk = '1';
646
    assert configWe = '0' report "Unexpected config write." severity error;
647
    assert configAddr = "0000000000000000001010" report "Unexpected config address." severity error;
648
    configDataRead <= x"99999999";
649
    configAck <= '1';
650
    wait until clk = '1';
651
    configAck <= '0';
652
 
653
    wait until clk = '1';
654
    assert configWe = '0' report "Unexpected config write." severity error;
655
    assert configAddr = "0000000000000000001011" report "Unexpected config address." severity error;
656
    configDataRead <= x"aaaaaaaa";
657
    configAck <= '1';
658
    wait until clk = '1';
659
    configAck <= '0';
660
 
661
    wait until clk = '1';
662
    assert configWe = '0' report "Unexpected config write." severity error;
663
    assert configAddr = "0000000000000000001100" report "Unexpected config address." severity error;
664
    configDataRead <= x"bbbbbbbb";
665
    configAck <= '1';
666
    wait until clk = '1';
667
    configAck <= '0';
668
 
669
    wait until clk = '1';
670
    assert configWe = '0' report "Unexpected config write." severity error;
671
    assert configAddr = "0000000000000000001101" report "Unexpected config address." severity error;
672
    configDataRead <= x"cccccccc";
673
    configAck <= '1';
674
    wait until clk = '1';
675
    configAck <= '0';
676
 
677
    wait until clk = '1';
678
    assert configWe = '0' report "Unexpected config write." severity error;
679
    assert configAddr = "0000000000000000001110" report "Unexpected config address." severity error;
680
    configDataRead <= x"dddddddd";
681
    configAck <= '1';
682
    wait until clk = '1';
683
    configAck <= '0';
684
 
685
    wait until clk = '1';
686
    assert configWe = '0' report "Unexpected config write." severity error;
687
    assert configAddr = "0000000000000000001111" report "Unexpected config address." severity error;
688
    configDataRead <= x"eeeeeeee";
689
    configAck <= '1';
690
    wait until clk = '1';
691
    configAck <= '0';
692
 
693
    wait until clk = '1';
694
    assert configWe = '0' report "Unexpected config write." severity error;
695
    assert configAddr = "0000000000000000010000" report "Unexpected config address." severity error;
696
    configDataRead <= x"ffffffff";
697
    configAck <= '1';
698
    wait until clk = '1';
699
    configAck <= '0';
700
 
701
    wait until clk = '1';
702
    assert configWe = '0' report "Unexpected config write." severity error;
703
    assert configAddr = "0000000000000000010001" report "Unexpected config address." severity error;
704
    configDataRead <= x"10101010";
705
    configAck <= '1';
706
    wait until clk = '1';
707
    configAck <= '0';
708
 
709
    configStbExpected <= '0';
710
    maintData(0) := x"1111111122222222";
711
    maintData(1) := x"3333333344444444";
712
    maintData(2) := x"5555555566666666";
713
    maintData(3) := x"7777777788888888";
714
    maintData(4) := x"99999999aaaaaaaa";
715
    maintData(5) := x"bbbbbbbbcccccccc";
716
    maintData(6) := x"ddddddddeeeeeeee";
717
    maintData(7) := x"ffffffff10101010";
718
 
719
    ReceiveFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
720
                                tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
721
                                sourceId=>x"beef", destId=>x"dead",
722
                                payload=>RioMaintenance(transaction=>"0010",
723
                                                        size=>"0000",
724
                                                        tid=>x"cc",
725
                                                        hopCount=>x"ff",
726
                                                        configOffset=>"000000000000000000000",
727
                                                        wdptr=>'0',
728
                                                        dataLength=>8,
729
                                                        data=>maintData)));
730
 
731
    ---------------------------------------------------------------------------
732
    PrintS("-----------------------------------------------------------------");
733
    PrintS("TG_RioLogicalCommon-TC2");
734
    PrintS("Description: Test maintenance write requests.");
735
    PrintS("Requirement: XXXXX");
736
    PrintS("-----------------------------------------------------------------");
737
    PrintS("Step 1:");
738
    PrintS("Action: Send maintenance write request for one word on even offset.");
739
    PrintS("Result: Check the accesses on the external configuration port.");
740
    PrintS("-----------------------------------------------------------------");
741
    ---------------------------------------------------------------------------
742
    PrintR("TG_RioLogicalCommon-TC2-Step1");
743
    ---------------------------------------------------------------------------
744
 
745
    maintData(0) := x"deadbeef00000000";
746
    SendFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
747
                             tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
748
                             sourceId=>x"dead", destId=>x"beef",
749
                             payload=>RioMaintenance(transaction=>"0001",
750
                                                     size=>"1000",
751
                                                     tid=>x"aa",
752
                                                     hopCount=>x"ff",
753
                                                     configOffset=>"100000000000000000000",
754
                                                     wdptr=>'0',
755
                                                     dataLength=>1,
756
                                                     data=>maintData)));
757
 
758
    wait until configStb = '1';
759
    configStbExpected <= '1';
760
 
761
    wait until clk = '1';
762
    assert configWe = '1' report "Unexpected configWe." severity error;
763
    assert configAddr = "1000000000000000000000" report "Unexpected configAddr." severity error;
764
    assert configDataWrite = x"deadbeef" report "Unexpected configDataWrite." severity error;
765
    configAck <= '1';
766
    wait until clk = '1';
767
    configAck <= '0';
768
 
769
    configStbExpected <= '0';
770
 
771
    ReceiveFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
772
                                tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
773
                                sourceId=>x"beef", destId=>x"dead",
774
                                payload=>RioMaintenance(transaction=>"0011",
775
                                                        size=>"0000",
776
                                                        tid=>x"aa",
777
                                                        hopCount=>x"ff",
778
                                                        configOffset=>"000000000000000000000",
779
                                                        wdptr=>'0',
780
                                                        dataLength=>0,
781
                                                        data=>maintData)));
782
 
783
    ---------------------------------------------------------------------------
784
    PrintS("-----------------------------------------------------------------");
785
    PrintS("Step 2:");
786
    PrintS("Action: Send maintenance write request for one word on odd offset.");
787
    PrintS("Result: Check the accesses on the external configuration port.");
788
    PrintS("-----------------------------------------------------------------");
789
    ---------------------------------------------------------------------------
790
    PrintR("TG_RioLogicalCommon-TC2-Step2");
791
    ---------------------------------------------------------------------------
792
 
793
    maintData(0) := x"00000000c0debabe";
794
    SendFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
795
                             tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
796
                             sourceId=>x"dead", destId=>x"beef",
797
                             payload=>RioMaintenance(transaction=>"0001",
798
                                                     size=>"1000",
799
                                                     tid=>x"aa",
800
                                                     hopCount=>x"ff",
801
                                                     configOffset=>"100000000000000000000",
802
                                                     wdptr=>'1',
803
                                                     dataLength=>1,
804
                                                     data=>maintData)));
805
 
806
    wait until configStb = '1';
807
    configStbExpected <= '1';
808
 
809
    wait until clk = '1';
810
    assert configWe = '1' report "Unexpected config write." severity error;
811
    assert configAddr = "1000000000000000000001" report "Unexpected config address." severity error;
812
    assert configDataWrite = x"c0debabe" report "Unexpected configDataWrite." severity error;
813
    configAck <= '1';
814
    wait until clk = '1';
815
    configAck <= '0';
816
 
817
    configStbExpected <= '0';
818
 
819
    ReceiveFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
820
                                tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
821
                                sourceId=>x"beef", destId=>x"dead",
822
                                payload=>RioMaintenance(transaction=>"0011",
823
                                                        size=>"0000",
824
                                                        tid=>x"aa",
825
                                                        hopCount=>x"ff",
826
                                                        configOffset=>"000000000000000000000",
827
                                                        wdptr=>'0',
828
                                                        dataLength=>0,
829
                                                        data=>maintData)));
830
 
831
    ---------------------------------------------------------------------------
832
    PrintS("-----------------------------------------------------------------");
833
    PrintS("Step 3:");
834
    PrintS("Action: Send maintenance write request for two words.");
835
    PrintS("Result: Check the accesses on the external configuration port.");
836
    PrintS("-----------------------------------------------------------------");
837
    ---------------------------------------------------------------------------
838
    PrintR("TG_RioLogicalCommon-TC2-Step3");
839
    ---------------------------------------------------------------------------
840
 
841
    maintData(0) := x"1111111122222222";
842
    SendFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
843
                             tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
844
                             sourceId=>x"dead", destId=>x"beef",
845
                             payload=>RioMaintenance(transaction=>"0001",
846
                                                     size=>"1011",
847
                                                     tid=>x"cc",
848
                                                     hopCount=>x"ff",
849
                                                     configOffset=>"100000000000000000001",
850
                                                     wdptr=>'0',
851
                                                     dataLength=>1,
852
                                                     data=>maintData)));
853
 
854
    wait until configStb = '1';
855
    configStbExpected <= '1';
856
 
857
    wait until clk = '1';
858
    assert configWe = '1' report "Unexpected config write." severity error;
859
    assert configAddr = "1000000000000000000010" report "Unexpected config address." severity error;
860
    assert configDataWrite = x"11111111" report "Unexpected configDataWrite." severity error;
861
    configAck <= '1';
862
    wait until clk = '1';
863
    configAck <= '0';
864
 
865
    wait until clk = '1';
866
    assert configWe = '1' report "Unexpected config write." severity error;
867
    assert configAddr = "1000000000000000000011" report "Unexpected config address." severity error;
868
    assert configDataWrite = x"22222222" report "Unexpected configDataWrite." severity error;
869
    configAck <= '1';
870
    wait until clk = '1';
871
    configAck <= '0';
872
 
873
    configStbExpected <= '0';
874
 
875
    ReceiveFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
876
                                tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
877
                                sourceId=>x"beef", destId=>x"dead",
878
                                payload=>RioMaintenance(transaction=>"0011",
879
                                                        size=>"0000",
880
                                                        tid=>x"cc",
881
                                                        hopCount=>x"ff",
882
                                                        configOffset=>"000000000000000000000",
883
                                                        wdptr=>'0',
884
                                                        dataLength=>0,
885
                                                        data=>maintData)));
886
 
887
    ---------------------------------------------------------------------------
888
    PrintS("-----------------------------------------------------------------");
889
    PrintS("Step 4:");
890
    PrintS("Action: Send maintenance write request for four words.");
891
    PrintS("Result: Check the accesses on the external configuration port.");
892
    PrintS("-----------------------------------------------------------------");
893
    ---------------------------------------------------------------------------
894
    PrintR("TG_RioLogicalCommon-TC2-Step4");
895
    ---------------------------------------------------------------------------
896
 
897
    maintData(0) := x"1111111122222222";
898
    maintData(1) := x"3333333344444444";
899
    SendFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
900
                             tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
901
                             sourceId=>x"dead", destId=>x"beef",
902
                             payload=>RioMaintenance(transaction=>"0001",
903
                                                     size=>"1011",
904
                                                     tid=>x"cc",
905
                                                     hopCount=>x"ff",
906
                                                     configOffset=>"000000000000000000001",
907
                                                     wdptr=>'1',
908
                                                     dataLength=>2,
909
                                                     data=>maintData)));
910
 
911
    wait until configStb = '1';
912
    configStbExpected <= '1';
913
 
914
    wait until clk = '1';
915
    assert configWe = '1' report "Unexpected config write." severity error;
916
    assert configAddr = "0000000000000000000010" report "Unexpected config address." severity error;
917
    assert configDataWrite = x"11111111" report "Unexpected configDataWrite." severity error;
918
    configAck <= '1';
919
    wait until clk = '1';
920
    configAck <= '0';
921
 
922
    wait until clk = '1';
923
    assert configWe = '1' report "Unexpected config write." severity error;
924
    assert configAddr = "0000000000000000000011" report "Unexpected config address." severity error;
925
    assert configDataWrite = x"22222222" report "Unexpected configDataWrite." severity error;
926
    configAck <= '1';
927
    wait until clk = '1';
928
    configAck <= '0';
929
 
930
    wait until clk = '1';
931
    assert configWe = '1' report "Unexpected config write." severity error;
932
    assert configAddr = "0000000000000000000100" report "Unexpected config address." severity error;
933
    assert configDataWrite = x"33333333" report "Unexpected configDataWrite." severity error;
934
    configAck <= '1';
935
    wait until clk = '1';
936
    configAck <= '0';
937
 
938
    wait until clk = '1';
939
    assert configWe = '1' report "Unexpected config write." severity error;
940
    assert configAddr = "0000000000000000000101" report "Unexpected config address." severity error;
941
    assert configDataWrite = x"44444444" report "Unexpected configDataWrite." severity error;
942
    configAck <= '1';
943
    wait until clk = '1';
944
    configAck <= '0';
945
 
946
    configStbExpected <= '0';
947
 
948
    ReceiveFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
949
                                tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
950
                                sourceId=>x"beef", destId=>x"dead",
951
                                payload=>RioMaintenance(transaction=>"0011",
952
                                                        size=>"0000",
953
                                                        tid=>x"cc",
954
                                                        hopCount=>x"ff",
955
                                                        configOffset=>"000000000000000000000",
956
                                                        wdptr=>'0',
957
                                                        dataLength=>0,
958
                                                        data=>maintData)));
959
 
960
    ---------------------------------------------------------------------------
961
    PrintS("-----------------------------------------------------------------");
962
    PrintS("Step 5:");
963
    PrintS("Action: Send maintenance write request for eight words.");
964
    PrintS("Result: Check the accesses on the external configuration port.");
965
    PrintS("-----------------------------------------------------------------");
966
    ---------------------------------------------------------------------------
967
    PrintR("TG_RioLogicalCommon-TC2-Step5");
968
    ---------------------------------------------------------------------------
969
 
970
    maintData(0) := x"1111111122222222";
971
    maintData(1) := x"3333333344444444";
972
    maintData(2) := x"5555555566666666";
973
    maintData(3) := x"7777777788888888";
974
    SendFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
975
                             tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
976
                             sourceId=>x"dead", destId=>x"beef",
977
                             payload=>RioMaintenance(transaction=>"0001",
978
                                                     size=>"1100",
979
                                                     tid=>x"cc",
980
                                                     hopCount=>x"ff",
981
                                                     configOffset=>"000000000000000000001",
982
                                                     wdptr=>'0',
983
                                                     dataLength=>4,
984
                                                     data=>maintData)));
985
 
986
    wait until configStb = '1';
987
    configStbExpected <= '1';
988
 
989
    wait until clk = '1';
990
    assert configWe = '1' report "Unexpected config write." severity error;
991
    assert configAddr = "0000000000000000000010" report "Unexpected config address." severity error;
992
    assert configDataWrite = x"11111111" report "Unexpected configDataWrite." severity error;
993
    configAck <= '1';
994
    wait until clk = '1';
995
    configAck <= '0';
996
 
997
    wait until clk = '1';
998
    assert configWe = '1' report "Unexpected config write." severity error;
999
    assert configAddr = "0000000000000000000011" report "Unexpected config address." severity error;
1000
    assert configDataWrite = x"22222222" report "Unexpected configDataWrite." severity error;
1001
    configAck <= '1';
1002
    wait until clk = '1';
1003
    configAck <= '0';
1004
 
1005
    wait until clk = '1';
1006
    assert configWe = '1' report "Unexpected config write." severity error;
1007
    assert configAddr = "0000000000000000000100" report "Unexpected config address." severity error;
1008
    assert configDataWrite = x"33333333" report "Unexpected configDataWrite." severity error;
1009
    configAck <= '1';
1010
    wait until clk = '1';
1011
    configAck <= '0';
1012
 
1013
    wait until clk = '1';
1014
    assert configWe = '1' report "Unexpected config write." severity error;
1015
    assert configAddr = "0000000000000000000101" report "Unexpected config address." severity error;
1016
    assert configDataWrite = x"44444444" report "Unexpected configDataWrite." severity error;
1017
    configAck <= '1';
1018
    wait until clk = '1';
1019
    configAck <= '0';
1020
 
1021
    wait until clk = '1';
1022
    assert configWe = '1' report "Unexpected config write." severity error;
1023
    assert configAddr = "0000000000000000000110" report "Unexpected config address." severity error;
1024
    assert configDataWrite = x"55555555" report "Unexpected configDataWrite." severity error;
1025
    configAck <= '1';
1026
    wait until clk = '1';
1027
    configAck <= '0';
1028
 
1029
    wait until clk = '1';
1030
    assert configWe = '1' report "Unexpected config write." severity error;
1031
    assert configAddr = "0000000000000000000111" report "Unexpected config address." severity error;
1032
    assert configDataWrite = x"66666666" report "Unexpected configDataWrite." severity error;
1033
    configAck <= '1';
1034
    wait until clk = '1';
1035
    configAck <= '0';
1036
 
1037
    wait until clk = '1';
1038
    assert configWe = '1' report "Unexpected config write." severity error;
1039
    assert configAddr = "0000000000000000001000" report "Unexpected config address." severity error;
1040
    assert configDataWrite = x"77777777" report "Unexpected configDataWrite." severity error;
1041
    configAck <= '1';
1042
    wait until clk = '1';
1043
    configAck <= '0';
1044
 
1045
    wait until clk = '1';
1046
    assert configWe = '1' report "Unexpected config write." severity error;
1047
    assert configAddr = "0000000000000000001001" report "Unexpected config address." severity error;
1048
    assert configDataWrite = x"88888888" report "Unexpected configDataWrite." severity error;
1049
    configAck <= '1';
1050
    wait until clk = '1';
1051
    configAck <= '0';
1052
 
1053
    configStbExpected <= '0';
1054
 
1055
    ReceiveFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
1056
                                tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
1057
                                sourceId=>x"beef", destId=>x"dead",
1058
                                payload=>RioMaintenance(transaction=>"0011",
1059
                                                        size=>"0000",
1060
                                                        tid=>x"cc",
1061
                                                        hopCount=>x"ff",
1062
                                                        configOffset=>"000000000000000000000",
1063
                                                        wdptr=>'0',
1064
                                                        dataLength=>0,
1065
                                                        data=>maintData)));
1066
 
1067
    ---------------------------------------------------------------------------
1068
    PrintS("-----------------------------------------------------------------");
1069
    PrintS("Step 6:");
1070
    PrintS("Action: Send maintenance write request for sixteen words.");
1071
    PrintS("Result: Check the accesses on the external configuration port.");
1072
    PrintS("-----------------------------------------------------------------");
1073
    ---------------------------------------------------------------------------
1074
    PrintR("TG_RioLogicalCommon-TC2-Step6");
1075
    ---------------------------------------------------------------------------
1076
 
1077
    maintData(0) := x"1111111122222222";
1078
    maintData(1) := x"3333333344444444";
1079
    maintData(2) := x"5555555566666666";
1080
    maintData(3) := x"7777777788888888";
1081
    maintData(4) := x"99999999aaaaaaaa";
1082
    maintData(5) := x"bbbbbbbbcccccccc";
1083
    maintData(6) := x"ddddddddeeeeeeee";
1084
    maintData(7) := x"ffffffff10101010";
1085
    SendFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
1086
                             tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
1087
                             sourceId=>x"dead", destId=>x"beef",
1088
                             payload=>RioMaintenance(transaction=>"0001",
1089
                                                     size=>"1100",
1090
                                                     tid=>x"cc",
1091
                                                     hopCount=>x"ff",
1092
                                                     configOffset=>"000000000000000000001",
1093
                                                     wdptr=>'1',
1094
                                                     dataLength=>8,
1095
                                                     data=>maintData)));
1096
 
1097
    wait until configStb = '1';
1098
    configStbExpected <= '1';
1099
 
1100
    wait until clk = '1';
1101
    assert configWe = '1' report "Unexpected config write." severity error;
1102
    assert configAddr = "0000000000000000000010" report "Unexpected config address." severity error;
1103
    assert configDataWrite = x"11111111" report "Unexpected configDataWrite." severity error;
1104
    configAck <= '1';
1105
    wait until clk = '1';
1106
    configAck <= '0';
1107
 
1108
    wait until clk = '1';
1109
    assert configWe = '1' report "Unexpected config write." severity error;
1110
    assert configAddr = "0000000000000000000011" report "Unexpected config address." severity error;
1111
    assert configDataWrite = x"22222222" report "Unexpected configDataWrite." severity error;
1112
    configAck <= '1';
1113
    wait until clk = '1';
1114
    configAck <= '0';
1115
 
1116
    wait until clk = '1';
1117
    assert configWe = '1' report "Unexpected config write." severity error;
1118
    assert configAddr = "0000000000000000000100" report "Unexpected config address." severity error;
1119
    assert configDataWrite = x"33333333" report "Unexpected configDataWrite." severity error;
1120
    configAck <= '1';
1121
    wait until clk = '1';
1122
    configAck <= '0';
1123
 
1124
    wait until clk = '1';
1125
    assert configWe = '1' report "Unexpected config write." severity error;
1126
    assert configAddr = "0000000000000000000101" report "Unexpected config address." severity error;
1127
    assert configDataWrite = x"44444444" report "Unexpected configDataWrite." severity error;
1128
    configAck <= '1';
1129
    wait until clk = '1';
1130
    configAck <= '0';
1131
 
1132
    wait until clk = '1';
1133
    assert configWe = '1' report "Unexpected config write." severity error;
1134
    assert configAddr = "0000000000000000000110" report "Unexpected config address." severity error;
1135
    assert configDataWrite = x"55555555" report "Unexpected configDataWrite." severity error;
1136
    configAck <= '1';
1137
    wait until clk = '1';
1138
    configAck <= '0';
1139
 
1140
    wait until clk = '1';
1141
    assert configWe = '1' report "Unexpected config write." severity error;
1142
    assert configAddr = "0000000000000000000111" report "Unexpected config address." severity error;
1143
    assert configDataWrite = x"66666666" report "Unexpected configDataWrite." severity error;
1144
    configAck <= '1';
1145
    wait until clk = '1';
1146
    configAck <= '0';
1147
 
1148
    wait until clk = '1';
1149
    assert configWe = '1' report "Unexpected config write." severity error;
1150
    assert configAddr = "0000000000000000001000" report "Unexpected config address." severity error;
1151
    assert configDataWrite = x"77777777" report "Unexpected configDataWrite." severity error;
1152
    configAck <= '1';
1153
    wait until clk = '1';
1154
    configAck <= '0';
1155
 
1156
    wait until clk = '1';
1157
    assert configWe = '1' report "Unexpected config write." severity error;
1158
    assert configAddr = "0000000000000000001001" report "Unexpected config address." severity error;
1159
    assert configDataWrite = x"88888888" report "Unexpected configDataWrite." severity error;
1160
    configAck <= '1';
1161
    wait until clk = '1';
1162
    configAck <= '0';
1163
 
1164
    wait until clk = '1';
1165
    assert configWe = '1' report "Unexpected config write." severity error;
1166
    assert configAddr = "0000000000000000001010" report "Unexpected config address." severity error;
1167
    assert configDataWrite = x"99999999" report "Unexpected configDataWrite." severity error;
1168
    configAck <= '1';
1169
    wait until clk = '1';
1170
    configAck <= '0';
1171
 
1172
    wait until clk = '1';
1173
    assert configWe = '1' report "Unexpected config write." severity error;
1174
    assert configAddr = "0000000000000000001011" report "Unexpected config address." severity error;
1175
    assert configDataWrite = x"aaaaaaaa" report "Unexpected configDataWrite." severity error;
1176
    configAck <= '1';
1177
    wait until clk = '1';
1178
    configAck <= '0';
1179
 
1180
    wait until clk = '1';
1181
    assert configWe = '1' report "Unexpected config write." severity error;
1182
    assert configAddr = "0000000000000000001100" report "Unexpected config address." severity error;
1183
    assert configDataWrite = x"bbbbbbbb" report "Unexpected configDataWrite." severity error;
1184
    configAck <= '1';
1185
    wait until clk = '1';
1186
    configAck <= '0';
1187
 
1188
    wait until clk = '1';
1189
    assert configWe = '1' report "Unexpected config write." severity error;
1190
    assert configAddr = "0000000000000000001101" report "Unexpected config address." severity error;
1191
    assert configDataWrite = x"cccccccc" report "Unexpected configDataWrite." severity error;
1192
    configAck <= '1';
1193
    wait until clk = '1';
1194
    configAck <= '0';
1195
 
1196
    wait until clk = '1';
1197
    assert configWe = '1' report "Unexpected config write." severity error;
1198
    assert configAddr = "0000000000000000001110" report "Unexpected config address." severity error;
1199
    assert configDataWrite = x"dddddddd" report "Unexpected configDataWrite." severity error;
1200
    configAck <= '1';
1201
    wait until clk = '1';
1202
    configAck <= '0';
1203
 
1204
    wait until clk = '1';
1205
    assert configWe = '1' report "Unexpected config write." severity error;
1206
    assert configAddr = "0000000000000000001111" report "Unexpected config address." severity error;
1207
    assert configDataWrite = x"eeeeeeee" report "Unexpected configDataWrite." severity error;
1208
    configAck <= '1';
1209
    wait until clk = '1';
1210
    configAck <= '0';
1211
 
1212
    wait until clk = '1';
1213
    assert configWe = '1' report "Unexpected config write." severity error;
1214
    assert configAddr = "0000000000000000010000" report "Unexpected config address." severity error;
1215
    assert configDataWrite = x"ffffffff" report "Unexpected configDataWrite." severity error;
1216
    configAck <= '1';
1217
    wait until clk = '1';
1218
    configAck <= '0';
1219
 
1220
    wait until clk = '1';
1221
    assert configWe = '1' report "Unexpected config write." severity error;
1222
    assert configAddr = "0000000000000000010001" report "Unexpected config address." severity error;
1223
    assert configDataWrite = x"10101010" report "Unexpected configDataWrite." severity error;
1224
    configAck <= '1';
1225
    wait until clk = '1';
1226
    configAck <= '0';
1227
 
1228
    configStbExpected <= '0';
1229
 
1230
    ReceiveFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
1231
                                tt=>"01", ftype=>FTYPE_MAINTENANCE_CLASS,
1232
                                sourceId=>x"beef", destId=>x"dead",
1233
                                payload=>RioMaintenance(transaction=>"0011",
1234
                                                        size=>"0000",
1235
                                                        tid=>x"cc",
1236
                                                        hopCount=>x"ff",
1237
                                                        configOffset=>"000000000000000000000",
1238
                                                        wdptr=>'0',
1239
                                                        dataLength=>0,
1240
                                                        data=>maintData)));
1241
 
1242
 
1243
    ---------------------------------------------------------------------------
1244 36 magro732
    -- Test completed.
1245
    ---------------------------------------------------------------------------
1246
 
1247
    TestEnd;
1248
  end process;
1249
 
1250
  -----------------------------------------------------------------------------
1251
  -- Instantiate a process receiving the configuration accesses to the
1252
  -- implementation defined space.
1253
  -----------------------------------------------------------------------------
1254
  process
1255
  begin
1256
    loop
1257
      wait until clk'event and clk = '1';
1258 38 magro732
      assert configStbExpected = configStb report "Unexpected config-space access." severity error;
1259 36 magro732
    end loop;
1260
  end process;
1261
 
1262
  -----------------------------------------------------------------------------
1263
  -- Instantiate the test port array.
1264
  -----------------------------------------------------------------------------
1265 38 magro732
 
1266
  readFrameRestart <= '0';
1267 36 magro732
  TestPortInst: TestPort
1268
    port map(
1269
      clk=>clk, areset_n=>areset_n,
1270
      frameValid_i=>frameValid,
1271
      frameWrite_i=>frameWrite,
1272
      frameComplete_o=>frameComplete,
1273
      frameExpected_i=>frameExpected,
1274
      frameRead_i=>frameRead,
1275
      frameReceived_o=>frameReceived,
1276
      readFrameEmpty_o=>readFrameEmpty,
1277
      readFrame_i=>readFrame,
1278
      readFrameRestart_i=>readFrameRestart,
1279
      readFrameAborted_o=>readFrameAborted,
1280
      readContentEmpty_o=>readContentEmpty,
1281
      readContent_i=>readContent,
1282
      readContentEnd_o=>readContentEnd,
1283
      readContentData_o=>readContentData,
1284
      writeFrameFull_o=>writeFrameFull,
1285
      writeFrame_i=>writeFrame,
1286
      writeFrameAbort_i=>writeFrameAbort,
1287
      writeContent_i=>writeContent,
1288
      writeContentData_i=>writeContentData);
1289
 
1290
  -----------------------------------------------------------------------------
1291
  -- Instantiate the switch.
1292
  -----------------------------------------------------------------------------
1293
 
1294
  TestObject: RioLogicalCommon
1295
    port map(
1296
      clk=>clk, areset_n=>areset_n, enable=>enable,
1297
      writeFrameFull_i=>writeFrameFull,
1298
      writeFrame_o=>writeFrame,
1299
      writeFrameAbort_o=>writeFrameAbort,
1300
      writeContent_o=>writeContent,
1301
      writeContentData_o=>writeContentData,
1302
      readFrameEmpty_i=>readFrameEmpty,
1303
      readFrame_o=>readFrame,
1304
      readContent_o=>readContent,
1305
      readContentEnd_i=>readContentEnd,
1306
      readContentData_i=>readContentData,
1307
      configStb_o=>configStb,
1308
      configWe_o=>configWe,
1309
      configAdr_o=>configAddr,
1310
      configDat_o=>configDataWrite,
1311
      configDat_i=>configDataRead,
1312
      configAck_i=>configAck);
1313
 
1314
 
1315
end architecture;
1316
 
1317
 
1318
 
1319
-------------------------------------------------------------------------------
1320
-- 
1321
-------------------------------------------------------------------------------
1322
library ieee;
1323
use ieee.std_logic_1164.all;
1324
use ieee.numeric_std.all;
1325
library std;
1326
use std.textio.all;
1327
use work.rio_common.all;
1328
 
1329
 
1330
-------------------------------------------------------------------------------
1331
-- 
1332
-------------------------------------------------------------------------------
1333
entity TestPort is
1334
  port(
1335
    clk : in std_logic;
1336
    areset_n : in std_logic;
1337
 
1338
    frameValid_i : in std_logic;
1339
    frameWrite_i : in RioFrame;
1340
    frameComplete_o : out std_logic;
1341
 
1342
    frameExpected_i : in std_logic;
1343
    frameRead_i : in RioFrame;
1344
    frameReceived_o : out std_logic;
1345
 
1346
    readFrameEmpty_o : out std_logic;
1347
    readFrame_i : in std_logic;
1348
    readFrameRestart_i : in std_logic;
1349
    readFrameAborted_o : out std_logic;
1350
    readContentEmpty_o : out std_logic;
1351
    readContent_i : in std_logic;
1352
    readContentEnd_o : out std_logic;
1353
    readContentData_o : out std_logic_vector(31 downto 0);
1354
 
1355
    writeFrameFull_o : out std_logic;
1356
    writeFrame_i : in std_logic;
1357
    writeFrameAbort_i : in std_logic;
1358
    writeContent_i : in std_logic;
1359
    writeContentData_i : in std_logic_vector(31 downto 0));
1360
end entity;
1361
 
1362
 
1363
-------------------------------------------------------------------------------
1364
-- 
1365
-------------------------------------------------------------------------------
1366
architecture TestPortImpl of TestPort is
1367
begin
1368
 
1369
  -----------------------------------------------------------------------------
1370
  -- 
1371
  -----------------------------------------------------------------------------
1372
  FrameReader: process
1373
    type StateType is (STATE_IDLE, STATE_WRITE);
1374
    variable state : StateType;
1375
    variable frameIndex : natural range 0 to 69;
1376
  begin
1377
    writeFrameFull_o <= '1';
1378
    frameReceived_o <= '0';
1379
    wait until areset_n = '1';
1380
 
1381
    state := STATE_IDLE;
1382
 
1383
    loop
1384
      wait until clk'event and clk = '1';
1385
 
1386
      case state is
1387
 
1388
        when STATE_IDLE =>
1389
          frameReceived_o <= '0';
1390
          if (frameExpected_i = '1') then
1391
            writeFrameFull_o <= '0';
1392
            state := STATE_WRITE;
1393
            frameIndex := 0;
1394
          else
1395
            writeFrameFull_o <= '1';
1396
          end if;
1397
          assert writeFrame_i = '0' report "Unexpected frame." severity error;
1398
          assert writeFrameAbort_i = '0' report "Unexpected frame abort." severity error;
1399
          assert writeContent_i = '0' report "Unexpected data." severity error;
1400
 
1401
        when STATE_WRITE =>
1402
          if (writeContent_i = '1') then
1403
            -- Writing content.
1404
            if (frameIndex < frameRead_i.length) then
1405
              assert writeContentData_i = frameRead_i.payload(frameIndex)
1406
                report "Unexpected frame content received:" &
1407
                " index=" & integer'image(frameIndex) &
1408
                " expected=" & integer'image(to_integer(unsigned(frameRead_i.payload(frameIndex)))) &
1409
                " got=" & integer'image(to_integer(unsigned(writeContentData_i)))
1410
                severity error;
1411
 
1412
              frameIndex := frameIndex + 1;
1413
            else
1414
              report "Unexpected frame content received:" &
1415
                " index=" & integer'image(frameIndex) &
1416
                " expected=" & integer'image(to_integer(unsigned(frameRead_i.payload(frameIndex)))) &
1417
                " got=" & integer'image(to_integer(unsigned(writeContentData_i)))
1418
                severity error;
1419
 
1420
              frameIndex := frameIndex + 1;
1421
            end if;
1422
          else
1423
            -- Not writing any content.
1424
          end if;
1425
 
1426
          if (writeFrame_i = '1') then
1427
            -- Writing a complete frame.
1428
            assert frameIndex = frameRead_i.length report "Unexpected frame length received." severity error;
1429
            state := STATE_IDLE;
1430
            frameReceived_o <= '1';
1431
            writeFrameFull_o <= '1';
1432
          else
1433
            -- Not writing any frame.
1434
          end if;
1435
 
1436
          if (writeFrameAbort_i = '1') then
1437
            -- The frame should be aborted.
1438
            frameIndex := 0;
1439
          else
1440
            -- Not aborting any frame.
1441
          end if;
1442
      end case;
1443
    end loop;
1444
  end process;
1445
 
1446
  -----------------------------------------------------------------------------
1447
  -- 
1448
  -----------------------------------------------------------------------------
1449
  -- REMARK: add support for these signals...
1450
  -- readFrameEmpty_i : in std_logic;
1451
  -- readFrameAborted_i : in std_logic;
1452
  FrameSender: process
1453
    type StateType is (STATE_IDLE, STATE_READ);
1454
    variable state : StateType;
1455
    variable frameIndex : natural range 0 to 69;
1456
  begin
1457
    readFrameEmpty_o <= '1';
1458
    readFrameAborted_o <= '0';
1459
    readContentEmpty_o <= '1';
1460
    readContentEnd_o <= '1';
1461
    readContentData_o <= (others => 'U');
1462
    frameComplete_o <= '0';
1463
    wait until areset_n = '1';
1464
 
1465
    state := STATE_IDLE;
1466
 
1467
    loop
1468
      wait until clk'event and clk = '1';
1469
 
1470
      case state is
1471
 
1472
        when STATE_IDLE =>
1473
          frameComplete_o <= '0';
1474
          if (frameValid_i = '1') then
1475
            state := STATE_READ;
1476
            frameIndex := 0;
1477
            readContentEmpty_o <= '0';
1478
            readFrameEmpty_o <= '0';
1479
          else
1480
            readContentEmpty_o <= '1';
1481
          end if;
1482
 
1483
        when STATE_READ =>
1484
          if (readFrameRestart_i = '1') then
1485
            readContentEnd_o <= '0';
1486
            frameIndex := 0;
1487
          else
1488
            -- Not restarting a frame.
1489
          end if;
1490
 
1491
          if (readContent_i = '1') then
1492
            if (frameIndex < frameWrite_i.length) then
1493
              readContentData_o <= frameWrite_i.payload(frameIndex);
1494
              readContentEnd_o <= '0';
1495
              frameIndex := frameIndex + 1;
1496
            elsif (frameIndex = frameWrite_i.length) then
1497
              readContentEnd_o <= '1';
1498
            else
1499
              report "Reading empty frame." severity error;
1500
            end if;
1501
          else
1502
            -- Not reading data.
1503
          end if;
1504
 
1505
          if (readFrame_i = '1') then
1506
            state := STATE_IDLE;
1507
            assert frameIndex = frameWrite_i.length report "Unread frame data discarded." severity error;
1508
            frameComplete_o <= '1';
1509
            readFrameEmpty_o <= '1';
1510
            readContentEmpty_o <= '1';
1511
            readContentData_o <= (others => 'U');
1512
          else
1513
            -- Not reading a frame.
1514
          end if;
1515
 
1516
      end case;
1517
    end loop;
1518
  end process;
1519
 
1520
end architecture;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.