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

Subversion Repositories rio

[/] [rio/] [branches/] [parallelSymbols/] [bench/] [vhdl/] [TestRioSerial.vhd] - Blame information for rev 13

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

Line No. Rev Author Line
1 4 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 simulation test code to verify a RioSerial 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
-- TestRioSerial.
47
-------------------------------------------------------------------------------
48
 
49
library ieee;
50
use ieee.std_logic_1164.all;
51
use ieee.numeric_std.all;
52
library std;
53
use std.textio.all;
54
use work.rio_common.all;
55
 
56
 
57
-------------------------------------------------------------------------------
58
-- Entity for TestRioSerial.
59
-------------------------------------------------------------------------------
60
entity TestRioSerial is
61
end entity;
62
 
63
 
64
-------------------------------------------------------------------------------
65
-- Architecture for TestUart.
66
-------------------------------------------------------------------------------
67
architecture TestRioSerialImpl of TestRioSerial is
68
 
69
  component TestSwitchPort is
70 12 magro732
    generic(
71
      NUMBER_WORDS : natural range 1 to 8 := 1);
72 4 magro732
    port(
73
      clk : in std_logic;
74
      areset_n : in std_logic;
75
 
76
      frameValid_i : in std_logic_vector(0 to 63);
77
      frameWrite_i : in RioFrameArray(0 to 63);
78
      frameComplete_o : out std_logic;
79
 
80
      frameExpected_i : in std_logic;
81
      frameRead_i : in RioFrame;
82
      frameReceived_o : out std_logic;
83
 
84
      readFrameEmpty_o : out std_logic;
85
      readFrame_i : in std_logic;
86
      readFrameRestart_i : in std_logic;
87
      readFrameAborted_o : out std_logic;
88
 
89
      readWindowEmpty_o : out std_logic;
90
      readWindowReset_i : in std_logic;
91
      readWindowNext_i : in std_logic;
92
 
93
      readContentEmpty_o : out std_logic;
94
      readContent_i : in std_logic;
95
      readContentEnd_o : out std_logic;
96 12 magro732
      readContentData_o : out std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
97 4 magro732
 
98
      writeFrameFull_o : out std_logic;
99
      writeFrame_i : in std_logic;
100
      writeFrameAbort_i : in std_logic;
101
      writeContent_i : in std_logic;
102 12 magro732
      writeContentData_i : in std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0));
103 4 magro732
  end component;
104
 
105
  component RioSerial is
106
    generic(
107 12 magro732
      TIMEOUT_WIDTH : natural;
108
      NUMBER_WORDS : natural range 1 to 8 := 1);
109 4 magro732
    port(
110
      clk : in std_logic;
111
      areset_n : in std_logic;
112
 
113
      portLinkTimeout_i : in std_logic_vector(TIMEOUT_WIDTH-1 downto 0);
114
      linkInitialized_o : out std_logic;
115
      inputPortEnable_i : in std_logic;
116
      outputPortEnable_i : in std_logic;
117
 
118
      localAckIdWrite_i : in std_logic;
119
      clrOutstandingAckId_i : in std_logic;
120
      inboundAckId_i : in std_logic_vector(4 downto 0);
121
      outstandingAckId_i : in std_logic_vector(4 downto 0);
122
      outboundAckId_i : in std_logic_vector(4 downto 0);
123
      inboundAckId_o : out std_logic_vector(4 downto 0);
124
      outstandingAckId_o : out std_logic_vector(4 downto 0);
125
      outboundAckId_o : out std_logic_vector(4 downto 0);
126
 
127
      readFrameEmpty_i : in std_logic;
128
      readFrame_o : out std_logic;
129
      readFrameRestart_o : out std_logic;
130
      readFrameAborted_i : in std_logic;
131
      readWindowEmpty_i : in std_logic;
132
      readWindowReset_o : out std_logic;
133
      readWindowNext_o : out std_logic;
134
      readContentEmpty_i : in std_logic;
135
      readContent_o : out std_logic;
136
      readContentEnd_i : in std_logic;
137 12 magro732
      readContentData_i : in std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
138 4 magro732
 
139
      writeFrameFull_i : in std_logic;
140
      writeFrame_o : out std_logic;
141
      writeFrameAbort_o : out std_logic;
142
      writeContent_o : out std_logic;
143 12 magro732
      writeContentData_o : out std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
144 4 magro732
 
145
      portInitialized_i : in std_logic;
146
      outboundSymbolEmpty_o : out std_logic;
147
      outboundSymbolRead_i : in std_logic;
148 12 magro732
      outboundSymbol_o : out std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
149 4 magro732
      inboundSymbolFull_o : out std_logic;
150
      inboundSymbolWrite_i : in std_logic;
151 12 magro732
      inboundSymbol_i : in std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0));
152 4 magro732
  end component;
153
 
154 12 magro732
  constant NUMBER_WORDS : natural range 1 to 8 := 1;
155
 
156 4 magro732
  signal clk : std_logic;
157
  signal areset_n : std_logic;
158
 
159
  signal uartInbound : std_logic;
160
  signal uartOutbound : std_logic;
161
 
162
  signal portLinkTimeout : std_logic_vector(10 downto 0);
163
  signal linkInitialized : std_logic;
164
  signal inputPortEnable : std_logic;
165
  signal outputPortEnable : std_logic;
166
 
167
  signal localAckIdWrite : std_logic;
168
  signal clrOutstandingAckId : std_logic;
169
  signal inboundAckIdWrite : std_logic_vector(4 downto 0);
170
  signal outstandingAckIdWrite : std_logic_vector(4 downto 0);
171
  signal outboundAckIdWrite : std_logic_vector(4 downto 0);
172
  signal inboundAckIdRead : std_logic_vector(4 downto 0);
173
  signal outstandingAckIdRead : std_logic_vector(4 downto 0);
174
  signal outboundAckIdRead : std_logic_vector(4 downto 0);
175
 
176
  signal portInitialized : std_logic;
177
  signal outboundSymbolEmpty : std_logic;
178
  signal outboundSymbolRead : std_logic;
179 12 magro732
  signal outboundSymbol : std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
180 4 magro732
  signal inboundSymbolFull : std_logic;
181
  signal inboundSymbolWrite : std_logic;
182 12 magro732
  signal inboundSymbol : std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
183 4 magro732
 
184
  signal readFrameEmpty : std_logic;
185
  signal readFrame : std_logic;
186
  signal readFrameRestart : std_logic;
187
  signal readFrameAborted : std_logic;
188
  signal readWindowEmpty : std_logic;
189
  signal readWindowReset : std_logic;
190
  signal readWindowNext : std_logic;
191
  signal readContentEmpty : std_logic;
192
  signal readContent : std_logic;
193
  signal readContentEnd : std_logic;
194 12 magro732
  signal readContentData : std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
195 4 magro732
 
196
  signal writeFrameFull : std_logic;
197
  signal writeFrame : std_logic;
198
  signal writeFrameAbort : std_logic;
199
  signal writeContent : std_logic;
200 12 magro732
  signal writeContentData : std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
201 4 magro732
 
202
  signal frameValid : std_logic_vector(0 to 63);
203
  signal frameWrite : RioFrameArray(0 to 63);
204
  signal frameComplete : std_logic;
205
  signal frameExpected : std_logic;
206
  signal frameRead : RioFrame;
207
  signal frameReceived : std_logic;
208
 
209
begin
210
 
211
  -----------------------------------------------------------------------------
212
  -- Clock generation.
213
  -----------------------------------------------------------------------------
214
  ClockGenerator: process
215
  begin
216
    clk <= '0';
217
    wait for 20 ns;
218
    clk <= '1';
219
    wait for 20 ns;
220
  end process;
221
 
222
 
223
  -----------------------------------------------------------------------------
224
  -- Serial protocol test driver.
225
  -----------------------------------------------------------------------------
226
  TestDriver: process
227
 
228
    ---------------------------------------------------------------------------
229
    -- Procedure to receive a symbol.
230
    ---------------------------------------------------------------------------
231
    procedure ReceiveSymbol(
232
      constant symbolType : in std_logic_vector(1 downto 0);
233
      constant symbolContent : in std_logic_vector(31 downto 0) := x"00000000") is
234
    begin
235
      wait until outboundSymbolEmpty = '0' and clk'event and clk = '1';
236
 
237 12 magro732
      while ((outboundSymbol(33 downto 32) = SYMBOL_IDLE) and
238
             (symbolType /= SYMBOL_IDLE)) loop
239
        outboundSymbolRead <= '1';
240
        wait until clk'event and clk = '1';
241
        outboundSymbolRead <= '0';
242
        wait until outboundSymbolEmpty = '0' and clk'event and clk = '1';
243
      end loop;
244
 
245 4 magro732
      assert symbolType = outboundSymbol(33 downto 32)
246
        report "Missmatching symbol type:expected=" &
247
        integer'image(to_integer(unsigned(symbolType))) &
248
        " got=" &
249 13 magro732
        integer'image(to_integer(unsigned(outboundSymbol(33 downto 32))))
250 4 magro732
        severity error;
251
 
252 12 magro732
      if (outboundSymbol(33 downto 32) = SYMBOL_CONTROL) then
253 4 magro732
        assert symbolContent(31 downto 8) = outboundSymbol(31 downto 8)
254
          report "Missmatching symbol content:expected=" &
255
          integer'image(to_integer(unsigned(symbolContent(31 downto 8)))) &
256
          " got=" &
257
          integer'image(to_integer(unsigned(outboundSymbol(31 downto 8))))
258
          severity error;
259
      elsif (outboundSymbol(33 downto 32) = SYMBOL_DATA) then
260
        assert symbolContent(31 downto 0) = outboundSymbol(31 downto 0)
261
          report "Missmatching symbol content:expected=" &
262 12 magro732
          integer'image(to_integer(unsigned(symbolContent(31 downto 0)))) &
263 4 magro732
          " got=" &
264
          integer'image(to_integer(unsigned(outboundSymbol(31 downto 0))))
265
          severity error;
266
      end if;
267
 
268
      outboundSymbolRead <= '1';
269
      wait until clk'event and clk = '1';
270
      outboundSymbolRead <= '0';
271
    end procedure;
272
 
273
    ---------------------------------------------------------------------------
274
    -- Procedure to send a symbol.
275
    ---------------------------------------------------------------------------
276
    procedure SendSymbol(
277
      constant symbolType : in std_logic_vector(1 downto 0);
278
      constant symbolContent : in std_logic_vector(31 downto 0) := x"00000000") is
279
    begin
280
      wait until inboundSymbolFull = '0' and clk'event and clk = '1';
281
 
282
      inboundSymbolWrite <= '1';
283
      inboundSymbol <= symbolType & symbolContent;
284
 
285
      wait until clk'event and clk = '1';
286
      inboundSymbolWrite <= '0';
287
    end procedure;
288
 
289
    ---------------------------------------------------------------------------
290
    -- Process variables.
291
    ---------------------------------------------------------------------------
292
    variable seed1 : positive := 1;
293
    variable seed2 : positive := 1;
294
    variable payload : RioPayload;
295
 
296
    variable frame : RioFrame;
297
 
298
  begin
299
    ---------------------------------------------------------------------------
300
    -- Test case initialization.
301
    ---------------------------------------------------------------------------
302
 
303
    frameValid <= (others=>'0');
304
    frameExpected <= '0';
305
 
306
    portLinkTimeout <= (others=>'1');
307
    inputPortEnable <= '1';
308
    outputPortEnable <= '1';
309
 
310
    portInitialized <= '0';
311
    outboundSymbolRead <= '0';
312
    inboundSymbolWrite <= '0';
313
    inboundSymbol <= (others => '0');
314
 
315
    localAckIdWrite <= '0';
316
    clrOutstandingAckId <= '0';
317
    inboundAckIdWrite <= (others=>'0');
318
    outstandingAckIdWrite <= (others=>'0');
319
    outboundAckIdWrite <= (others=>'0');
320
 
321
    -- Generate a startup reset pulse.
322
    areset_n <= '0';
323
    wait until clk'event and clk = '1';
324
    wait until clk'event and clk = '1';
325
    areset_n <= '1';
326
    wait until clk'event and clk = '1';
327
    wait until clk'event and clk = '1';
328
 
329
    ---------------------------------------------------------------------------
330
    PrintS("-----------------------------------------------------------------");
331
    PrintS("TG_RioSerial");
332
    PrintS("-----------------------------------------------------------------");
333
    PrintS("TG_RioSerial-TC1");
334
    PrintS("Description: Test idle-sequence transmission at startup.");
335
    PrintS("Requirement: XXXXX");
336
    PrintS("-----------------------------------------------------------------");
337
    PrintS("Step 1:");
338
    PrintS("Action: Read transmission port.");
339
    PrintS("Result: Idle sequence symbols should be read.");
340
    ---------------------------------------------------------------------------
341
    PrintR("TG_RioSerial-TC1-Step1");
342
    ---------------------------------------------------------------------------
343
 
344
    -- Make sure only idle-sequences are transmitted at startup.
345
    for i in 0 to 1024 loop
346
      ReceiveSymbol(SYMBOL_IDLE);
347
    end loop;
348
 
349
    ---------------------------------------------------------------------------
350
    PrintS("-----------------------------------------------------------------");
351
    PrintS("TG_RioSerial-TC2");
352
    PrintS("Description: Test idle-sequence and status symbol transmission");
353
    PrintS("             when the port has been initialized.");
354
    PrintS("Requirement: XXXXX");
355
    PrintS("-----------------------------------------------------------------");
356
    PrintS("Step 1:");
357
    PrintS("Action: Set port initialized and read transmission port.");
358
    PrintS("Result: Idle sequence and status symbols should be read.");
359
    ---------------------------------------------------------------------------
360
    PrintR("TG_RioSerial-TC2-Step1");
361
    ---------------------------------------------------------------------------
362
 
363
    -- Initialize the port to trigger a change of state.
364
    portInitialized <= '1';
365
 
366
    -- The transmitter should send idle sequences at startup and a status once
367
    -- in a while.
368
    for i in 0 to 254 loop
369
      ReceiveSymbol(SYMBOL_IDLE);
370
    end loop;
371
    ReceiveSymbol(SYMBOL_CONTROL,
372
                  RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
373
                                         STYPE1_NOP, "000"));
374
    for i in 0 to 254 loop
375
      ReceiveSymbol(SYMBOL_IDLE);
376
    end loop;
377
    ReceiveSymbol(SYMBOL_CONTROL,
378
                  RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
379
                                         STYPE1_NOP, "000"));
380
 
381
    ---------------------------------------------------------------------------
382
    PrintS("-----------------------------------------------------------------");
383
    PrintS("Step 2:");
384
    PrintS("Action: Toggle port initialized pin and check that no status ");
385
    PrintS("        symbols are transmitted when uninitialized.");
386
    PrintS("Result: Only idle sequences should be read when uninitialized.");
387
    ---------------------------------------------------------------------------
388
    PrintR("TG_RioSerial-TC2-Step2");
389
    ---------------------------------------------------------------------------
390
 
391
    -- Deassert the port initialized flag.
392
    portInitialized <= '0';
393
 
394
    -- Make sure only idle-sequences are transmitted at startup.
395
    for i in 0 to 1024 loop
396
      ReceiveSymbol(SYMBOL_IDLE);
397
    end loop;
398
 
399
    -- Initialize the port to trigger a change of state.
400
    portInitialized <= '1';
401
 
402
    -- The transmitter should send idle sequences at startup and a status once
403
    -- in a while.
404
    for i in 0 to 254 loop
405
      ReceiveSymbol(SYMBOL_IDLE);
406
    end loop;
407
    ReceiveSymbol(SYMBOL_CONTROL,
408
                  RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
409
                                         STYPE1_NOP, "000"));
410
    for i in 0 to 254 loop
411
      ReceiveSymbol(SYMBOL_IDLE);
412
    end loop;
413
    ReceiveSymbol(SYMBOL_CONTROL,
414
                  RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
415
                                         STYPE1_NOP, "000"));
416
 
417
    ---------------------------------------------------------------------------
418
    PrintS("-----------------------------------------------------------------");
419
    PrintS("Step 3:");
420
    PrintS("Action: Send one error free status symbol to trigger the ");
421
    PrintS("        transmission of status symbols with a higher frequency.");
422
    PrintS("Result: Idle sequence and status symbols should be read but ");
423
    PrintS("        status symbols should be recived more often.");
424
    ---------------------------------------------------------------------------
425
    PrintR("TG_RioSerial-TC2-Step3");
426
    ---------------------------------------------------------------------------
427
 
428
    -- A received error-free status triggers transmission of status symbols in
429
    -- a more rapid past.
430
    SendSymbol(SYMBOL_CONTROL,
431
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
432
                                      STYPE1_NOP, "000"));
433
 
434
    -- The transmitter should send at least 15 additional statuses after
435
    -- receiving an error free status.
436
    for j in 0 to 15 loop
437
      for i in 0 to 15 loop
438
        ReceiveSymbol(SYMBOL_IDLE);
439
      end loop;
440
 
441
      ReceiveSymbol(SYMBOL_CONTROL,
442
                    RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
443
                                           STYPE1_NOP, "000"));
444
    end loop;
445
 
446
    ---------------------------------------------------------------------------
447
    PrintS("-----------------------------------------------------------------");
448
    PrintS("Step 4:");
449
    PrintS("Action: Send one errornous status symbol to restart the status ");
450
    PrintS("        counting.");
451
    PrintS("Result: Idle sequence and status symbols should be read but ");
452
    PrintS("        status symbols should still be received more often.");
453
    ---------------------------------------------------------------------------
454
    PrintR("TG_RioSerial-TC2-Step4");
455
    ---------------------------------------------------------------------------
456
 
457
    -- REMARK: Add this...
458
    PrintR("Not implemented.");
459
 
460
    ---------------------------------------------------------------------------
461
    PrintS("-----------------------------------------------------------------");
462
    PrintS("Step 5:");
463
    PrintS("Action: Send one errornous status symbol to restart the status ");
464
    PrintS("        counting.");
465
    PrintS("Result: Idle sequence and status symbols should be read but ");
466
    PrintS("        status symbols should still be received more often.");
467
    ---------------------------------------------------------------------------
468
    PrintR("TG_RioSerial-TC2-Step5");
469
    ---------------------------------------------------------------------------
470
 
471
    -- Make the link fully initialized by sending 7 additional statuses.
472
    for i in 0 to 6 loop
473
      SendSymbol(SYMBOL_CONTROL,
474
                 RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
475
                                        STYPE1_NOP, "000"));
476
    end loop;
477
 
478 13 magro732
    ReceiveSymbol(SYMBOL_IDLE);
479
    ReceiveSymbol(SYMBOL_IDLE);
480 4 magro732
    wait until linkInitialized = '1';
481
 
482
    ---------------------------------------------------------------------------
483
    PrintS("-----------------------------------------------------------------");
484
    PrintS("TG_RioSerial-TC3");
485
    PrintS("Description: Test port reception.");
486
    PrintS("Requirement: XXXXX");
487
    PrintS("-----------------------------------------------------------------");
488
    PrintS("Step 1:");
489
    PrintS("Action: Send an inbound frame with pad after the CRC.");
490
    PrintS("Result: The frame should end up in a frame buffer.");
491
    ---------------------------------------------------------------------------
492
    PrintR("TG_RioSerial-TC3-Step1");
493
    ---------------------------------------------------------------------------
494
 
495
    -- Create the frame.
496
    CreateRandomPayload(payload.data, seed1, seed2);
497
    payload.length := 1;
498
    frame := RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
499
                            tt=>"01", ftype=>"0000",
500
                            sourceId=>x"0000", destId=>x"0000",
501
                            payload=>payload);
502
    frameExpected <= '1';
503
    frameRead <= frame;
504
 
505
    -- Start the reception of a frame.
506
    SendSymbol(SYMBOL_CONTROL,
507
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
508
                                      STYPE1_START_OF_PACKET, "000"));
509
 
510
    -- Send the data symbols of the frame.
511
    for i in 0 to frame.length-1 loop
512
      SendSymbol(SYMBOL_DATA, frame.payload(i));
513
    end loop;
514
 
515
    -- End the reception of the frame.
516
    SendSymbol(SYMBOL_CONTROL,
517
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
518
                                      STYPE1_END_OF_PACKET, "000"));
519
 
520
    -- Check that the frame has been received in the frame buffer.
521
    wait until frameReceived = '1';
522
    frameExpected <= '0';
523
 
524
    -- Receive an idle symbol left in the FIFO before the ack was generated.
525
    ReceiveSymbol(SYMBOL_IDLE);
526
 
527
    -- Receive acknowledge for the transmitted frame.
528
    ReceiveSymbol(SYMBOL_CONTROL,
529
                  RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00000", "11111",
530
                                         STYPE1_NOP, "000"));
531
 
532
 
533
    ---------------------------------------------------------------------------
534
    PrintS("-----------------------------------------------------------------");
535
    PrintS("Step 2:");
536
    PrintS("Action: Send an inbound frame without a pad after the CRC.");
537
    PrintS("Result: The frame should end up in a frame buffer.");
538
    ---------------------------------------------------------------------------
539
    PrintR("TG_RioSerial-TC3-Step2");
540
    ---------------------------------------------------------------------------
541
 
542
    -- Create the frame.
543
    CreateRandomPayload(payload.data, seed1, seed2);
544
    payload.length := 2;
545
    frame := RioFrameCreate(ackId=>"00001", vc=>'0', crf=>'0', prio=>"00",
546
                            tt=>"01", ftype=>"0000",
547
                            sourceId=>x"0000", destId=>x"0000",
548
                            payload=>payload);
549
    frameExpected <= '1';
550
    frameRead <= frame;
551
 
552
    -- Start the reception of a frame.
553
    SendSymbol(SYMBOL_CONTROL,
554
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
555
                                      STYPE1_START_OF_PACKET, "000"));
556
 
557
    -- Send the data symbols of the frame.
558
    for i in 0 to frame.length-1 loop
559
      SendSymbol(SYMBOL_DATA, frame.payload(i));
560
    end loop;
561
 
562
    -- End the reception of the frame.
563
    SendSymbol(SYMBOL_CONTROL,
564
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
565
                                      STYPE1_END_OF_PACKET, "000"));
566
 
567
    -- Check that the frame has been received in the frame buffer.
568
    wait until frameReceived = '1';
569
    frameExpected <= '0';
570
 
571
    -- Receive an idle symbol left in the FIFO before the ack was generated.
572
    ReceiveSymbol(SYMBOL_IDLE);
573
 
574
    -- Receive acknowledge for the transmited frame.
575
    ReceiveSymbol(SYMBOL_CONTROL,
576
                  RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00001", "11111",
577
                                         STYPE1_NOP, "000"));
578
 
579
    ---------------------------------------------------------------------------
580
    PrintS("-----------------------------------------------------------------");
581
    PrintS("Step 3:");
582
    PrintS("Action: Send an inbound frame with maximum size.");
583
    PrintS("Result: The frame should end up in a frame buffer.");
584
    ---------------------------------------------------------------------------
585
    PrintR("TG_RioSerial-TC3-Step3");
586
    ---------------------------------------------------------------------------
587
 
588
    -- Create the frame.
589
    CreateRandomPayload(payload.data, seed1, seed2);
590
    payload.length := 133;
591
    frame := RioFrameCreate(ackId=>"00010", vc=>'0', crf=>'0', prio=>"00",
592
                            tt=>"01", ftype=>"0000",
593
                            sourceId=>x"0000", destId=>x"0000",
594
                            payload=>payload);
595
    frameExpected <= '1';
596
    frameRead <= frame;
597
 
598
    -- Start the reception of a frame.
599
    SendSymbol(SYMBOL_CONTROL,
600
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
601
                                      STYPE1_START_OF_PACKET, "000"));
602
 
603
    -- Send the data symbols of the frame.
604
    for i in 0 to frame.length-1 loop
605
      SendSymbol(SYMBOL_DATA, frame.payload(i));
606
    end loop;
607
 
608
    -- End the reception of the frame.
609
    SendSymbol(SYMBOL_CONTROL,
610
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
611
                                      STYPE1_END_OF_PACKET, "000"));
612
 
613
    -- Check that the frame has been received in the frame buffer.
614
    wait until frameReceived = '1';
615
    frameExpected <= '0';
616
 
617
    -- Receive an idle symbol left in the FIFO before the ack was generated.
618
    ReceiveSymbol(SYMBOL_IDLE);
619
 
620
    -- Receive acknowledge for the transmitted frame.
621
    ReceiveSymbol(SYMBOL_CONTROL,
622
                  RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00010", "11111",
623
                                         STYPE1_NOP, "000"));
624
 
625
 
626
    ---------------------------------------------------------------------------
627
    PrintS("-----------------------------------------------------------------");
628
    PrintS("Step 4:");
629
    PrintS("Action: Send two packets without end-of-packet in between.");
630
    PrintS("Result: Both packets should be accepted.");
631
    ---------------------------------------------------------------------------
632
    PrintR("TG_RioSerial-TC3-Step4");
633
    ---------------------------------------------------------------------------
634
 
635
    -- Create the first frame.
636
    CreateRandomPayload(payload.data, seed1, seed2);
637
    payload.length := 10;
638
    frame := RioFrameCreate(ackId=>"00011", vc=>'0', crf=>'0', prio=>"00",
639
                            tt=>"01", ftype=>"0000",
640
                            sourceId=>x"0000", destId=>x"0000",
641
                            payload=>payload);
642
    frameExpected <= '1';
643
    frameRead <= frame;
644
 
645
    -- Start the reception of a frame.
646
    SendSymbol(SYMBOL_CONTROL,
647
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
648
                                      STYPE1_START_OF_PACKET, "000"));
649
 
650
    -- Send the data symbols of the frame.
651
    for i in 0 to frame.length-1 loop
652
      SendSymbol(SYMBOL_DATA, frame.payload(i));
653
    end loop;
654
 
655
    -- Start the reception of a frame, implicitly ending the previous.
656
    SendSymbol(SYMBOL_CONTROL,
657
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
658
                                      STYPE1_START_OF_PACKET, "000"));
659
 
660
    -- Check that the frame has been received in the frame buffer.
661
    wait until frameReceived = '1';
662
    frameExpected <= '0';
663
    wait until clk'event and clk = '1';
664
 
665
    -- Receive an idle symbol left in the FIFO before the ack was generated.
666
    ReceiveSymbol(SYMBOL_IDLE);
667
 
668
    -- Receive acknowledge for the transmitted frame.
669
    ReceiveSymbol(SYMBOL_CONTROL,
670
                  RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00011", "11111",
671
                                         STYPE1_NOP, "000"));
672
 
673
    -- Create the second frame.
674
    CreateRandomPayload(payload.data, seed1, seed2);
675
    payload.length := 13;
676
    frame := RioFrameCreate(ackId=>"00100", vc=>'0', crf=>'0', prio=>"00",
677
                            tt=>"01", ftype=>"0000",
678
                            sourceId=>x"0000", destId=>x"0000",
679
                            payload=>payload);
680
    frameExpected <= '1';
681
    frameRead <= frame;
682
 
683
    -- Send the data symbols of the frame.
684
    for i in 0 to frame.length-1 loop
685
      SendSymbol(SYMBOL_DATA, frame.payload(i));
686
    end loop;
687
 
688
    -- End the reception of the frame.
689
    SendSymbol(SYMBOL_CONTROL,
690
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
691
                                      STYPE1_END_OF_PACKET, "000"));
692
 
693
    -- Check that the frame has been received in the frame buffer.
694
    wait until frameReceived = '1';
695
    frameExpected <= '0';
696
 
697
    -- Receive an idle symbol left in the FIFO before the ack was generated.
698
    ReceiveSymbol(SYMBOL_IDLE);
699
 
700
    -- Receive acknowledge for the transmitted frame.
701
    ReceiveSymbol(SYMBOL_CONTROL,
702
                  RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00100", "11111",
703
                                         STYPE1_NOP, "000"));
704
 
705
    ---------------------------------------------------------------------------
706
    PrintS("-----------------------------------------------------------------");
707
    PrintS("Step 5:");
708
    PrintS("Action: Start to send a packet. Abort it with stomp. Then send ");
709
    PrintS("        another packet.");
710
    PrintS("Result: The first packet should be discarded and the second should");
711
    PrintS("        be accepted. The retried packet should be acknowledged.");
712
    ---------------------------------------------------------------------------
713
    PrintR("TG_RioSerial-TC3-Step5");
714
    ---------------------------------------------------------------------------
715
 
716
    -- Create the frame.
717
    CreateRandomPayload(payload.data, seed1, seed2);
718
    payload.length := 7;
719
    frame := RioFrameCreate(ackId=>"00101", vc=>'0', crf=>'0', prio=>"00",
720
                            tt=>"01", ftype=>"0000",
721
                            sourceId=>x"0000", destId=>x"0000",
722
                            payload=>payload);
723
    frameExpected <= '1';
724
    frameRead <= frame;
725
 
726
    -- Start the reception of a frame.
727
    SendSymbol(SYMBOL_CONTROL,
728
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
729
                                      STYPE1_START_OF_PACKET, "000"));
730
 
731
    -- Send the data symbols of the frame.
732
    for i in 0 to frame.length-1 loop
733
      SendSymbol(SYMBOL_DATA, frame.payload(i));
734
    end loop;
735
 
736
    -- Abort the reception of the frame.
737
    SendSymbol(SYMBOL_CONTROL,
738
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
739
                                      STYPE1_STOMP, "000"));
740
 
741
    -- Dont expect the aborted frame anymore.
742
    frameExpected <= '0';
743
 
744
    -- Receive an idle symbol left in the FIFO before the retry was generated.
745
    ReceiveSymbol(SYMBOL_IDLE);
746
 
747
    -- Receive acknowledge for the transmitted frame.
748
    ReceiveSymbol(SYMBOL_CONTROL,
749
                  RioControlSymbolCreate(STYPE0_PACKET_RETRY, "00101", "11111",
750
                                         STYPE1_NOP, "000"));
751
 
752
    -- Acknowledge the canceled packet.
753
    SendSymbol(SYMBOL_CONTROL,
754
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
755
                                      STYPE1_RESTART_FROM_RETRY, "000"));
756
 
757
    -- Create a new frame.
758
    CreateRandomPayload(payload.data, seed1, seed2);
759
    payload.length := 8;
760
    frame := RioFrameCreate(ackId=>"00101", vc=>'0', crf=>'0', prio=>"00",
761
                            tt=>"01", ftype=>"0000",
762
                            sourceId=>x"0000", destId=>x"0000",
763
                            payload=>payload);
764
    frameExpected <= '1';
765
    frameRead <= frame;
766
 
767
    -- Start the reception of a frame.
768
    SendSymbol(SYMBOL_CONTROL,
769
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
770
                                      STYPE1_START_OF_PACKET, "000"));
771
 
772
    -- Send the data symbols of the frame.
773
    for i in 0 to frame.length-1 loop
774
      SendSymbol(SYMBOL_DATA, frame.payload(i));
775
    end loop;
776
 
777
    -- Abort the reception of the frame.
778
    SendSymbol(SYMBOL_CONTROL,
779
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
780
                                      STYPE1_END_OF_PACKET, "000"));
781
 
782
    -- Check that the frame has been received in the frame buffer.
783
    wait until frameReceived = '1';
784
    frameExpected <= '0';
785
 
786
    -- Receive an idle symbol left in the FIFO before the ack was generated.
787
    ReceiveSymbol(SYMBOL_IDLE);
788
 
789
    -- Receive acknowledge for the transmitted frame.
790
    ReceiveSymbol(SYMBOL_CONTROL,
791
                  RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00101", "11111",
792
                                         STYPE1_NOP, "000"));
793
 
794
    ---------------------------------------------------------------------------
795
    PrintS("-----------------------------------------------------------------");
796
    PrintS("Step 6:");
797
    PrintS("Action: Start to send a packet but dont send any payload. Abort it");
798
    PrintS("        with stomp. Then send another packet.");
799
    PrintS("Result: The first packet should be discarded and the second should");
800
    PrintS("        be accepted. The retried packet should be acknowledged.");
801
    ---------------------------------------------------------------------------
802
    PrintR("TG_RioSerial-TC3-Step6");
803
    ---------------------------------------------------------------------------
804
 
805
    -- Start the reception of a frame.
806
    SendSymbol(SYMBOL_CONTROL,
807
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
808
                                      STYPE1_START_OF_PACKET, "000"));
809
 
810
    -- Abort the reception of the frame.
811
    SendSymbol(SYMBOL_CONTROL,
812
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
813
                                      STYPE1_STOMP, "000"));
814
 
815
    -- Receive an idle symbol left in the FIFO before the retry was generated.
816
    ReceiveSymbol(SYMBOL_IDLE);
817
 
818
    -- Receive acknowledge for the transmitted frame.
819
    ReceiveSymbol(SYMBOL_CONTROL,
820
                  RioControlSymbolCreate(STYPE0_PACKET_RETRY, "00110", "11111",
821
                                         STYPE1_NOP, "000"));
822
 
823
    -- Acknowledge the canceled packet.
824
    SendSymbol(SYMBOL_CONTROL,
825
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
826
                                      STYPE1_RESTART_FROM_RETRY, "000"));
827
 
828
    -- Create a new frame.
829
    CreateRandomPayload(payload.data, seed1, seed2);
830
    payload.length := 8;
831
    frame := RioFrameCreate(ackId=>"00110", vc=>'0', crf=>'0', prio=>"00",
832
                            tt=>"01", ftype=>"0000",
833
                            sourceId=>x"0000", destId=>x"0000",
834
                            payload=>payload);
835
    frameExpected <= '1';
836
    frameRead <= frame;
837
 
838
    -- Start the reception of a frame.
839
    SendSymbol(SYMBOL_CONTROL,
840
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
841
                                      STYPE1_START_OF_PACKET, "000"));
842
 
843
    -- Send the data symbols of the frame.
844
    for i in 0 to frame.length-1 loop
845
      SendSymbol(SYMBOL_DATA, frame.payload(i));
846
    end loop;
847
 
848
    -- Abort the reception of the frame.
849
    SendSymbol(SYMBOL_CONTROL,
850
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
851
                                      STYPE1_END_OF_PACKET, "000"));
852
 
853
    -- Check that the frame has been received in the frame buffer.
854
    wait until frameReceived = '1';
855
    frameExpected <= '0';
856
 
857
    -- Receive an idle symbol left in the FIFO before the ack was generated.
858
    ReceiveSymbol(SYMBOL_IDLE);
859
 
860
    -- Receive acknowledge for the transmitted frame.
861
    ReceiveSymbol(SYMBOL_CONTROL,
862
                  RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00110", "11111",
863
                                         STYPE1_NOP, "000"));
864
 
865
    ---------------------------------------------------------------------------
866
    PrintS("-----------------------------------------------------------------");
867
    PrintS("Step 7:");
868
    PrintS("Action: Start to send a packet with payload, then send a ");
869
    PrintS("        link-request. Then send another packet.");
870
    PrintS("Result: The first packet should be canceled without any ");
871
    PrintS("        confirmation and a link-response should be returned. The");
872
    PrintS("        second packet should be accepted.");
873
    ---------------------------------------------------------------------------
874
    PrintR("TG_RioSerial-TC3-Step7");
875
    ---------------------------------------------------------------------------
876
 
877
    -- Create a new frame.
878
    CreateRandomPayload(payload.data, seed1, seed2);
879
    payload.length := 9;
880
    frame := RioFrameCreate(ackId=>"00111", vc=>'0', crf=>'0', prio=>"00",
881
                            tt=>"01", ftype=>"0000",
882
                            sourceId=>x"0000", destId=>x"0000",
883
                            payload=>payload);
884
    frameExpected <= '1';
885
    frameRead <= frame;
886
 
887
    -- Start the reception of a frame.
888
    SendSymbol(SYMBOL_CONTROL,
889
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
890
                                      STYPE1_START_OF_PACKET, "000"));
891
 
892
    -- Send the data symbols of the frame.
893
    for i in 0 to frame.length-1 loop
894
      SendSymbol(SYMBOL_DATA, frame.payload(i));
895
    end loop;
896
 
897
    -- Send a link-request/input-status to abort the current packet.
898
    SendSymbol(SYMBOL_CONTROL,
899
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
900
                                      STYPE1_LINK_REQUEST, "100"));
901
 
902
    -- Receive an idle symbol left in the FIFO before the ack was generated.
903
    ReceiveSymbol(SYMBOL_IDLE);
904
 
905
    -- The frame should be canceled by the link-request, dont expect it anymore.
906
    frameExpected <= '0';
907
 
908
    -- Receive link-response indicating normal operation and expected ackId.
909
    ReceiveSymbol(SYMBOL_CONTROL,
910
                  RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "00111", "10000",
911
                                         STYPE1_NOP, "000"));
912
 
913
    -- Create a new frame.
914
    CreateRandomPayload(payload.data, seed1, seed2);
915
    payload.length := 10;
916
    frame := RioFrameCreate(ackId=>"00111", vc=>'0', crf=>'0', prio=>"00",
917
                            tt=>"01", ftype=>"0000",
918
                            sourceId=>x"0000", destId=>x"0000",
919
                            payload=>payload);
920
    frameExpected <= '1';
921
    frameRead <= frame;
922
 
923
    -- Start the reception of a frame.
924
    SendSymbol(SYMBOL_CONTROL,
925
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
926
                                      STYPE1_START_OF_PACKET, "000"));
927
 
928
    -- Send the data symbols of the frame.
929
    for i in 0 to frame.length-1 loop
930
      SendSymbol(SYMBOL_DATA, frame.payload(i));
931
    end loop;
932
 
933
    -- Abort the reception of the frame.
934
    SendSymbol(SYMBOL_CONTROL,
935
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
936
                                      STYPE1_END_OF_PACKET, "000"));
937
 
938
    -- Check that the frame has been received in the frame buffer.
939
    wait until frameReceived = '1';
940
    frameExpected <= '0';
941
 
942
    -- Receive an idle symbol left in the FIFO before the ack was generated.
943
    ReceiveSymbol(SYMBOL_IDLE);
944
 
945
    -- Receive acknowledge for the transmitted frame.
946
    ReceiveSymbol(SYMBOL_CONTROL,
947
                  RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00111", "11111",
948
                                         STYPE1_NOP, "000"));
949
 
950
    ---------------------------------------------------------------------------
951
    PrintS("-----------------------------------------------------------------");
952
    PrintS("Step 8:");
953
    PrintS("Action: Start to send a packet, no payload, then send a ");
954
    PrintS("        link-request. Then send another packet.");
955
    PrintS("Result: The first packet should be canceled without any ");
956
    PrintS("        confirmation and a link-response should be returned. The");
957
    PrintS("        second packet should be accepted.");
958
    ---------------------------------------------------------------------------
959
    PrintR("TG_RioSerial-TC3-Step8");
960
    ---------------------------------------------------------------------------
961
 
962
    -- Expect an empty packet to be aborted.
963
    frameExpected <= '1';
964
 
965
    -- Start the reception of a frame.
966
    SendSymbol(SYMBOL_CONTROL,
967
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
968
                                      STYPE1_START_OF_PACKET, "000"));
969
 
970
    -- Send a link-request/input-status to abort the current packet.
971
    SendSymbol(SYMBOL_CONTROL,
972
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
973
                                      STYPE1_LINK_REQUEST, "100"));
974
 
975
    -- Receive an idle symbol left in the FIFO before the ack was generated.
976
    ReceiveSymbol(SYMBOL_IDLE);
977
 
978
    -- Dont expect any frames anymore.
979
    frameExpected <= '0';
980
 
981
    -- Receive link-response indicating normal operation and expected ackId.
982
    ReceiveSymbol(SYMBOL_CONTROL,
983
                  RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01000", "10000",
984
                                         STYPE1_NOP, "000"));
985
 
986
    -- Create a new frame.
987
    CreateRandomPayload(payload.data, seed1, seed2);
988
    payload.length := 11;
989
    frame := RioFrameCreate(ackId=>"01000", vc=>'0', crf=>'0', prio=>"00",
990
                            tt=>"01", ftype=>"0000",
991
                            sourceId=>x"0000", destId=>x"0000",
992
                            payload=>payload);
993
    frameExpected <= '1';
994
    frameRead <= frame;
995
 
996
    -- Start the reception of a frame.
997
    SendSymbol(SYMBOL_CONTROL,
998
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
999
                                      STYPE1_START_OF_PACKET, "000"));
1000
 
1001
    -- Send the data symbols of the frame.
1002
    for i in 0 to frame.length-1 loop
1003
      SendSymbol(SYMBOL_DATA, frame.payload(i));
1004
    end loop;
1005
 
1006
    -- Abort the reception of the frame.
1007
    SendSymbol(SYMBOL_CONTROL,
1008
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1009
                                      STYPE1_END_OF_PACKET, "000"));
1010
 
1011
    -- Check that the frame has been received in the frame buffer.
1012
    wait until frameReceived = '1';
1013
    frameExpected <= '0';
1014
 
1015
    -- Receive an idle symbol left in the FIFO before the ack was generated.
1016
    ReceiveSymbol(SYMBOL_IDLE);
1017
 
1018
    -- Receive acknowledge for the transmitted frame.
1019
    ReceiveSymbol(SYMBOL_CONTROL,
1020
                  RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01000", "11111",
1021
                                         STYPE1_NOP, "000"));
1022
 
1023
    ---------------------------------------------------------------------------
1024
    PrintS("-----------------------------------------------------------------");
1025
    PrintS("Step 9:");
1026
    PrintS("Action: Send a packet when no buffers is available. Reset receiver");
1027
    PrintS("        with link-request.");
1028
    PrintS("Result: A packet-retry should be transmitted and receiver should");
1029
    PrintS("        enter input-retry-stopped.");
1030
    ---------------------------------------------------------------------------
1031
    PrintR("TG_RioSerial-TC3-Step9");
1032
    ---------------------------------------------------------------------------
1033
 
1034
    -- Create a new frame.
1035
    CreateRandomPayload(payload.data, seed1, seed2);
1036
    payload.length := 11;
1037
    frame := RioFrameCreate(ackId=>"01001", vc=>'0', crf=>'0', prio=>"00",
1038
                            tt=>"01", ftype=>"0000",
1039
                            sourceId=>x"0000", destId=>x"0000",
1040
                            payload=>payload);
1041
 
1042
    -- Start the reception of a frame.
1043
    SendSymbol(SYMBOL_CONTROL,
1044
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1045
                                      STYPE1_START_OF_PACKET, "000"));
1046
    SendSymbol(SYMBOL_DATA, frame.payload(0));
1047
 
1048
    -- Receive notification about that the packet needs to be retried.
1049
    ReceiveSymbol(SYMBOL_IDLE);
1050
    ReceiveSymbol(SYMBOL_CONTROL,
1051
                  RioControlSymbolCreate(STYPE0_PACKET_RETRY, "01001", "11111",
1052
                                         STYPE1_NOP, "000"));
1053
 
1054
    -- Check the status of the input port and verify the input-retry-stopped state.
1055
    -- This should also set the receiver into normal operation.
1056
    SendSymbol(SYMBOL_CONTROL,
1057
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1058
                                      STYPE1_LINK_REQUEST, "100"));
1059
    ReceiveSymbol(SYMBOL_IDLE);
1060
    ReceiveSymbol(SYMBOL_CONTROL,
1061
                  RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01001", "00100",
1062
                                         STYPE1_NOP, "000"));
1063
 
1064
    -- Check the status of the input port and verify the input-retry-stopped state.
1065
    SendSymbol(SYMBOL_CONTROL,
1066
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1067
                                      STYPE1_LINK_REQUEST, "100"));
1068
    ReceiveSymbol(SYMBOL_IDLE);
1069
    ReceiveSymbol(SYMBOL_CONTROL,
1070
                  RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01001", "10000",
1071
                                         STYPE1_NOP, "000"));
1072
 
1073
    ---------------------------------------------------------------------------
1074
    PrintS("-----------------------------------------------------------------");
1075
    PrintS("Step 10:");
1076
    PrintS("Action: Send a packet when no buffers is available. Reset receiver");
1077
    PrintS("        with restart-from-retry.");
1078
    PrintS("Result: A packet-retry should be transmitted and receiver should");
1079
    PrintS("        enter input-retry-stopped.");
1080
    ---------------------------------------------------------------------------
1081
    PrintR("TG_RioSerial-TC3-Step10");
1082
    ---------------------------------------------------------------------------
1083
 
1084
    -- Create a new frame.
1085
    CreateRandomPayload(payload.data, seed1, seed2);
1086
    payload.length := 11;
1087
    frame := RioFrameCreate(ackId=>"01001", vc=>'0', crf=>'0', prio=>"00",
1088
                            tt=>"01", ftype=>"0000",
1089
                            sourceId=>x"0000", destId=>x"0000",
1090
                            payload=>payload);
1091
 
1092
    -- Start the reception of a frame.
1093
    SendSymbol(SYMBOL_CONTROL,
1094
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1095
                                      STYPE1_START_OF_PACKET, "000"));
1096
    SendSymbol(SYMBOL_DATA, frame.payload(0));
1097
 
1098
    -- Receive notification about that the packet needs to be retried.
1099
    ReceiveSymbol(SYMBOL_IDLE);
1100
    ReceiveSymbol(SYMBOL_CONTROL,
1101
                  RioControlSymbolCreate(STYPE0_PACKET_RETRY, "01001", "11111",
1102
                                         STYPE1_NOP, "000"));
1103
 
1104
    -- Acknowledge the retried packet.
1105
    SendSymbol(SYMBOL_CONTROL,
1106
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1107
                                      STYPE1_RESTART_FROM_RETRY, "000"));
1108
 
1109
    -- Check the status of the input port and verify the input-retry-stopped state.
1110
    SendSymbol(SYMBOL_CONTROL,
1111
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1112
                                      STYPE1_LINK_REQUEST, "100"));
1113
    ReceiveSymbol(SYMBOL_IDLE);
1114
    ReceiveSymbol(SYMBOL_CONTROL,
1115
                  RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01001", "10000",
1116
                                         STYPE1_NOP, "000"));
1117
 
1118
    -- Always receive a status after a link response when leaving input-error-stopped.
1119
--    ReceiveSymbol(SYMBOL_CONTROL,
1120
--                  RioControlSymbolCreate(STYPE0_STATUS, "01001", "11111",
1121
--                                         STYPE1_NOP, "000"));    
1122
 
1123
    ---------------------------------------------------------------------------
1124
    PrintS("-----------------------------------------------------------------");
1125
    PrintS("Step 11:");
1126
    PrintS("Action: Start a new packet when in input-retry-stopped state.");
1127
    PrintS("Result: The packet should be discarded.");
1128
    ---------------------------------------------------------------------------
1129
    PrintR("TG_RioSerial-TC3-Step11");
1130
    ---------------------------------------------------------------------------
1131
 
1132
    -- Create a new frame.
1133
    CreateRandomPayload(payload.data, seed1, seed2);
1134
    payload.length := 11;
1135
    frame := RioFrameCreate(ackId=>"01001", vc=>'0', crf=>'0', prio=>"00",
1136
                            tt=>"01", ftype=>"0000",
1137
                            sourceId=>x"0000", destId=>x"0000",
1138
                            payload=>payload);
1139
 
1140
    -- Start the reception of a frame.
1141
    SendSymbol(SYMBOL_CONTROL,
1142
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1143
                                      STYPE1_START_OF_PACKET, "000"));
1144
    SendSymbol(SYMBOL_DATA, frame.payload(0));
1145
 
1146
    -- Receive notification about that the packet needs to be retried.
1147
    ReceiveSymbol(SYMBOL_IDLE);
1148
    ReceiveSymbol(SYMBOL_CONTROL,
1149
                  RioControlSymbolCreate(STYPE0_PACKET_RETRY, "01001", "11111",
1150
                                         STYPE1_NOP, "000"));
1151
 
1152
    -- Create a packet and send it. It should be discarded.
1153
    CreateRandomPayload(payload.data, seed1, seed2);
1154
    payload.length := 12;
1155
    frame := RioFrameCreate(ackId=>"01001", vc=>'0', crf=>'0', prio=>"00",
1156
                            tt=>"01", ftype=>"0000",
1157
                            sourceId=>x"0000", destId=>x"0000",
1158
                            payload=>payload);
1159
    SendSymbol(SYMBOL_CONTROL,
1160
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1161
                                      STYPE1_START_OF_PACKET, "000"));
1162
    for i in 0 to frame.length-1 loop
1163
      SendSymbol(SYMBOL_DATA, frame.payload(i));
1164
    end loop;
1165
    SendSymbol(SYMBOL_CONTROL,
1166
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1167
                                      STYPE1_END_OF_PACKET, "000"));
1168
 
1169
    -- Acknowledge the retried packet.
1170
    SendSymbol(SYMBOL_CONTROL,
1171
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1172
                                      STYPE1_RESTART_FROM_RETRY, "000"));
1173
 
1174
    -- Create a packet and send it.
1175
    CreateRandomPayload(payload.data, seed1, seed2);
1176
    payload.length := 13;
1177
    frame := RioFrameCreate(ackId=>"01001", vc=>'0', crf=>'0', prio=>"00",
1178
                            tt=>"01", ftype=>"0000",
1179
                            sourceId=>x"0000", destId=>x"0000",
1180
                            payload=>payload);
1181
    frameExpected <= '1';
1182
    frameRead <= frame;
1183
    SendSymbol(SYMBOL_CONTROL,
1184
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1185
                                      STYPE1_START_OF_PACKET, "000"));
1186
    for i in 0 to frame.length-1 loop
1187
      SendSymbol(SYMBOL_DATA, frame.payload(i));
1188
    end loop;
1189
    SendSymbol(SYMBOL_CONTROL,
1190
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1191
                                      STYPE1_END_OF_PACKET, "000"));
1192
    wait until frameReceived = '1';
1193
    frameExpected <= '0';
1194
 
1195
    -- Receive acknowledge for the transmitted frame.
1196
    ReceiveSymbol(SYMBOL_IDLE);
1197
    ReceiveSymbol(SYMBOL_CONTROL,
1198
                  RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01001", "11111",
1199
                                         STYPE1_NOP, "000"));
1200
 
1201
    ---------------------------------------------------------------------------
1202
    PrintS("-----------------------------------------------------------------");
1203
    PrintS("Step 12:");
1204
    PrintS("Action: Send an erronous control-symbol. Then restore with");
1205
    PrintS("        link-request.");
1206
    PrintS("Result: Receiver should enter input-error-stopped and return to");
1207
    PrintS("        normal operation after the link-request was receiver.");
1208
    ---------------------------------------------------------------------------
1209
    PrintR("TG_RioSerial-TC3-Step12");
1210
    ---------------------------------------------------------------------------
1211
 
1212
    -- Create, corrupt and send a control symbol.
1213
    SendSymbol(SYMBOL_CONTROL,
1214
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1215
                                      STYPE1_START_OF_PACKET, "000") xor x"00100000");
1216
 
1217
    -- Receive a packet-not-accepted indicating error in control-symbol crc.
1218
    ReceiveSymbol(SYMBOL_IDLE);
1219
    ReceiveSymbol(SYMBOL_CONTROL,
1220
                  RioControlSymbolCreate(STYPE0_PACKET_NOT_ACCEPTED, "00000", "00010",
1221
                                         STYPE1_NOP, "000"));
1222
 
1223
    -- Create a packet and send it. It should be discarded.
1224
    CreateRandomPayload(payload.data, seed1, seed2);
1225
    payload.length := 14;
1226
    frame := RioFrameCreate(ackId=>"01010", vc=>'0', crf=>'0', prio=>"00",
1227
                            tt=>"01", ftype=>"0000",
1228
                            sourceId=>x"0000", destId=>x"0000",
1229
                            payload=>payload);
1230
    SendSymbol(SYMBOL_CONTROL,
1231
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1232
                                      STYPE1_START_OF_PACKET, "000"));
1233
    for i in 0 to frame.length-1 loop
1234
      SendSymbol(SYMBOL_DATA, frame.payload(i));
1235
    end loop;
1236
    SendSymbol(SYMBOL_CONTROL,
1237
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1238
                                      STYPE1_END_OF_PACKET, "000"));
1239
 
1240
    -- Make the receiver go back to normal operation by sending a link-request.
1241
    SendSymbol(SYMBOL_CONTROL,
1242
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1243
                                      STYPE1_LINK_REQUEST, "100"));
1244
 
1245
    ReceiveSymbol(SYMBOL_IDLE);
1246
    ReceiveSymbol(SYMBOL_CONTROL,
1247
                  RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01010", "00101",
1248
                                         STYPE1_NOP, "000"));
1249
 
1250
    -- Always receive a status after a link response when leaving input-error-stopped.
1251
--    ReceiveSymbol(SYMBOL_CONTROL,
1252
--                  RioControlSymbolCreate(STYPE0_STATUS, "01010", "11111",
1253
--                                         STYPE1_NOP, "000"));
1254
 
1255
    -- Create a packet and send it.
1256
    CreateRandomPayload(payload.data, seed1, seed2);
1257
    payload.length := 15;
1258
    frame := RioFrameCreate(ackId=>"01010", vc=>'0', crf=>'0', prio=>"00",
1259
                            tt=>"01", ftype=>"0000",
1260
                            sourceId=>x"0000", destId=>x"0000",
1261
                            payload=>payload);
1262
    frameExpected <= '1';
1263
    frameRead <= frame;
1264
    SendSymbol(SYMBOL_CONTROL,
1265
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1266
                                      STYPE1_START_OF_PACKET, "000"));
1267
    for i in 0 to frame.length-1 loop
1268
      SendSymbol(SYMBOL_DATA, frame.payload(i));
1269
    end loop;
1270
    SendSymbol(SYMBOL_CONTROL,
1271
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1272
                                      STYPE1_END_OF_PACKET, "000"));
1273
    wait until frameReceived = '1';
1274
    frameExpected <= '0';
1275
 
1276
    -- Receive acknowledge for the transmitted frame.
1277
    ReceiveSymbol(SYMBOL_IDLE);
1278
    ReceiveSymbol(SYMBOL_CONTROL,
1279
                  RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01010", "11111",
1280
                                         STYPE1_NOP, "000"));
1281
 
1282
    ---------------------------------------------------------------------------
1283
    PrintS("-----------------------------------------------------------------");
1284
    PrintS("Step 13:");
1285
    PrintS("Action: Send an erronous packet. Then restore with link-request.");
1286
    PrintS("Result: Receiver should enter input-error-stopped and return to");
1287
    PrintS("        normal operation after the link-request was receiver.");
1288
    ---------------------------------------------------------------------------
1289
    PrintR("TG_RioSerial-TC3-Step13");
1290
    ---------------------------------------------------------------------------
1291
 
1292
    -- Create a packet and send it with a bit error. It should be discarded.
1293
    CreateRandomPayload(payload.data, seed1, seed2);
1294
    payload.length := 15;
1295
    frame := RioFrameCreate(ackId=>"01011", vc=>'0', crf=>'0', prio=>"00",
1296
                            tt=>"01", ftype=>"0000",
1297
                            sourceId=>x"0000", destId=>x"0000",
1298
                            payload=>payload);
1299
    frame.payload(0) := frame.payload(0) xor x"00000010";
1300
    frameExpected <= '1';
1301
    frameRead <= frame;
1302
    SendSymbol(SYMBOL_CONTROL,
1303
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1304
                                      STYPE1_START_OF_PACKET, "000"));
1305
    for i in 0 to frame.length-1 loop
1306
      SendSymbol(SYMBOL_DATA, frame.payload(i));
1307
    end loop;
1308
    SendSymbol(SYMBOL_CONTROL,
1309
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1310
                                      STYPE1_END_OF_PACKET, "000"));
1311
 
1312
    -- Receive a packet-not-accepted indicating error in control-symbol crc.
1313
    ReceiveSymbol(SYMBOL_IDLE);
1314
    ReceiveSymbol(SYMBOL_CONTROL,
1315
                  RioControlSymbolCreate(STYPE0_PACKET_NOT_ACCEPTED, "00000", "00100",
1316
                                         STYPE1_NOP, "000"));
1317
 
1318
    -- Dont expect any frame anymore.
1319
    frameExpected <= '0';
1320
 
1321
    -- Make the receiver go back to normal operation by sending a link-request.
1322
    SendSymbol(SYMBOL_CONTROL,
1323
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1324
                                      STYPE1_LINK_REQUEST, "100"));
1325
 
1326
    ReceiveSymbol(SYMBOL_IDLE);
1327
    ReceiveSymbol(SYMBOL_CONTROL,
1328
                  RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01011", "00101",
1329
                                         STYPE1_NOP, "000"));
1330
 
1331
    -- Send a new frame without error.
1332
    CreateRandomPayload(payload.data, seed1, seed2);
1333
    payload.length := 16;
1334
    frame := RioFrameCreate(ackId=>"01011", vc=>'0', crf=>'0', prio=>"00",
1335
                            tt=>"01", ftype=>"0000",
1336
                            sourceId=>x"0000", destId=>x"0000",
1337
                            payload=>payload);
1338
    frameExpected <= '1';
1339
    frameRead <= frame;
1340
    SendSymbol(SYMBOL_CONTROL,
1341
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1342
                                      STYPE1_START_OF_PACKET, "000"));
1343
    for i in 0 to frame.length-1 loop
1344
      SendSymbol(SYMBOL_DATA, frame.payload(i));
1345
    end loop;
1346
    SendSymbol(SYMBOL_CONTROL,
1347
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
1348
                                      STYPE1_END_OF_PACKET, "000"));
1349
    wait until frameReceived = '1';
1350
    frameExpected <= '0';
1351
 
1352
    -- Receive acknowledge for the transmitted frame.
1353
    ReceiveSymbol(SYMBOL_IDLE);
1354
    ReceiveSymbol(SYMBOL_CONTROL,
1355
                  RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01011", "11111",
1356
                                         STYPE1_NOP, "000"));
1357
 
1358
    -- REMARK: Complete with some more error situations: invalid ackId, too
1359
    -- short packet, too long packet, etc...
1360
 
1361
    ---------------------------------------------------------------------------
1362
    PrintS("-----------------------------------------------------------------");
1363
    PrintS("TG_RioSerial-TC4");
1364
    PrintS("Description: Test port transmission.");
1365
    PrintS("Requirement: XXXXX");
1366
    PrintS("-----------------------------------------------------------------");
1367
    PrintS("Step 1:");
1368
    PrintS("Action: Send an outbound frame.");
1369
    PrintS("Result: The frame should be read from the frame buffer and ");
1370
    PrintS("        received as symbols.");
1371
    ---------------------------------------------------------------------------
1372
    PrintR("TG_RioSerial-TC4-Step1");
1373
    ---------------------------------------------------------------------------
1374
 
1375
    -- Create the frame.
1376
    CreateRandomPayload(payload.data, seed1, seed2);
1377
    payload.length := 3;
1378
    frame := RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
1379
                            tt=>"01", ftype=>"0000",
1380
                            sourceId=>x"0000", destId=>x"0000",
1381
                            payload=>payload);
1382
    frameValid(0) <= '1';
1383
    frameWrite(0) <= frame;
1384
 
1385
    -- Make sure the transmitter fills in the correct ackId and dont use the
1386
    -- one in the input packet.
1387
    frameWrite(0).payload(0)(31 downto 27) <= "UUUUU";
1388
 
1389
    -- Receive an idle symbol left in the FIFO before the start of the frame was
1390
    -- generated.
1391
    ReceiveSymbol(SYMBOL_IDLE);
1392
 
1393
    -- Receive the start of the frame.
1394
    ReceiveSymbol(SYMBOL_CONTROL,
1395
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1396
                                         STYPE1_START_OF_PACKET, "000"));
1397
 
1398
    -- Receive the data symbols of the frame.
1399
    for i in 0 to frame.length-1 loop
1400
      ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
1401
    end loop;
1402
 
1403
    -- Wait for the frame to complete.
1404 13 magro732
    wait until frameComplete = '1' and clk'event and clk = '1';
1405 4 magro732
    frameValid(0) <= '0';
1406
 
1407
    -- Receive the end of the frame.
1408
    ReceiveSymbol(SYMBOL_CONTROL,
1409
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1410
                                         STYPE1_END_OF_PACKET, "000"));
1411
 
1412
    -- Send acknowledge that the frame was received.
1413
    SendSymbol(SYMBOL_CONTROL,
1414
               RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00000", "11111",
1415
                                      STYPE1_NOP, "000"));
1416
 
1417
    ---------------------------------------------------------------------------
1418
    PrintS("-----------------------------------------------------------------");
1419
    PrintS("Step 2:");
1420
    PrintS("Action: Send an outbound packet with maximum length.");
1421
    PrintS("Result: The packet should be fragmented and received in symbols.");
1422
    ---------------------------------------------------------------------------
1423
    PrintR("TG_RioSerial-TC4-Step2");
1424
    ---------------------------------------------------------------------------
1425
 
1426
    -- Create the frame.
1427
    CreateRandomPayload(payload.data, seed1, seed2);
1428
    payload.length := 133;
1429
    frame := RioFrameCreate(ackId=>"00001", vc=>'0', crf=>'0', prio=>"00",
1430
                            tt=>"01", ftype=>"0000",
1431
                            sourceId=>x"0000", destId=>x"0000",
1432
                            payload=>payload);
1433
    frameValid(1) <= '1';
1434
    frameWrite(1) <= frame;
1435
 
1436
    -- Receive an idle symbol left in the FIFO before the start of the frame was
1437
    -- generated.
1438
    ReceiveSymbol(SYMBOL_IDLE);
1439
 
1440
    -- Receive the start of the frame.
1441
    ReceiveSymbol(SYMBOL_CONTROL,
1442
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1443
                                         STYPE1_START_OF_PACKET, "000"));
1444
 
1445
    -- Receive the data symbols of the frame.
1446
    for i in 0 to frame.length-1 loop
1447
      ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
1448
    end loop;
1449
 
1450
    -- Wait for the frame to complete.
1451 13 magro732
    wait until frameComplete = '1' and clk'event and clk = '1';
1452 4 magro732
    frameValid(1) <= '0';
1453
 
1454
    -- Receive the end of the frame.
1455
    ReceiveSymbol(SYMBOL_CONTROL,
1456
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1457
                                         STYPE1_END_OF_PACKET, "000"));
1458
 
1459
    -- Send acknowledge that the frame was received.
1460
    SendSymbol(SYMBOL_CONTROL,
1461
               RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00001", "11111",
1462
                                      STYPE1_NOP, "000"));
1463
 
1464
     ---------------------------------------------------------------------------
1465
    PrintS("-----------------------------------------------------------------");
1466
    PrintS("Step 3:");
1467
    PrintS("Action: Send a packet and confirm it with packet-retry.");
1468
    PrintS("Result: A restart-from-retry should be transmitted and the packet");
1469
    PrintS("        should be retransmitted.");
1470
    ---------------------------------------------------------------------------
1471
    PrintR("TG_RioSerial-TC4-Step3");
1472
    ---------------------------------------------------------------------------
1473
 
1474
    -- Create the frame.
1475
    CreateRandomPayload(payload.data, seed1, seed2);
1476
    payload.length := 4;
1477
    frame := RioFrameCreate(ackId=>"00010", vc=>'0', crf=>'0', prio=>"00",
1478
                            tt=>"01", ftype=>"0000",
1479
                            sourceId=>x"0000", destId=>x"0000",
1480
                            payload=>payload);
1481
    frameValid(2) <= '1';
1482
    frameWrite(2) <= frame;
1483
 
1484
    -- Receive an idle symbol left in the FIFO before the start of the frame was
1485
    -- generated.
1486
    ReceiveSymbol(SYMBOL_IDLE);
1487
 
1488
    -- Receive the start of the frame.
1489
    ReceiveSymbol(SYMBOL_CONTROL,
1490
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1491
                                         STYPE1_START_OF_PACKET, "000"));
1492
 
1493
    -- Receive the data symbols of the frame.
1494
    for i in 0 to frame.length-1 loop
1495
      ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
1496
    end loop;
1497
 
1498
    -- Receive the end of the frame.
1499
    ReceiveSymbol(SYMBOL_CONTROL,
1500
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1501
                                         STYPE1_END_OF_PACKET, "000"));
1502
 
1503
    -- Send packet-retry that the frame should be retransmitted.
1504
    SendSymbol(SYMBOL_CONTROL,
1505
               RioControlSymbolCreate(STYPE0_PACKET_RETRY, "00010", "11111",
1506
                                      STYPE1_NOP, "000"));
1507
 
1508
    -- Receive the acknowledgement for the retransmission.
1509
    ReceiveSymbol(SYMBOL_IDLE);
1510
    ReceiveSymbol(SYMBOL_CONTROL,
1511
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1512
                                         STYPE1_RESTART_FROM_RETRY, "000"));
1513
 
1514
    -- Receive the start of the retransmitted frame.
1515
    ReceiveSymbol(SYMBOL_CONTROL,
1516
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1517
                                         STYPE1_START_OF_PACKET, "000"));
1518
 
1519
    -- Receive the data symbols of the retransmitted frame.
1520
    for i in 0 to frame.length-1 loop
1521
      ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
1522
    end loop;
1523
 
1524
    -- Wait for the frame to complete.
1525
    wait until frameComplete = '1' and clk'event and clk = '1';
1526
    frameValid(2) <= '0';
1527
 
1528
    -- Receive the end of the retransmitted frame.
1529
    ReceiveSymbol(SYMBOL_CONTROL,
1530
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1531
                                         STYPE1_END_OF_PACKET, "000"));
1532
 
1533
    -- Send acknowledge that the frame was received.
1534
    SendSymbol(SYMBOL_CONTROL,
1535
               RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00010", "11111",
1536
                                      STYPE1_NOP, "000"));
1537
 
1538
    ---------------------------------------------------------------------------
1539
    PrintS("-----------------------------------------------------------------");
1540
    PrintS("Step 4:");
1541
    PrintS("Action: Send a packet and confirm it with packet-not-accepted. ");
1542
    PrintS("Result: A link-request should be transmitted and the packet should");
1543
    PrintS("        be retransmitted.");
1544
    ---------------------------------------------------------------------------
1545
    PrintR("TG_RioSerial-TC4-Step4");
1546
    ---------------------------------------------------------------------------
1547
 
1548
    -- Create the frame.
1549
    CreateRandomPayload(payload.data, seed1, seed2);
1550
    payload.length := 5;
1551
    frame := RioFrameCreate(ackId=>"00011", vc=>'0', crf=>'0', prio=>"00",
1552
                            tt=>"01", ftype=>"0000",
1553
                            sourceId=>x"0000", destId=>x"0000",
1554
                            payload=>payload);
1555
    frameValid(3) <= '1';
1556
    frameWrite(3) <= frame;
1557
 
1558
    -- Receive the start of the frame.
1559
    ReceiveSymbol(SYMBOL_IDLE);
1560
    ReceiveSymbol(SYMBOL_CONTROL,
1561
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1562
                                         STYPE1_START_OF_PACKET, "000"));
1563
 
1564
    -- Receive the data symbols of the frame.
1565
    for i in 0 to frame.length-1 loop
1566
      ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
1567
    end loop;
1568
 
1569
    -- Receive the end of the frame.
1570
    ReceiveSymbol(SYMBOL_CONTROL,
1571
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1572
                                         STYPE1_END_OF_PACKET, "000"));
1573
 
1574
    -- Send packet-retry that the frame should be retransmitted.
1575
    SendSymbol(SYMBOL_CONTROL,
1576
               RioControlSymbolCreate(STYPE0_PACKET_NOT_ACCEPTED, "00000", "11111",
1577
                                      STYPE1_NOP, "000"));
1578
 
1579
    -- Receive the acknowledgement for the retransmission.
1580
    ReceiveSymbol(SYMBOL_IDLE);
1581
    ReceiveSymbol(SYMBOL_CONTROL,
1582
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1583
                                         STYPE1_LINK_REQUEST, "100"));
1584
    SendSymbol(SYMBOL_CONTROL,
1585
               RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "00011", "11111",
1586
                                      STYPE1_NOP, "000"));
1587
 
1588
    -- Receive the start of the retransmitted frame.
1589
    ReceiveSymbol(SYMBOL_IDLE);
1590
    ReceiveSymbol(SYMBOL_CONTROL,
1591
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1592
                                         STYPE1_START_OF_PACKET, "000"));
1593
 
1594
    -- Receive the data symbols of the retransmitted frame.
1595
    for i in 0 to frame.length-1 loop
1596
      ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
1597
    end loop;
1598
 
1599
    -- Wait for the frame to complete.
1600 13 magro732
    wait until frameComplete = '1' and clk'event and clk = '1';
1601 4 magro732
    frameValid(3) <= '0';
1602
 
1603
    -- Receive the end of the retransmitted frame.
1604
    ReceiveSymbol(SYMBOL_CONTROL,
1605
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1606
                                         STYPE1_END_OF_PACKET, "000"));
1607
 
1608
    -- Send acknowledge that the frame was received.
1609
    SendSymbol(SYMBOL_CONTROL,
1610
               RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00011", "11111",
1611
                                      STYPE1_NOP, "000"));
1612
 
1613
    ---------------------------------------------------------------------------
1614
    PrintS("-----------------------------------------------------------------");
1615
    PrintS("Step 5:");
1616
    PrintS("Action: Let a packet timeout expire. Then answer with link-response.");
1617
    PrintS("Result: A link-request should be transmitted and the packet should");
1618
    PrintS("        be retransmitted.");
1619
    ---------------------------------------------------------------------------
1620
    PrintR("TG_RioSerial-TC4-Step5");
1621
    ---------------------------------------------------------------------------
1622
 
1623
    -- Create the frame.
1624
    CreateRandomPayload(payload.data, seed1, seed2);
1625
    payload.length := 5;
1626
    frame := RioFrameCreate(ackId=>"00100", vc=>'0', crf=>'0', prio=>"00",
1627
                            tt=>"01", ftype=>"0000",
1628
                            sourceId=>x"0000", destId=>x"0000",
1629
                            payload=>payload);
1630
    frameValid(4) <= '1';
1631
    frameWrite(4) <= frame;
1632
 
1633
    -- Receive the frame.
1634
    ReceiveSymbol(SYMBOL_IDLE);
1635
    ReceiveSymbol(SYMBOL_CONTROL,
1636
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1637
                                         STYPE1_START_OF_PACKET, "000"));
1638
    for i in 0 to frame.length-1 loop
1639
      ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
1640
    end loop;
1641
    ReceiveSymbol(SYMBOL_CONTROL,
1642
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1643
                                         STYPE1_END_OF_PACKET, "000"));
1644
 
1645
    -- Wait a while to let the timer expire and receive the link-request.
1646
    for i in 0 to 2048 loop
1647
      wait until clk'event and clk = '1';
1648
    end loop;
1649
    ReceiveSymbol(SYMBOL_IDLE);
1650
    ReceiveSymbol(SYMBOL_CONTROL,
1651
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1652
                                         STYPE1_LINK_REQUEST, "100"));
1653
 
1654
    -- Send a link-response to make the transmitter to back to normal mode.
1655
    SendSymbol(SYMBOL_CONTROL,
1656
               RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "00100", "11111",
1657
                                      STYPE1_NOP, "000"));
1658
 
1659
    -- Receive the retransmitted frame.
1660
    ReceiveSymbol(SYMBOL_IDLE);
1661
    ReceiveSymbol(SYMBOL_CONTROL,
1662
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1663
                                         STYPE1_START_OF_PACKET, "000"));
1664
 
1665
    for i in 0 to frame.length-1 loop
1666
      ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
1667
    end loop;
1668
 
1669
    -- Wait for the frame to complete.
1670 13 magro732
    wait until frameComplete = '1' and clk'event and clk = '1';
1671 4 magro732
    frameValid(4) <= '0';
1672
 
1673
    ReceiveSymbol(SYMBOL_CONTROL,
1674
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1675
                                         STYPE1_END_OF_PACKET, "000"));
1676
 
1677
    -- Send acknowledge that the frame was received.
1678
    SendSymbol(SYMBOL_CONTROL,
1679
               RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00100", "11111",
1680
                                      STYPE1_NOP, "000"));
1681
 
1682
    ---------------------------------------------------------------------------
1683
    PrintS("-----------------------------------------------------------------");
1684
    PrintS("Step 6:");
1685
    PrintS("Action: Let a packet timeout expire. Then answer with link-response");
1686
    Prints("        that indicates that the packet was received.");
1687
    PrintS("Result: A link-request should be transmitted and the packet should");
1688
    PrintS("        not be retransmitted.");
1689
    ---------------------------------------------------------------------------
1690
    PrintR("TG_RioSerial-TC4-Step6");
1691
    ---------------------------------------------------------------------------
1692
 
1693
    -- Create the frame.
1694
    CreateRandomPayload(payload.data, seed1, seed2);
1695
    payload.length := 6;
1696
    frame := RioFrameCreate(ackId=>"00101", vc=>'0', crf=>'0', prio=>"00",
1697
                            tt=>"01", ftype=>"0000",
1698
                            sourceId=>x"0000", destId=>x"0000",
1699
                            payload=>payload);
1700
    frameValid(5) <= '1';
1701
    frameWrite(5) <= frame;
1702
 
1703
    -- Receive the frame.
1704
    ReceiveSymbol(SYMBOL_IDLE);
1705
    ReceiveSymbol(SYMBOL_CONTROL,
1706
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1707
                                         STYPE1_START_OF_PACKET, "000"));
1708
    for i in 0 to frame.length-1 loop
1709
      ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
1710
    end loop;
1711
 
1712 13 magro732
    wait until frameComplete = '1' and clk'event and clk = '1';
1713 4 magro732
    frameValid(5) <= '0';
1714
 
1715
    ReceiveSymbol(SYMBOL_CONTROL,
1716
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1717
                                         STYPE1_END_OF_PACKET, "000"));
1718
 
1719
    -- Wait a while to let the timer expire and receive the link-request.
1720
    for i in 0 to 2048 loop
1721
      wait until clk'event and clk = '1';
1722
    end loop;
1723
    ReceiveSymbol(SYMBOL_IDLE);
1724
    ReceiveSymbol(SYMBOL_CONTROL,
1725
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1726
                                         STYPE1_LINK_REQUEST, "100"));
1727
 
1728
    -- Send a link-response that indicates that the frame was received to make
1729
    -- the transmitter to back to normal mode.
1730
    SendSymbol(SYMBOL_CONTROL,
1731
               RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "00110", "11111",
1732
                                      STYPE1_NOP, "000"));
1733
 
1734
    ---------------------------------------------------------------------------
1735
    PrintS("-----------------------------------------------------------------");
1736
    PrintS("Step 7:");
1737
    PrintS("Action: Let a packet timeout expire. No more replies.");
1738
    PrintS("Result: Three link-requests should be transmitted. When the third");
1739
    PrintS("        times out the link will be restarted.");
1740
    ---------------------------------------------------------------------------
1741
    PrintR("TG_RioSerial-TC4-Step7");
1742
    ---------------------------------------------------------------------------
1743
 
1744
    -- Create the frame.
1745
    CreateRandomPayload(payload.data, seed1, seed2);
1746
    payload.length := 7;
1747
    frame := RioFrameCreate(ackId=>"00110", vc=>'0', crf=>'0', prio=>"00",
1748
                            tt=>"01", ftype=>"0000",
1749
                            sourceId=>x"0000", destId=>x"0000",
1750
                            payload=>payload);
1751
    frameValid(6) <= '1';
1752
    frameWrite(6) <= frame;
1753
 
1754
    -- Receive the frame.
1755
    ReceiveSymbol(SYMBOL_IDLE);
1756
    ReceiveSymbol(SYMBOL_CONTROL,
1757
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1758
                                         STYPE1_START_OF_PACKET, "000"));
1759
    for i in 0 to frame.length-1 loop
1760
      ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
1761
    end loop;
1762
    ReceiveSymbol(SYMBOL_CONTROL,
1763
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1764
                                         STYPE1_END_OF_PACKET, "000"));
1765
 
1766
    -- Wait a while to let the timer expire and receive the link-request.
1767
    for i in 0 to 2048 loop
1768
      wait until clk'event and clk = '1';
1769
    end loop;
1770
    ReceiveSymbol(SYMBOL_IDLE);
1771
    ReceiveSymbol(SYMBOL_CONTROL,
1772
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1773
                                         STYPE1_LINK_REQUEST, "100"));
1774
 
1775
    -- Wait a while to let the timer expire and receive the link-request.
1776
    for i in 0 to 2048 loop
1777
      wait until clk'event and clk = '1';
1778
    end loop;
1779
    ReceiveSymbol(SYMBOL_IDLE);
1780
    ReceiveSymbol(SYMBOL_CONTROL,
1781
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1782
                                         STYPE1_LINK_REQUEST, "100"));
1783
 
1784
    -- Wait a while to let the timer expire and receive the link-request.
1785
    for i in 0 to 2048 loop
1786
      wait until clk'event and clk = '1';
1787
    end loop;
1788
    ReceiveSymbol(SYMBOL_IDLE);
1789
    ReceiveSymbol(SYMBOL_CONTROL,
1790
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1791
                                         STYPE1_LINK_REQUEST, "100"));
1792
 
1793
    -- Wait a while to let the timer expire and receive the link-request.
1794
    for i in 0 to 2048 loop
1795
      wait until clk'event and clk = '1';
1796
    end loop;
1797
 
1798
    -- Reinitialize the transmitter.
1799
    for i in 0 to 255 loop
1800
      ReceiveSymbol(SYMBOL_IDLE);
1801
    end loop;
1802
    ReceiveSymbol(SYMBOL_CONTROL,
1803
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1804
                                         STYPE1_NOP, "000"));
1805
    SendSymbol(SYMBOL_CONTROL,
1806
               RioControlSymbolCreate(STYPE0_STATUS, "00110", "11111",
1807
                                      STYPE1_NOP, "000"));
1808
    for j in 0 to 14 loop
1809
      for i in 0 to 15 loop
1810
        ReceiveSymbol(SYMBOL_IDLE);
1811
      end loop;
1812
      ReceiveSymbol(SYMBOL_CONTROL,
1813
                    RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1814
                                           STYPE1_NOP, "000"));
1815
    end loop;
1816
 
1817
    -- Receive the frame.
1818
    ReceiveSymbol(SYMBOL_CONTROL,
1819
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1820
                                         STYPE1_START_OF_PACKET, "000"));
1821
    for i in 0 to frame.length-1 loop
1822
      ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
1823
    end loop;
1824
 
1825 13 magro732
    wait until frameComplete = '1' and clk'event and clk = '1';
1826 4 magro732
    frameValid(6) <= '0';
1827
 
1828
    ReceiveSymbol(SYMBOL_CONTROL,
1829
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1830
                                         STYPE1_END_OF_PACKET, "000"));
1831
    SendSymbol(SYMBOL_CONTROL,
1832
               RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00110", "11111",
1833
                                      STYPE1_NOP, "000"));
1834
 
1835
    ---------------------------------------------------------------------------
1836
    PrintS("-----------------------------------------------------------------");
1837
    PrintS("Step 8:");
1838
    PrintS("Action: Let a packet timeout expire. Then answer with totally ");
1839
    PrintS("        unexpected ackId.");
1840
    PrintS("Result: A link request should be transmitted and the link should ");
1841
    PrintS("        be restarted.");
1842
    ---------------------------------------------------------------------------
1843
    PrintR("TG_RioSerial-TC4-Step8");
1844
    ---------------------------------------------------------------------------
1845
 
1846
    -- Create the frame.
1847
    CreateRandomPayload(payload.data, seed1, seed2);
1848
    payload.length := 8;
1849
    frame := RioFrameCreate(ackId=>"00111", vc=>'0', crf=>'0', prio=>"00",
1850
                            tt=>"01", ftype=>"0000",
1851
                            sourceId=>x"0000", destId=>x"0000",
1852
                            payload=>payload);
1853
    frameValid(7) <= '1';
1854
    frameWrite(7) <= frame;
1855
 
1856
    -- Receive the frame.
1857
    ReceiveSymbol(SYMBOL_IDLE);
1858
    ReceiveSymbol(SYMBOL_CONTROL,
1859
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1860
                                         STYPE1_START_OF_PACKET, "000"));
1861
    for i in 0 to frame.length-1 loop
1862
      ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
1863
    end loop;
1864
    ReceiveSymbol(SYMBOL_CONTROL,
1865
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1866
                                         STYPE1_END_OF_PACKET, "000"));
1867
 
1868
    -- Wait a while to let the timer expire and receive the link-request.
1869
    for i in 0 to 2048 loop
1870
      wait until clk'event and clk = '1';
1871
    end loop;
1872
    ReceiveSymbol(SYMBOL_IDLE);
1873
    ReceiveSymbol(SYMBOL_CONTROL,
1874
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1875
                                         STYPE1_LINK_REQUEST, "100"));
1876
 
1877
    -- Send a link-response with unexpected ackId.
1878
    SendSymbol(SYMBOL_CONTROL,
1879
               RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "10000", "11111",
1880
                                      STYPE1_NOP, "000"));
1881
 
1882
    -- Reinitialize the transmitter.
1883
    for i in 0 to 255 loop
1884
      ReceiveSymbol(SYMBOL_IDLE);
1885
    end loop;
1886
    ReceiveSymbol(SYMBOL_CONTROL,
1887
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1888
                                         STYPE1_NOP, "000"));
1889
    SendSymbol(SYMBOL_CONTROL,
1890
               RioControlSymbolCreate(STYPE0_STATUS, "00111", "11111",
1891
                                      STYPE1_NOP, "000"));
1892
    for j in 0 to 14 loop
1893
      for i in 0 to 15 loop
1894
        ReceiveSymbol(SYMBOL_IDLE);
1895
      end loop;
1896
      ReceiveSymbol(SYMBOL_CONTROL,
1897
                    RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1898
                                           STYPE1_NOP, "000"));
1899
    end loop;
1900
 
1901
    -- Receive the frame.
1902
    ReceiveSymbol(SYMBOL_CONTROL,
1903
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1904
                                         STYPE1_START_OF_PACKET, "000"));
1905
    for i in 0 to frame.length-1 loop
1906
      ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
1907
    end loop;
1908
 
1909 13 magro732
    wait until frameComplete = '1' and clk'event and clk = '1';
1910 4 magro732
    frameValid(7) <= '0';
1911
 
1912
    ReceiveSymbol(SYMBOL_CONTROL,
1913
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1914
                                         STYPE1_END_OF_PACKET, "000"));
1915
    SendSymbol(SYMBOL_CONTROL,
1916
               RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00111", "11111",
1917
                                      STYPE1_NOP, "000"));
1918
 
1919
    ---------------------------------------------------------------------------
1920
    PrintS("-----------------------------------------------------------------");
1921
    PrintS("Step 9:");
1922
    PrintS("Action: Send status with unexpected ackId in normal operation.");
1923
    PrintS("Result: The transmitter should disregard the error.");
1924
    ---------------------------------------------------------------------------
1925
    PrintR("TG_RioSerial-TC4-Step9");
1926
    ---------------------------------------------------------------------------
1927
 
1928
    -- Send a status with unexpected ackId.
1929
    SendSymbol(SYMBOL_CONTROL,
1930
               RioControlSymbolCreate(STYPE0_STATUS, "10000", "11111",
1931
                                      STYPE1_NOP, "000"));
1932
 
1933
    -- Receive no change.
1934
    ReceiveSymbol(SYMBOL_IDLE);
1935
    ReceiveSymbol(SYMBOL_IDLE);
1936
 
1937
    ---------------------------------------------------------------------------
1938
    PrintS("-----------------------------------------------------------------");
1939
    PrintS("Step 10:");
1940
    PrintS("Action: Send packet-retry with unexpected ackId in normal operation.");
1941
    PrintS("Result: The transmitter should enter output-error-stopped.");
1942
    ---------------------------------------------------------------------------
1943
    PrintR("TG_RioSerial-TC4-Step10");
1944
    ---------------------------------------------------------------------------
1945
 
1946
    -- Send a packet-retry with unexpected ackId.
1947
    SendSymbol(SYMBOL_CONTROL,
1948
               RioControlSymbolCreate(STYPE0_PACKET_RETRY, "10000", "11111",
1949
                                      STYPE1_NOP, "000"));
1950
 
1951
    -- Receive link-request.
1952
    ReceiveSymbol(SYMBOL_IDLE);
1953
    ReceiveSymbol(SYMBOL_CONTROL,
1954
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1955
                                         STYPE1_LINK_REQUEST, "100"));
1956
 
1957
    -- Send a link-response with unexpected ackId.
1958
    SendSymbol(SYMBOL_CONTROL,
1959
               RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01000", "11111",
1960
                                      STYPE1_NOP, "000"));
1961
 
1962
    -- Create the frame.
1963
    CreateRandomPayload(payload.data, seed1, seed2);
1964
    payload.length := 10;
1965
    frame := RioFrameCreate(ackId=>"01000", vc=>'0', crf=>'0', prio=>"00",
1966
                            tt=>"01", ftype=>"0000",
1967
                            sourceId=>x"0000", destId=>x"0000",
1968
                            payload=>payload);
1969
    frameValid(8) <= '1';
1970
    frameWrite(8) <= frame;
1971
 
1972
    -- Receive the frame.
1973
    ReceiveSymbol(SYMBOL_IDLE);
1974
    ReceiveSymbol(SYMBOL_CONTROL,
1975
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1976
                                         STYPE1_START_OF_PACKET, "000"));
1977
    for i in 0 to frame.length-1 loop
1978
      ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
1979
    end loop;
1980
 
1981 13 magro732
    wait until frameComplete = '1' and clk'event and clk = '1';
1982 4 magro732
    frameValid(8) <= '0';
1983
 
1984
    ReceiveSymbol(SYMBOL_CONTROL,
1985
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
1986
                                         STYPE1_END_OF_PACKET, "000"));
1987
    SendSymbol(SYMBOL_CONTROL,
1988
               RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01000", "11111",
1989
                                      STYPE1_NOP, "000"));
1990
 
1991
    ---------------------------------------------------------------------------
1992
    PrintS("-----------------------------------------------------------------");
1993
    PrintS("Step 11:");
1994
    PrintS("Action: Send packet-accepted with unexpected ackId in normal ");
1995
    PrintS("        operation.");
1996
    PrintS("Result: The transmitter should enter output-error-stopped.");
1997
    ---------------------------------------------------------------------------
1998
    PrintR("TG_RioSerial-TC4-Step11");
1999
    ---------------------------------------------------------------------------
2000
 
2001
    -- Send a packet-accepted with unexpected ackId.
2002
    SendSymbol(SYMBOL_CONTROL,
2003
               RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "10000", "11111",
2004
                                      STYPE1_NOP, "000"));
2005
 
2006
    -- Receive link-request.
2007
    ReceiveSymbol(SYMBOL_IDLE);
2008
    ReceiveSymbol(SYMBOL_CONTROL,
2009
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
2010
                                         STYPE1_LINK_REQUEST, "100"));
2011
 
2012
    -- Send a link-response with unexpected ackId.
2013
    SendSymbol(SYMBOL_CONTROL,
2014
               RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01001", "11111",
2015
                                      STYPE1_NOP, "000"));
2016
 
2017
    -- Create the frame.
2018
    CreateRandomPayload(payload.data, seed1, seed2);
2019
    payload.length := 11;
2020
    frame := RioFrameCreate(ackId=>"01001", vc=>'0', crf=>'0', prio=>"00",
2021
                            tt=>"01", ftype=>"0000",
2022
                            sourceId=>x"0000", destId=>x"0000",
2023
                            payload=>payload);
2024
    frameValid(9) <= '1';
2025
    frameWrite(9) <= frame;
2026
 
2027
    -- Receive the frame.
2028
    ReceiveSymbol(SYMBOL_IDLE);
2029
    ReceiveSymbol(SYMBOL_CONTROL,
2030
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
2031
                                         STYPE1_START_OF_PACKET, "000"));
2032
    for i in 0 to frame.length-1 loop
2033
      ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
2034
    end loop;
2035
 
2036 13 magro732
    wait until frameComplete = '1' and clk'event and clk = '1';
2037 4 magro732
    frameValid(9) <= '0';
2038
 
2039
    ReceiveSymbol(SYMBOL_CONTROL,
2040
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
2041
                                         STYPE1_END_OF_PACKET, "000"));
2042
    SendSymbol(SYMBOL_CONTROL,
2043
               RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01001", "11111",
2044
                                      STYPE1_NOP, "000"));
2045
 
2046
    ---------------------------------------------------------------------------
2047
    PrintS("-----------------------------------------------------------------");
2048
    PrintS("Step 12:");
2049
    PrintS("Action: Send a packet and then accept it with unexpected ackId.");
2050
    PrintS("Result: The transmitter should enter output-error-stopped.");
2051
    ---------------------------------------------------------------------------
2052
    PrintR("TG_RioSerial-TC4-Step12");
2053
    ---------------------------------------------------------------------------
2054
 
2055
    -- Create the frame.
2056
    CreateRandomPayload(payload.data, seed1, seed2);
2057
    payload.length := 12;
2058
    frame := RioFrameCreate(ackId=>"01010", vc=>'0', crf=>'0', prio=>"00",
2059
                            tt=>"01", ftype=>"0000",
2060
                            sourceId=>x"0000", destId=>x"0000",
2061
                            payload=>payload);
2062
    frameValid(10) <= '1';
2063
    frameWrite(10) <= frame;
2064
 
2065
    -- Receive the frame.
2066
    ReceiveSymbol(SYMBOL_IDLE);
2067
    ReceiveSymbol(SYMBOL_CONTROL,
2068
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
2069
                                         STYPE1_START_OF_PACKET, "000"));
2070
    for i in 0 to frame.length-1 loop
2071
      ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
2072
    end loop;
2073
 
2074 13 magro732
    wait until frameComplete = '1' and clk'event and clk = '1';
2075 4 magro732
    frameValid(10) <= '0';
2076
 
2077
    ReceiveSymbol(SYMBOL_CONTROL,
2078
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
2079
                                         STYPE1_END_OF_PACKET, "000"));
2080
 
2081
    -- Send unexpected ackId in packet-accepted.
2082
    SendSymbol(SYMBOL_CONTROL,
2083
               RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "10000", "11111",
2084
                                      STYPE1_NOP, "000"));
2085
 
2086
    -- Receive link-request.
2087
    ReceiveSymbol(SYMBOL_IDLE);
2088
    ReceiveSymbol(SYMBOL_CONTROL,
2089
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
2090
                                         STYPE1_LINK_REQUEST, "100"));
2091
 
2092
    -- Send a link-response with expected ackId.
2093
    SendSymbol(SYMBOL_CONTROL,
2094
               RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01011", "11111",
2095
                                      STYPE1_NOP, "000"));
2096
 
2097
    ---------------------------------------------------------------------------
2098
    PrintS("-----------------------------------------------------------------");
2099
    PrintS("Step 13:");
2100
    PrintS("Action: Set two valid packets.");
2101
    PrintS("Result: The two packet should be sent without waiting for ");
2102
    PrintS("        packet-accepted.");
2103
    ---------------------------------------------------------------------------
2104
    PrintR("TG_RioSerial-TC4-Step13");
2105
    ---------------------------------------------------------------------------
2106
 
2107
    -- Create the first frame.
2108
    CreateRandomPayload(payload.data, seed1, seed2);
2109
    payload.length := 13;
2110
    frame := RioFrameCreate(ackId=>"01011", vc=>'0', crf=>'0', prio=>"00",
2111
                            tt=>"01", ftype=>"0000",
2112
                            sourceId=>x"0000", destId=>x"0000",
2113
                            payload=>payload);
2114
    frameValid(11) <= '1';
2115
    frameWrite(11) <= frame;
2116
 
2117
    -- Create the second frame.
2118
    CreateRandomPayload(payload.data, seed1, seed2);
2119
    payload.length := 14;
2120
    frame := RioFrameCreate(ackId=>"01100", vc=>'0', crf=>'0', prio=>"00",
2121
                            tt=>"01", ftype=>"0000",
2122
                            sourceId=>x"0000", destId=>x"0000",
2123
                            payload=>payload);
2124
    frameValid(12) <= '1';
2125
    frameWrite(12) <= frame;
2126
 
2127
    -- Receive the frame.
2128
    ReceiveSymbol(SYMBOL_IDLE);
2129
    ReceiveSymbol(SYMBOL_CONTROL,
2130
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
2131
                                         STYPE1_START_OF_PACKET, "000"));
2132
    for i in 0 to frameWrite(11).length-1 loop
2133
      ReceiveSymbol(SYMBOL_DATA, frameWrite(11).payload(i));
2134
    end loop;
2135
 
2136 13 magro732
    wait until frameComplete = '1' and clk'event and clk = '1';
2137 4 magro732
    frameValid(11) <= '0';
2138
 
2139
    -- Receive the frame.
2140
    ReceiveSymbol(SYMBOL_CONTROL,
2141
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
2142
                                         STYPE1_START_OF_PACKET, "000"));
2143
    for i in 0 to frameWrite(12).length-1 loop
2144
      ReceiveSymbol(SYMBOL_DATA, frameWrite(12).payload(i));
2145
    end loop;
2146
 
2147 13 magro732
    wait until frameComplete = '1' and clk'event and clk = '1';
2148 4 magro732
    frameValid(12) <= '0';
2149
 
2150
    ReceiveSymbol(SYMBOL_CONTROL,
2151
                  RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
2152
                                         STYPE1_END_OF_PACKET, "000"));
2153
 
2154
 
2155
    -- Send packet-accepted for both packets.
2156
    SendSymbol(SYMBOL_CONTROL,
2157
               RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01011", "11111",
2158
                                      STYPE1_NOP, "000"));
2159
    SendSymbol(SYMBOL_CONTROL,
2160
               RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01100", "11111",
2161
                                      STYPE1_NOP, "000"));
2162
 
2163
    ReceiveSymbol(SYMBOL_IDLE);
2164
    ReceiveSymbol(SYMBOL_IDLE);
2165
 
2166
    ---------------------------------------------------------------------------
2167
    PrintS("-----------------------------------------------------------------");
2168
    PrintS("Step 14:");
2169
    PrintS("Action: Set maximum number of valid packets.");
2170
    PrintS("Result: Maximum 31 packets should be sent without waiting for ");
2171
    PrintS("        packet-accepted.");
2172
    ---------------------------------------------------------------------------
2173
    PrintR("TG_RioSerial-TC4-Step14");
2174
    ---------------------------------------------------------------------------
2175
 
2176
    ---------------------------------------------------------------------------
2177
    -- Create the frames.
2178
    ---------------------------------------------------------------------------
2179
 
2180
    for j in 0 to 47 loop
2181
      CreateRandomPayload(payload.data, seed1, seed2);
2182
      payload.length := j+13;
2183
      frame := RioFrameCreate(ackId=>std_logic_vector(to_unsigned((j+13) mod 32, 5)), vc=>'0', crf=>'0', prio=>"00",
2184
                              tt=>"01", ftype=>"0000",
2185
                              sourceId=>x"0000", destId=>x"0000",
2186
                              payload=>payload);
2187
      frameValid(j+13) <= '1';
2188
      frameWrite(j+13) <= frame;
2189
    end loop;
2190
 
2191
    ---------------------------------------------------------------------------
2192
    -- Receive the frames.
2193
    ---------------------------------------------------------------------------
2194
 
2195
    ReceiveSymbol(SYMBOL_IDLE);
2196
 
2197
    for j in 0 to 30 loop
2198
      ReceiveSymbol(SYMBOL_CONTROL,
2199
                    RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
2200
                                           STYPE1_START_OF_PACKET, "000"));
2201
      for i in 0 to frameWrite(j+13).length-1 loop
2202
        ReceiveSymbol(SYMBOL_DATA, frameWrite(j+13).payload(i));
2203
      end loop;
2204
 
2205 13 magro732
      wait until frameComplete = '1' and clk'event and clk = '1';
2206 4 magro732
      frameValid(j+13) <= '0';
2207
    end loop;
2208
 
2209
    ReceiveSymbol(SYMBOL_IDLE);
2210
    ReceiveSymbol(SYMBOL_IDLE);
2211
 
2212
 
2213
    SendSymbol(SYMBOL_CONTROL,
2214
               RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01101", "11111",
2215
                                      STYPE1_NOP, "000"));
2216
 
2217
 
2218
    ---------------------------------------------------------------------------
2219
    PrintS("-----------------------------------------------------------------");
2220
    PrintS("Step X:");
2221
    PrintS("Action: Start sending an outbound packet and while in transmission, ");
2222
    PrintS("        start and complete an inbound packet.");
2223
    PrintS("Result: The ack for the inbound packet should be inserted into the");
2224
    PrintS("        outbound packet.");
2225
    ---------------------------------------------------------------------------
2226
    PrintR("TG_RioSerial-TC4-StepX");
2227
    ---------------------------------------------------------------------------
2228
 
2229
    ---------------------------------------------------------------------------
2230
    PrintS("-----------------------------------------------------------------");
2231
    PrintS("Step X:");
2232
    PrintS("Action: Send a packet but not all content is available yet.");
2233
    PrintS("Result: Idle symbols should be inserted into the packet.");
2234
    ---------------------------------------------------------------------------
2235
    PrintR("TG_RioSerial-TC4-StepX");
2236
    ---------------------------------------------------------------------------
2237
 
2238
    ---------------------------------------------------------------------------
2239
    -- REMARK: Send long frames with a CRC in the middle...
2240
    ---------------------------------------------------------------------------
2241
 
2242
    ---------------------------------------------------------------------------
2243
    -- Test completed.
2244
    ---------------------------------------------------------------------------
2245
 
2246
    TestEnd;
2247
  end process;
2248
 
2249
 
2250
  -----------------------------------------------------------------------------
2251
  -- Instantiate the uart.
2252
  -----------------------------------------------------------------------------
2253
 
2254
  TestPort: TestSwitchPort
2255 12 magro732
    generic map(
2256
      NUMBER_WORDS=>1)
2257 4 magro732
    port map(
2258
      clk=>clk, areset_n=>areset_n,
2259
      frameValid_i=>frameValid, frameWrite_i=>frameWrite, frameComplete_o=>frameComplete,
2260
      frameExpected_i=>frameExpected, frameRead_i=>frameRead, frameReceived_o=>frameReceived,
2261
      readFrameEmpty_o=>readFrameEmpty, readFrame_i=>readFrame,
2262
      readFrameRestart_i=>readFrameRestart, readFrameAborted_o=>readFrameAborted,
2263
      readWindowEmpty_o=>readWindowEmpty,
2264
      readWindowReset_i=>readWindowReset, readWindowNext_i=>readWindowNext,
2265
      readContentEmpty_o=>readContentEmpty, readContent_i=>readContent,
2266
      readContentEnd_o=>readContentEnd, readContentData_o=>readContentData,
2267
      writeFrameFull_o=>writeFrameFull, writeFrame_i=>writeFrame, writeFrameAbort_i=>writeFrameAbort,
2268
      writeContent_i=>writeContent, writeContentData_i=>writeContentData);
2269
 
2270
  TestPhy: RioSerial
2271
    generic map(
2272 12 magro732
      TIMEOUT_WIDTH=>11, NUMBER_WORDS=>1)
2273 4 magro732
    port map(
2274
      clk=>clk, areset_n=>areset_n,
2275
      portLinkTimeout_i=>portLinkTimeout,
2276
      linkInitialized_o=>linkInitialized,
2277
      inputPortEnable_i=>inputPortEnable,
2278
      outputPortEnable_i=>outputPortEnable,
2279
      localAckIdWrite_i=>localAckIdWrite,
2280
      clrOutstandingAckId_i=>clrOutstandingAckId,
2281
      inboundAckId_i=>inboundAckIdWrite,
2282
      outstandingAckId_i=>outstandingAckIdWrite,
2283
      outboundAckId_i=>outboundAckIdWrite,
2284
      inboundAckId_o=>inboundAckIdRead,
2285
      outstandingAckId_o=>outstandingAckIdRead,
2286
      outboundAckId_o=>outboundAckIdRead,
2287
      readFrameEmpty_i=>readFrameEmpty, readFrame_o=>readFrame, readFrameRestart_o=>readFrameRestart,
2288
      readFrameAborted_i=>readFrameAborted,
2289
      readWindowEmpty_i=>readWindowEmpty,
2290
      readWindowReset_o=>readWindowReset, readWindowNext_o=>readWindowNext,
2291
      readContentEmpty_i=>readContentEmpty,
2292
      readContent_o=>readContent, readContentEnd_i=>readContentEnd, readContentData_i=>readContentData,
2293
      writeFrameFull_i=>writeFrameFull, writeFrame_o=>writeFrame, writeFrameAbort_o=>writeFrameAbort,
2294
      writeContent_o=>writeContent, writeContentData_o=>writeContentData,
2295
      portInitialized_i=>portInitialized,
2296
      outboundSymbolEmpty_o=>outboundSymbolEmpty, outboundSymbolRead_i=>outboundSymbolRead,
2297
      outboundSymbol_o=>outboundSymbol,
2298
      inboundSymbolFull_o=>inboundSymbolFull, inboundSymbolWrite_i=>inboundSymbolWrite,
2299
      inboundSymbol_i=>inboundSymbol);
2300
 
2301
end architecture;
2302
 
2303
 
2304
 
2305
-------------------------------------------------------------------------------
2306
-- 
2307
-------------------------------------------------------------------------------
2308
library ieee;
2309
use ieee.std_logic_1164.all;
2310
use ieee.numeric_std.all;
2311
library std;
2312
use std.textio.all;
2313
use work.rio_common.all;
2314
 
2315
 
2316
-------------------------------------------------------------------------------
2317
-- 
2318
-------------------------------------------------------------------------------
2319
entity TestSwitchPort is
2320 12 magro732
  generic(
2321
    NUMBER_WORDS : natural range 1 to 8 := 1);
2322 4 magro732
  port(
2323
    clk : in std_logic;
2324
    areset_n : in std_logic;
2325
 
2326
    frameValid_i : in std_logic_vector(0 to 63);
2327
    frameWrite_i : in RioFrameArray(0 to 63);
2328
    frameComplete_o : out std_logic;
2329
 
2330
    frameExpected_i : in std_logic;
2331
    frameRead_i : in RioFrame;
2332
    frameReceived_o : out std_logic;
2333
 
2334
    readFrameEmpty_o : out std_logic;
2335
    readFrame_i : in std_logic;
2336
    readFrameRestart_i : in std_logic;
2337
    readFrameAborted_o : out std_logic;
2338
 
2339
    readWindowEmpty_o : out std_logic;
2340
    readWindowReset_i : in std_logic;
2341
    readWindowNext_i : in std_logic;
2342
 
2343
    readContentEmpty_o : out std_logic;
2344
    readContent_i : in std_logic;
2345
    readContentEnd_o : out std_logic;
2346 12 magro732
    readContentData_o : out std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
2347 4 magro732
 
2348
    writeFrameFull_o : out std_logic;
2349
    writeFrame_i : in std_logic;
2350
    writeFrameAbort_i : in std_logic;
2351
    writeContent_i : in std_logic;
2352 12 magro732
    writeContentData_i : in std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0));
2353 4 magro732
end entity;
2354
 
2355
 
2356
-------------------------------------------------------------------------------
2357
-- 
2358
-------------------------------------------------------------------------------
2359
architecture TestSwitchPortImpl of TestSwitchPort is
2360
begin
2361
 
2362
  -----------------------------------------------------------------------------
2363
  -- 
2364
  -----------------------------------------------------------------------------
2365
  FrameSender: process
2366 13 magro732
    variable frameComplete : std_logic;
2367 4 magro732
    variable frameIndex : natural range 0 to 70;
2368
    variable backIndex, frontIndex : natural range 0 to 63;
2369
  begin
2370
    readFrameEmpty_o <= '1';
2371
    readFrameAborted_o <= '0';
2372
    readWindowEmpty_o <= '1';
2373
    readContentEmpty_o <= '1';
2374
    readContentEnd_o <= '0';
2375
    readContentData_o <= (others=>'U');
2376
    frameComplete_o <= '0';
2377 13 magro732
    frameComplete := '0';
2378 4 magro732
    backIndex := 0;
2379
    frontIndex := 0;
2380
    wait until areset_n = '1';
2381
 
2382
    loop
2383
      wait until clk'event and clk = '1';
2384
 
2385
      if (readFrame_i = '1') then
2386
        assert (frontIndex - backIndex) >= 0 report "Unexpected readFrame." severity error;
2387
        if(backIndex < 63) then
2388
          backIndex := backIndex + 1;
2389
        else
2390
          backIndex := 0;
2391
        end if;
2392
      end if;
2393
 
2394
      if (readWindowReset_i = '1') then
2395 13 magro732
        frameComplete := '0';
2396 4 magro732
        frameIndex := 0;
2397
        frontIndex := backIndex;
2398
        readContentEnd_o <= '0';
2399
        readContentData_o <= (others=>'U');
2400
      end if;
2401
 
2402
      if (readWindowNext_i = '1') then
2403 13 magro732
        assert frameComplete = '0' report "Reading next frame too fast." severity error;
2404 4 magro732
        assert frameIndex = frameWrite_i(frontIndex).length report "Did not read all frame content." severity error;
2405
        readContentEnd_o <= '0';
2406
        readContentData_o <= (others=>'U');
2407 13 magro732
        frameComplete := '1';
2408
      else
2409
        if (frameComplete = '1') and (frameValid_i(frontIndex) = '0') then
2410
          frameComplete := '0';
2411
          frameIndex := 0;
2412
          if(frontIndex < 63) then
2413
            frontIndex := frontIndex + 1;
2414
          else
2415
            frontIndex := 0;
2416
          end if;
2417 4 magro732
        end if;
2418
      end if;
2419 13 magro732
      frameComplete_o <= frameComplete;
2420 4 magro732
 
2421
      if (readFrameRestart_i = '1') then
2422
        frameIndex := 0;
2423
        readContentEnd_o <= '0';
2424
        readContentData_o <= (others=>'U');
2425
      end if;
2426
 
2427
      if (readContent_i = '1') then
2428
        assert frameValid_i(frontIndex) = '1' report "Unexpected content read." severity error;
2429
        if (frameIndex /= frameWrite_i(frontIndex).length) then
2430
          readContentEnd_o <= '0';
2431 12 magro732
          readContentData_o <= "00" & frameWrite_i(frontIndex).payload(frameIndex);
2432 4 magro732
          frameIndex := frameIndex + 1;
2433
        else
2434
          readContentEnd_o <= '1';
2435
          readContentData_o <= (others=>'U');
2436
        end if;
2437
      end if;
2438
 
2439 13 magro732
      if(frameValid_i(frontIndex) = '1') and (frameComplete = '0') then
2440 4 magro732
        readFrameEmpty_o <= '0';
2441
        readWindowEmpty_o <= '0';
2442
        readContentEmpty_o <= '0';
2443
      else
2444
        readFrameEmpty_o <= '1';
2445
        readWindowEmpty_o <= '1';
2446
        readContentEmpty_o <= '1';
2447
      end if;
2448
 
2449
    end loop;
2450
  end process;
2451
 
2452
  -----------------------------------------------------------------------------
2453
  -- 
2454
  -----------------------------------------------------------------------------
2455
  FrameReader: process
2456
    type StateType is (STATE_IDLE, STATE_READ, STATE_UPDATE);
2457
    variable state : StateType;
2458
    variable frameIndex : natural range 0 to 69;
2459
  begin
2460
    writeFrameFull_o <= '1';
2461
    frameReceived_o <= '0';
2462
    wait until areset_n = '1';
2463
 
2464
    state := STATE_IDLE;
2465
 
2466
    loop
2467
      wait until clk'event and clk = '1';
2468
 
2469
      case state is
2470
        when STATE_IDLE =>
2471
          frameReceived_o <= '0';
2472
          if (frameExpected_i = '1') then
2473
            state := STATE_READ;
2474
            frameIndex := 0;
2475
            writeFrameFull_o <= '0';
2476
          end if;
2477
          assert writeFrame_i = '0' report "Unexpected frame received." severity error;
2478
          --assert writeFrameAbort_i = '0' report "Unexpected frame aborted received." severity error;
2479
          assert writeContent_i = '0' report "Unexpected content received." severity error;
2480
 
2481
        when STATE_READ =>
2482
          if (writeFrame_i = '1') then
2483
            state := STATE_UPDATE;
2484
            frameReceived_o <= '1';
2485
            writeFrameFull_o <= '1';
2486
            assert frameIndex = frameRead_i.length report "Did not finish the expected frame." severity error;
2487
          end if;
2488
          if (writeFrameAbort_i = '1') then
2489
            frameIndex := 0;
2490
          end if;
2491
          if (writeContent_i = '1') then
2492 12 magro732
            assert writeContentData_i(32*NUMBER_WORDS-1 downto 0) = frameRead_i.payload(frameIndex)
2493 4 magro732
              report "Unexpected frame content received." severity error;
2494
            frameIndex := frameIndex + 1;
2495
          end if;
2496
          if (frameExpected_i = '0') then
2497
            state := STATE_IDLE;
2498
          end if;
2499
 
2500
        when STATE_UPDATE =>
2501
          if (frameExpected_i = '0') then
2502
            state := STATE_IDLE;
2503
          end if;
2504
 
2505
      end case;
2506
    end loop;
2507
  end process;
2508
 
2509
end architecture;

powered by: WebSVN 2.1.0

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