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

Subversion Repositories rio

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /rio/branches
    from Rev 36 to Rev 37
    Reverse comparison

Rev 36 → Rev 37

/singleSymbol/bench/vhdl/TestRioSerial.vhd
104,10 → 104,14
 
component RioSerial is
generic(
TIMEOUT_WIDTH : natural);
TIMEOUT_WIDTH : natural;
SYMBOL_COUNTER_WIDTH : natural := 8;
TICKS_SEND_STATUS_STARTUP : natural := 15;
TICKS_SEND_STATUS_OPERATIONAL : natural := 255);
port(
clk : in std_logic;
areset_n : in std_logic;
enable : in std_logic;
 
portLinkTimeout_i : in std_logic_vector(TIMEOUT_WIDTH-1 downto 0);
linkInitialized_o : out std_logic;
142,18 → 146,19
writeContentData_o : out std_logic_vector(31 downto 0);
 
portInitialized_i : in std_logic;
outboundSymbolFull_i : in std_logic;
outboundSymbolWrite_o : out std_logic;
outboundSymbol_o : out std_logic_vector(((2+32)-1) downto 0);
inboundSymbolEmpty_i : in std_logic;
inboundSymbolRead_o : out std_logic;
inboundSymbol_i : in std_logic_vector(((2+32)-1) downto 0));
outboundControlValid_o : out std_logic;
outboundControlSymbol_o : out std_logic_vector(23 downto 0);
outboundDataValid_o : out std_logic;
outboundDataSymbol_o : out std_logic_vector(31 downto 0);
inboundControlValid_i : in std_logic;
inboundControlSymbol_i : in std_logic_vector(23 downto 0);
inboundDataValid_i : in std_logic;
inboundDataSymbol_i : in std_logic_vector(31 downto 0));
end component;
 
constant NUMBER_WORDS : natural range 1 to 4 := 1;
signal clk : std_logic;
signal areset_n : std_logic;
signal enable : std_logic;
 
signal portLinkTimeout : std_logic_vector(10 downto 0);
signal linkInitialized : std_logic;
169,14 → 174,6
signal outstandingAckIdRead : std_logic_vector(4 downto 0);
signal outboundAckIdRead : std_logic_vector(4 downto 0);
signal portInitialized : std_logic;
signal outboundSymbolFull : std_logic;
signal outboundSymbolWrite : std_logic;
signal outboundSymbol : std_logic_vector((2+32)-1 downto 0);
signal inboundSymbolEmpty : std_logic;
signal inboundSymbolRead : std_logic;
signal inboundSymbol : std_logic_vector((2+32)-1 downto 0);
 
signal readFrameEmpty : std_logic;
signal readFrame : std_logic;
signal readFrameRestart : std_logic;
195,6 → 192,16
signal writeContent : std_logic;
signal writeContentData : std_logic_vector(31 downto 0);
 
signal portInitialized : std_logic;
signal outboundControlValid : std_logic;
signal outboundControlSymbol : std_logic_vector(23 downto 0);
signal outboundDataValid : std_logic;
signal outboundDataSymbol : std_logic_vector(31 downto 0);
signal inboundControlValid : std_logic;
signal inboundControlSymbol : std_logic_vector(23 downto 0);
signal inboundDataValid : std_logic;
signal inboundDataSymbol : std_logic_vector(31 downto 0);
 
signal frameValid : std_logic_vector(0 to 63);
signal frameWrite : RioFrameArray(0 to 63);
signal frameComplete : std_logic_vector(0 to 63);
201,7 → 208,12
signal frameExpected : std_logic;
signal frameRead : RioFrame;
signal frameReceived : std_logic;
 
signal outboundControlExpected : std_logic;
signal outboundControlSymbolExpected : std_logic_vector(23 downto 0);
signal outboundDataExpected : std_logic;
signal outboundDataSymbolExpected : std_logic_vector(31 downto 0);
 
begin
-----------------------------------------------------------------------------
224,61 → 236,53
---------------------------------------------------------------------------
-- Procedure to receive a symbol.
---------------------------------------------------------------------------
procedure ReceiveSymbol(
constant symbolType : in std_logic_vector(1 downto 0);
constant symbolContent : in std_logic_vector(31 downto 0) := x"00000000";
constant acceptIdle : in boolean := true) is
procedure ReceiveSymbolIdle is
begin
outboundSymbolFull <= '0';
wait until clk'event and clk = '1' and outboundSymbolWrite = '1';
outboundControlExpected <= '0';
outboundDataExpected <= '0';
end procedure;
 
if (acceptIdle) then
while ((outboundSymbol(33 downto 32) = SYMBOL_IDLE) and
(symbolType /= SYMBOL_IDLE)) loop
wait until clk'event and clk = '1' and outboundSymbolWrite = '1';
end loop;
end if;
assert symbolType = outboundSymbol(33 downto 32)
report "Missmatching symbol type:expected=" &
integer'image(to_integer(unsigned(symbolType))) &
" got=" &
integer'image(to_integer(unsigned(outboundSymbol(33 downto 32))))
severity error;
if (outboundSymbol(33 downto 32) = SYMBOL_CONTROL) then
assert symbolContent(31 downto 8) = outboundSymbol(31 downto 8)
report "Missmatching symbol content:expected=" &
integer'image(to_integer(unsigned(symbolContent(31 downto 8)))) &
" got=" &
integer'image(to_integer(unsigned(outboundSymbol(31 downto 8))))
severity error;
elsif (outboundSymbol(33 downto 32) = SYMBOL_DATA) then
assert symbolContent(31 downto 0) = outboundSymbol(31 downto 0)
report "Missmatching symbol content:expected=" &
integer'image(to_integer(unsigned(symbolContent(31 downto 0)))) &
" got=" &
integer'image(to_integer(unsigned(outboundSymbol(31 downto 0))))
severity error;
end if;
procedure ReceiveSymbolControl(constant symbolContent : in std_logic_vector(23 downto 0)) is
begin
outboundControlExpected <= '1';
outboundControlSymbolExpected <= symbolContent;
outboundDataExpected <= '0';
end procedure;
 
outboundSymbolFull <= '1';
procedure ReceiveSymbolData(constant symbolContent : in std_logic_vector(31 downto 0)) is
begin
outboundControlExpected <= '0';
outboundDataExpected <= '1';
outboundDataSymbolExpected <= symbolContent;
end procedure;
 
---------------------------------------------------------------------------
-- Procedure to send a symbol.
---------------------------------------------------------------------------
procedure SendSymbol(
constant symbolType : in std_logic_vector(1 downto 0);
constant symbolContent : in std_logic_vector(31 downto 0) := x"00000000") is
procedure SendSymbolIdle is
begin
inboundSymbolEmpty <= '0';
inboundSymbol <= symbolType & symbolContent;
inboundControlValid <= '0';
inboundControlSymbol <= (others=>'U');
inboundDataValid <= '0';
inboundDataSymbol <= (others=>'U');
end procedure;
 
wait until clk'event and clk = '1' and inboundSymbolRead = '1';
inboundSymbolEmpty <= '1';
procedure SendSymbolControl(constant symbolContent : in std_logic_vector(23 downto 0)) is
begin
inboundControlValid <= '1';
inboundControlSymbol <= symbolContent;
inboundDataValid <= '0';
inboundDataSymbol <= (others=>'U');
end procedure;
 
procedure SendSymbolData(constant symbolContent : in std_logic_vector(31 downto 0)) is
begin
inboundControlValid <= '0';
inboundControlSymbol <= (others=>'U');
inboundDataValid <= '1';
inboundDataSymbol <= symbolContent;
end procedure;
 
---------------------------------------------------------------------------
-- Process variables.
---------------------------------------------------------------------------
295,15 → 299,16
 
frameValid <= (others=>'0');
frameExpected <= '0';
 
portLinkTimeout <= (others=>'1');
inputPortEnable <= '1';
outputPortEnable <= '1';
portInitialized <= '0';
outboundSymbolFull <= '1';
inboundSymbolEmpty <= '1';
inboundSymbol <= (others => '0');
outboundControlExpected <= '0';
outboundDataExpected <= '0';
inboundControlValid <= '0';
inboundDataValid <= '0';
 
localAckIdWrite <= '0';
clrOutstandingAckId <= '0';
310,6 → 315,8
inboundAckIdWrite <= (others=>'0');
outstandingAckIdWrite <= (others=>'0');
outboundAckIdWrite <= (others=>'0');
 
enable <= '1';
-- Generate a startup reset pulse.
areset_n <= '0';
335,8 → 342,9
---------------------------------------------------------------------------
-- Make sure only idle-sequences are transmitted at startup.
ReceiveSymbolIdle;
for i in 0 to 1024 loop
ReceiveSymbol(SYMBOL_IDLE);
wait until clk = '1';
end loop;
 
---------------------------------------------------------------------------
358,28 → 366,33
-- The transmitter should send idle sequences at startup and a status once
-- in a while.
for i in 0 to 256 loop
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
for i in 0 to 17 loop
wait until clk = '1';
end loop;
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_NOP, "000"),
false);
for i in 0 to 254 loop
ReceiveSymbol(SYMBOL_IDLE);
 
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_NOP, "000"));
wait until clk = '1';
 
ReceiveSymbolIdle;
for i in 0 to 16 loop
wait until clk = '1';
end loop;
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_NOP, "000"),
false);
for i in 0 to 254 loop
ReceiveSymbol(SYMBOL_IDLE);
 
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_NOP, "000"));
wait until clk = '1';
 
ReceiveSymbolIdle;
for i in 0 to 16 loop
wait until clk = '1';
end loop;
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_NOP, "000"),
false);
 
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_NOP, "000"));
wait until clk = '1';
 
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
PrintS("Step 2:");
394,8 → 407,9
portInitialized <= '0';
-- Make sure only idle-sequences are transmitted at startup.
ReceiveSymbolIdle;
for i in 0 to 1024 loop
ReceiveSymbol(SYMBOL_IDLE);
wait until clk = '1';
end loop;
 
-- Initialize the port to trigger a change of state.
403,27 → 417,32
-- The transmitter should send idle sequences at startup and a status once
-- in a while.
for i in 0 to 256 loop
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
for i in 0 to 17 loop
wait until clk = '1';
end loop;
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_NOP, "000"),
false);
for i in 0 to 254 loop
ReceiveSymbol(SYMBOL_IDLE);
 
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_NOP, "000"));
wait until clk = '1';
 
ReceiveSymbolIdle;
for i in 0 to 16 loop
wait until clk = '1';
end loop;
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_NOP, "000"),
false);
for i in 0 to 254 loop
ReceiveSymbol(SYMBOL_IDLE);
 
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_NOP, "000"));
wait until clk = '1';
 
ReceiveSymbolIdle;
for i in 0 to 16 loop
wait until clk = '1';
end loop;
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_NOP, "000"),
false);
 
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_NOP, "000"));
wait until clk = '1';
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
438,23 → 457,35
 
-- A received error-free status triggers transmission of status symbols in
-- a more rapid past.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolIdle;
wait until clk = '1';
SendSymbolIdle;
ReceiveSymbolIdle;
for i in 0 to 15 loop
wait until clk = '1';
end loop;
 
-- The transmitter should send at least 15 additional statuses after
-- receiving an error free status.
for j in 0 to 15 loop
for i in 0 to 15 loop
ReceiveSymbol(SYMBOL_IDLE);
for j in 0 to 14 loop
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_NOP, "000"));
wait until clk = '1';
 
ReceiveSymbolIdle;
for i in 0 to 16 loop
wait until clk = '1';
end loop;
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_NOP, "000"),
false);
end loop;
 
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_NOP, "000"));
wait until clk = '1';
ReceiveSymbolIdle;
 
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
PrintS("Step 4:");
472,26 → 503,29
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
PrintS("Step 5:");
PrintS("Action: Send one errornous status symbol to restart the status ");
PrintS(" counting.");
PrintS("Result: Idle sequence and status symbols should be read but ");
PrintS(" status symbols should still be received more often.");
PrintS("Action: Send seven additional status symbols.");
PrintS("Result: The link should become fully initialized.");
---------------------------------------------------------------------------
PrintR("TG_RioSerial-TC2-Step5");
---------------------------------------------------------------------------
 
-- Make the link fully initialized by sending 7 additional statuses.
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_NOP, "000"));
for i in 0 to 6 loop
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_NOP, "000"));
wait until clk = '1';
end loop;
SendSymbolIdle;
for i in 0 to 8 loop
wait until clk = '1';
end loop;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_NOP, "000"));
 
-- Tick the transmitter by reading it and check that the link is initialized.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_IDLE);
wait until linkInitialized = '1';
if (linkInitialized = '0') then
wait until linkInitialized = '1';
end if;
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
517,19 → 551,17
frameRead <= frame;
-- Start the reception of a frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
 
-- Send the data symbols of the frame.
for i in 0 to frame.length-1 loop
SendSymbol(SYMBOL_DATA, frame.payload(i));
SendSymbolData(frame.payload(i));
end loop;
-- End the reception of the frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
 
-- Check that the frame has been received in the frame buffer.
wait until frameReceived = '1';
536,12 → 568,11
frameExpected <= '0';
-- Receive an idle symbol left in the FIFO before the ack was generated.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
-- Receive acknowledge for the transmitted frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00000", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00000", "11111",
STYPE1_NOP, "000"));
---------------------------------------------------------------------------
564,19 → 595,17
frameRead <= frame;
-- Start the reception of a frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
 
-- Send the data symbols of the frame.
for i in 0 to frame.length-1 loop
SendSymbol(SYMBOL_DATA, frame.payload(i));
SendSymbolData(frame.payload(i));
end loop;
-- End the reception of the frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
 
-- Check that the frame has been received in the frame buffer.
wait until frameReceived = '1';
583,12 → 612,11
frameExpected <= '0';
-- Receive an idle symbol left in the FIFO before the ack was generated.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
 
-- Receive acknowledge for the transmited frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00001", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00001", "11111",
STYPE1_NOP, "000"));
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
610,19 → 638,17
frameRead <= frame;
-- Start the reception of a frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
 
-- Send the data symbols of the frame.
for i in 0 to frame.length-1 loop
SendSymbol(SYMBOL_DATA, frame.payload(i));
SendSymbolData(frame.payload(i));
end loop;
-- End the reception of the frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
 
-- Check that the frame has been received in the frame buffer.
wait until frameReceived = '1';
629,12 → 655,11
frameExpected <= '0';
-- Receive an idle symbol left in the FIFO before the ack was generated.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
 
-- Receive acknowledge for the transmitted frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00010", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00010", "11111",
STYPE1_NOP, "000"));
 
---------------------------------------------------------------------------
657,19 → 682,17
frameRead <= frame;
-- Start the reception of a frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
 
-- Send the data symbols of the frame.
for i in 0 to frame.length-1 loop
SendSymbol(SYMBOL_DATA, frame.payload(i));
SendSymbolData(frame.payload(i));
end loop;
-- Start the reception of a frame, implicitly ending the previous.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
 
-- Check that the frame has been received in the frame buffer.
wait until frameReceived = '1';
677,12 → 700,11
wait until clk'event and clk = '1';
-- Receive an idle symbol left in the FIFO before the ack was generated.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
 
-- Receive acknowledge for the transmitted frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00011", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00011", "11111",
STYPE1_NOP, "000"));
 
-- Create the second frame.
CreateRandomPayload(payload.data, seed1, seed2);
696,13 → 718,12
-- Send the data symbols of the frame.
for i in 0 to frame.length-1 loop
SendSymbol(SYMBOL_DATA, frame.payload(i));
SendSymbolData(frame.payload(i));
end loop;
-- End the reception of the frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
 
-- Check that the frame has been received in the frame buffer.
wait until frameReceived = '1';
709,12 → 730,11
frameExpected <= '0';
-- Receive an idle symbol left in the FIFO before the ack was generated.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
 
-- Receive acknowledge for the transmitted frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00100", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00100", "11111",
STYPE1_NOP, "000"));
 
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
738,35 → 758,31
frameRead <= frame;
-- Start the reception of a frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
 
-- Send the data symbols of the frame.
for i in 0 to frame.length-1 loop
SendSymbol(SYMBOL_DATA, frame.payload(i));
SendSymbolData(frame.payload(i));
end loop;
-- Abort the reception of the frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_STOMP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_STOMP, "000"));
 
-- Dont expect the aborted frame anymore.
frameExpected <= '0';
-- Receive an idle symbol left in the FIFO before the retry was generated.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
 
-- Receive acknowledge for the transmitted frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_RETRY, "00101", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_RETRY, "00101", "11111",
STYPE1_NOP, "000"));
 
-- Acknowledge the canceled packet.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_RESTART_FROM_RETRY, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_RESTART_FROM_RETRY, "000"));
 
-- Create a new frame.
CreateRandomPayload(payload.data, seed1, seed2);
779,19 → 795,17
frameRead <= frame;
-- Start the reception of a frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
 
-- Send the data symbols of the frame.
for i in 0 to frame.length-1 loop
SendSymbol(SYMBOL_DATA, frame.payload(i));
SendSymbolData(frame.payload(i));
end loop;
-- Abort the reception of the frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
-- Check that the frame has been received in the frame buffer.
wait until frameReceived = '1';
798,12 → 812,11
frameExpected <= '0';
-- Receive an idle symbol left in the FIFO before the ack was generated.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
 
-- Receive acknowledge for the transmitted frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00101", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00101", "11111",
STYPE1_NOP, "000"));
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
817,27 → 830,23
---------------------------------------------------------------------------
-- Start the reception of a frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
 
-- Abort the reception of the frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_STOMP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_STOMP, "000"));
 
-- Receive an idle symbol left in the FIFO before the retry was generated.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
 
-- Receive acknowledge for the transmitted frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_RETRY, "00110", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_RETRY, "00110", "11111",
STYPE1_NOP, "000"));
 
-- Acknowledge the canceled packet.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_RESTART_FROM_RETRY, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_RESTART_FROM_RETRY, "000"));
 
-- Create a new frame.
CreateRandomPayload(payload.data, seed1, seed2);
850,19 → 859,17
frameRead <= frame;
 
-- Start the reception of a frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
 
-- Send the data symbols of the frame.
for i in 0 to frame.length-1 loop
SendSymbol(SYMBOL_DATA, frame.payload(i));
SendSymbolData(frame.payload(i));
end loop;
-- Abort the reception of the frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
-- Check that the frame has been received in the frame buffer.
wait until frameReceived = '1';
869,12 → 876,11
frameExpected <= '0';
-- Receive an idle symbol left in the FIFO before the ack was generated.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
 
-- Receive acknowledge for the transmitted frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00110", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00110", "11111",
STYPE1_NOP, "000"));
 
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
899,30 → 905,27
frameRead <= frame;
 
-- Start the reception of a frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
 
-- Send the data symbols of the frame.
for i in 0 to frame.length-1 loop
SendSymbol(SYMBOL_DATA, frame.payload(i));
SendSymbolData(frame.payload(i));
end loop;
-- Send a link-request/input-status to abort the current packet.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_LINK_REQUEST, "100"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_LINK_REQUEST, "100"));
 
-- Receive an idle symbol left in the FIFO before the ack was generated.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
 
-- The frame should be canceled by the link-request, dont expect it anymore.
frameExpected <= '0';
-- Receive link-response indicating normal operation and expected ackId.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "00111", "10000",
STYPE1_NOP, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "00111", "10000",
STYPE1_NOP, "000"));
 
-- Create a new frame.
CreateRandomPayload(payload.data, seed1, seed2);
935,19 → 938,17
frameRead <= frame;
 
-- Start the reception of a frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
 
-- Send the data symbols of the frame.
for i in 0 to frame.length-1 loop
SendSymbol(SYMBOL_DATA, frame.payload(i));
SendSymbolData(frame.payload(i));
end loop;
-- Abort the reception of the frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
-- Check that the frame has been received in the frame buffer.
wait until frameReceived = '1';
954,12 → 955,11
frameExpected <= '0';
 
-- Receive an idle symbol left in the FIFO before the ack was generated.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
 
-- Receive acknowledge for the transmitted frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00111", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00111", "11111",
STYPE1_NOP, "000"));
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
977,25 → 977,22
frameExpected <= '1';
-- Start the reception of a frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
 
-- Send a link-request/input-status to abort the current packet.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_LINK_REQUEST, "100"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_LINK_REQUEST, "100"));
 
-- Receive an idle symbol left in the FIFO before the ack was generated.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
 
-- Dont expect any frames anymore.
frameExpected <= '0';
-- Receive link-response indicating normal operation and expected ackId.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01000", "10000",
STYPE1_NOP, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01000", "10000",
STYPE1_NOP, "000"));
 
-- Create a new frame.
CreateRandomPayload(payload.data, seed1, seed2);
1008,19 → 1005,17
frameRead <= frame;
 
-- Start the reception of a frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
 
-- Send the data symbols of the frame.
for i in 0 to frame.length-1 loop
SendSymbol(SYMBOL_DATA, frame.payload(i));
SendSymbolData(frame.payload(i));
end loop;
-- Abort the reception of the frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
-- Check that the frame has been received in the frame buffer.
wait until frameReceived = '1';
1027,12 → 1022,11
frameExpected <= '0';
-- Receive an idle symbol left in the FIFO before the ack was generated.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
 
-- Receive acknowledge for the transmitted frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01000", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01000", "11111",
STYPE1_NOP, "000"));
 
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
1054,35 → 1048,29
payload=>payload);
-- Start the reception of a frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbol(SYMBOL_DATA, frame.payload(0));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolData(frame.payload(0));
 
-- Receive notification about that the packet needs to be retried.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_RETRY, "01001", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_RETRY, "01001", "11111",
STYPE1_NOP, "000"));
 
-- Check the status of the input port and verify the input-retry-stopped state.
-- This should also set the receiver into normal operation.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_LINK_REQUEST, "100"));
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01001", "00100",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_LINK_REQUEST, "100"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01001", "00100",
STYPE1_NOP, "000"));
 
-- Check the status of the input port and verify the input-retry-stopped state.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_LINK_REQUEST, "100"));
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01001", "10000",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_LINK_REQUEST, "100"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01001", "10000",
STYPE1_NOP, "000"));
 
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
1104,30 → 1092,25
payload=>payload);
-- Start the reception of a frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbol(SYMBOL_DATA, frame.payload(0));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolData(frame.payload(0));
 
-- Receive notification about that the packet needs to be retried.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_RETRY, "01001", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_RETRY, "01001", "11111",
STYPE1_NOP, "000"));
 
-- Acknowledge the retried packet.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_RESTART_FROM_RETRY, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_RESTART_FROM_RETRY, "000"));
 
-- Check the status of the input port and verify the input-retry-stopped state.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_LINK_REQUEST, "100"));
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01001", "10000",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_LINK_REQUEST, "100"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01001", "10000",
STYPE1_NOP, "000"));
 
-- Always receive a status after a link response when leaving input-error-stopped.
-- ReceiveSymbol(SYMBOL_CONTROL,
1152,16 → 1135,14
payload=>payload);
-- Start the reception of a frame.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbol(SYMBOL_DATA, frame.payload(0));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolData(frame.payload(0));
 
-- Receive notification about that the packet needs to be retried.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_RETRY, "01001", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_RETRY, "01001", "11111",
STYPE1_NOP, "000"));
 
-- Create a packet and send it. It should be discarded.
CreateRandomPayload(payload.data, seed1, seed2);
1170,20 → 1151,17
tt=>"01", ftype=>"0000",
sourceId=>x"0000", destId=>x"0000",
payload=>payload);
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
for i in 0 to frame.length-1 loop
SendSymbol(SYMBOL_DATA, frame.payload(i));
SendSymbolData(frame.payload(i));
end loop;
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
-- Acknowledge the retried packet.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_RESTART_FROM_RETRY, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_RESTART_FROM_RETRY, "000"));
 
-- Create a packet and send it.
CreateRandomPayload(payload.data, seed1, seed2);
1194,23 → 1172,20
payload=>payload);
frameExpected <= '1';
frameRead <= frame;
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
for i in 0 to frame.length-1 loop
SendSymbol(SYMBOL_DATA, frame.payload(i));
SendSymbolData(frame.payload(i));
end loop;
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
wait until frameReceived = '1';
frameExpected <= '0';
 
-- Receive acknowledge for the transmitted frame.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01001", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01001", "11111",
STYPE1_NOP, "000"));
 
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
1224,15 → 1199,13
---------------------------------------------------------------------------
 
-- Create, corrupt and send a control symbol.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000") xor x"00100000");
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000") xor x"00100000");
 
-- Receive a packet-not-accepted indicating error in control-symbol crc.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_NOT_ACCEPTED, "00000", "00010",
STYPE1_NOP, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_NOT_ACCEPTED, "00000", "00010",
STYPE1_NOP, "000"));
 
-- Create a packet and send it. It should be discarded.
CreateRandomPayload(payload.data, seed1, seed2);
1241,25 → 1214,21
tt=>"01", ftype=>"0000",
sourceId=>x"0000", destId=>x"0000",
payload=>payload);
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
for i in 0 to frame.length-1 loop
SendSymbol(SYMBOL_DATA, frame.payload(i));
SendSymbolData(frame.payload(i));
end loop;
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
-- Make the receiver go back to normal operation by sending a link-request.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_LINK_REQUEST, "100"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_LINK_REQUEST, "100"));
 
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01010", "00101",
STYPE1_NOP, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01010", "00101",
STYPE1_NOP, "000"));
 
-- Always receive a status after a link response when leaving input-error-stopped.
-- ReceiveSymbol(SYMBOL_CONTROL,
1275,23 → 1244,20
payload=>payload);
frameExpected <= '1';
frameRead <= frame;
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
for i in 0 to frame.length-1 loop
SendSymbol(SYMBOL_DATA, frame.payload(i));
SendSymbolData(frame.payload(i));
end loop;
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
wait until frameReceived = '1';
frameExpected <= '0';
 
-- Receive acknowledge for the transmitted frame.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01010", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01010", "11111",
STYPE1_NOP, "000"));
 
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
1313,34 → 1279,29
frame.payload(0) := frame.payload(0) xor x"00000010";
frameExpected <= '1';
frameRead <= frame;
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
for i in 0 to frame.length-1 loop
SendSymbol(SYMBOL_DATA, frame.payload(i));
SendSymbolData(frame.payload(i));
end loop;
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
-- Receive a packet-not-accepted indicating error in control-symbol crc.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_NOT_ACCEPTED, "00000", "00100",
STYPE1_NOP, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_NOT_ACCEPTED, "00000", "00100",
STYPE1_NOP, "000"));
 
-- Dont expect any frame anymore.
frameExpected <= '0';
 
-- Make the receiver go back to normal operation by sending a link-request.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_LINK_REQUEST, "100"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_LINK_REQUEST, "100"));
 
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01011", "00101",
STYPE1_NOP, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01011", "00101",
STYPE1_NOP, "000"));
 
-- Send a new frame without error.
CreateRandomPayload(payload.data, seed1, seed2);
1351,23 → 1312,20
payload=>payload);
frameExpected <= '1';
frameRead <= frame;
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_START_OF_PACKET, "000"));
for i in 0 to frame.length-1 loop
SendSymbol(SYMBOL_DATA, frame.payload(i));
SendSymbolData(frame.payload(i));
end loop;
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
STYPE1_END_OF_PACKET, "000"));
wait until frameReceived = '1';
frameExpected <= '0';
 
-- Receive acknowledge for the transmitted frame.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01011", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01011", "11111",
STYPE1_NOP, "000"));
 
-- REMARK: Complete with some more error situations: invalid ackId, too
-- short packet, too long packet, etc...
1402,16 → 1360,15
 
-- Receive an idle symbol left in the FIFO before the start of the frame was
-- generated.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
 
-- Receive the start of the frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
 
-- Receive the data symbols of the frame.
for i in 0 to frame.length-1 loop
ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
ReceiveSymbolData(frame.payload(i));
end loop;
 
-- Wait for the frame to complete.
1419,14 → 1376,12
frameValid(0) <= '0';
-- Receive the end of the frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
 
-- Send acknowledge that the frame was received.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00000", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00000", "11111",
STYPE1_NOP, "000"));
 
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
1449,16 → 1404,15
 
-- Receive an idle symbol left in the FIFO before the start of the frame was
-- generated.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
 
-- Receive the start of the frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
 
-- Receive the data symbols of the frame.
for i in 0 to frame.length-1 loop
ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
ReceiveSymbolData(frame.payload(i));
end loop;
 
-- Wait for the frame to complete.
1466,14 → 1420,12
frameValid(1) <= '0';
-- Receive the end of the frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
 
-- Send acknowledge that the frame was received.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00001", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00001", "11111",
STYPE1_NOP, "000"));
 
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
1497,42 → 1449,37
 
-- Receive an idle symbol left in the FIFO before the start of the frame was
-- generated.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
 
-- Receive the start of the frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
 
-- Receive the data symbols of the frame.
for i in 0 to frame.length-1 loop
ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
ReceiveSymbolData(frame.payload(i));
end loop;
 
-- Receive the end of the frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
 
-- Send packet-retry that the frame should be retransmitted.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_RETRY, "00010", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_RETRY, "00010", "11111",
STYPE1_NOP, "000"));
 
-- Receive the acknowledgement for the retransmission.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_RESTART_FROM_RETRY, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_RESTART_FROM_RETRY, "000"));
 
-- Receive the start of the retransmitted frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
 
-- Receive the data symbols of the retransmitted frame.
for i in 0 to frame.length-1 loop
ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
ReceiveSymbolData(frame.payload(i));
end loop;
 
-- Wait for the frame to complete.
1540,14 → 1487,12
frameValid(2) <= '0';
-- Receive the end of the retransmitted frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
 
-- Send acknowledge that the frame was received.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00010", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00010", "11111",
STYPE1_NOP, "000"));
 
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
1570,44 → 1515,38
frameWrite(3) <= frame;
 
-- Receive the start of the frame.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
 
-- Receive the data symbols of the frame.
for i in 0 to frame.length-1 loop
ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
ReceiveSymbolData(frame.payload(i));
end loop;
 
-- Receive the end of the frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
 
-- Send packet-retry that the frame should be retransmitted.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_NOT_ACCEPTED, "00000", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_NOT_ACCEPTED, "00000", "11111",
STYPE1_NOP, "000"));
 
-- Receive the acknowledgement for the retransmission.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_LINK_REQUEST, "100"));
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "00011", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_LINK_REQUEST, "100"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "00011", "11111",
STYPE1_NOP, "000"));
 
-- Receive the start of the retransmitted frame.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
 
-- Receive the data symbols of the retransmitted frame.
for i in 0 to frame.length-1 loop
ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
ReceiveSymbolData(frame.payload(i));
end loop;
 
-- Wait for the frame to complete.
1615,14 → 1554,12
frameValid(3) <= '0';
-- Receive the end of the retransmitted frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
 
-- Send acknowledge that the frame was received.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00011", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00011", "11111",
STYPE1_NOP, "000"));
 
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
1645,39 → 1582,34
frameWrite(4) <= frame;
 
-- Receive the frame.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
for i in 0 to frame.length-1 loop
ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
ReceiveSymbolData(frame.payload(i));
end loop;
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
 
-- Wait a while to let the timer expire and receive the link-request.
for i in 0 to 2048 loop
wait until clk'event and clk = '1';
end loop;
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_LINK_REQUEST, "100"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_LINK_REQUEST, "100"));
 
-- Send a link-response to make the transmitter to back to normal mode.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "00100", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "00100", "11111",
STYPE1_NOP, "000"));
-- Receive the retransmitted frame.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
for i in 0 to frame.length-1 loop
ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
ReceiveSymbolData(frame.payload(i));
end loop;
 
-- Wait for the frame to complete.
1684,14 → 1616,12
wait until frameComplete(4) = '1' and clk'event and clk = '1';
frameValid(4) <= '0';
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
 
-- Send acknowledge that the frame was received.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00100", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00100", "11111",
STYPE1_NOP, "000"));
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
1715,35 → 1645,31
frameWrite(5) <= frame;
 
-- Receive the frame.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
for i in 0 to frame.length-1 loop
ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
ReceiveSymbolData(frame.payload(i));
end loop;
 
wait until frameComplete(5) = '1' and clk'event and clk = '1';
frameValid(5) <= '0';
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
 
-- Wait a while to let the timer expire and receive the link-request.
for i in 0 to 2048 loop
wait until clk'event and clk = '1';
end loop;
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_LINK_REQUEST, "100"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_LINK_REQUEST, "100"));
 
-- Send a link-response that indicates that the frame was received to make
-- the transmitter to back to normal mode.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "00110", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "00110", "11111",
STYPE1_NOP, "000"));
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
1766,43 → 1692,38
frameWrite(6) <= frame;
 
-- Receive the frame.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
for i in 0 to frame.length-1 loop
ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
ReceiveSymbolData(frame.payload(i));
end loop;
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
 
-- Wait a while to let the timer expire and receive the link-request.
for i in 0 to 2048 loop
wait until clk'event and clk = '1';
end loop;
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_LINK_REQUEST, "100"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_LINK_REQUEST, "100"));
 
-- Wait a while to let the timer expire and receive the link-request.
for i in 0 to 2048 loop
wait until clk'event and clk = '1';
end loop;
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_LINK_REQUEST, "100"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_LINK_REQUEST, "100"));
 
-- Wait a while to let the timer expire and receive the link-request.
for i in 0 to 2048 loop
wait until clk'event and clk = '1';
end loop;
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_LINK_REQUEST, "100"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_LINK_REQUEST, "100"));
 
-- Wait a while to let the timer expire and receive the link-request.
for i in 0 to 2048 loop
1811,40 → 1732,34
 
-- Reinitialize the transmitter.
for i in 0 to 255 loop
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
end loop;
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_NOP, "000"));
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00110", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00110", "11111",
STYPE1_NOP, "000"));
for j in 0 to 14 loop
for i in 0 to 15 loop
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
end loop;
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_NOP, "000"));
end loop;
 
-- Receive the frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
for i in 0 to frame.length-1 loop
ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
ReceiveSymbolData(frame.payload(i));
end loop;
 
wait until frameComplete(6) = '1' and clk'event and clk = '1';
frameValid(6) <= '0';
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00110", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00110", "11111",
STYPE1_NOP, "000"));
 
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
1868,67 → 1783,57
frameWrite(7) <= frame;
 
-- Receive the frame.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
for i in 0 to frame.length-1 loop
ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
ReceiveSymbolData(frame.payload(i));
end loop;
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
 
-- Wait a while to let the timer expire and receive the link-request.
for i in 0 to 2048 loop
wait until clk'event and clk = '1';
end loop;
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_LINK_REQUEST, "100"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_LINK_REQUEST, "100"));
 
-- Send a link-response with unexpected ackId.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "10000", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "10000", "11111",
STYPE1_NOP, "000"));
-- Reinitialize the transmitter.
for i in 0 to 255 loop
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
end loop;
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_NOP, "000"));
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "00111", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "00111", "11111",
STYPE1_NOP, "000"));
for j in 0 to 14 loop
for i in 0 to 15 loop
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
end loop;
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_NOP, "000"));
end loop;
 
-- Receive the frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
for i in 0 to frame.length-1 loop
ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
ReceiveSymbolData(frame.payload(i));
end loop;
 
wait until frameComplete(7) = '1' and clk'event and clk = '1';
frameValid(7) <= '0';
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00111", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00111", "11111",
STYPE1_NOP, "000"));
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
1940,13 → 1845,12
---------------------------------------------------------------------------
 
-- Send a status with unexpected ackId.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "10000", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "10000", "11111",
STYPE1_NOP, "000"));
 
-- Receive no change.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
ReceiveSymbolIdle;
 
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
1958,20 → 1862,17
---------------------------------------------------------------------------
-- Send a packet-retry with unexpected ackId.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_RETRY, "10000", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_RETRY, "10000", "11111",
STYPE1_NOP, "000"));
 
-- Receive link-request.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_LINK_REQUEST, "100"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_LINK_REQUEST, "100"));
 
-- Send a link-response with unexpected ackId.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01000", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01000", "11111",
STYPE1_NOP, "000"));
-- Create the frame.
CreateRandomPayload(payload.data, seed1, seed2);
1984,23 → 1885,20
frameWrite(8) <= frame;
 
-- Receive the frame.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
for i in 0 to frame.length-1 loop
ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
ReceiveSymbolData(frame.payload(i));
end loop;
 
wait until frameComplete(8) = '1' and clk'event and clk = '1';
frameValid(8) <= '0';
 
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01000", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01000", "11111",
STYPE1_NOP, "000"));
 
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
2013,20 → 1911,17
---------------------------------------------------------------------------
 
-- Send a packet-accepted with unexpected ackId.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "10000", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "10000", "11111",
STYPE1_NOP, "000"));
 
-- Receive link-request.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_LINK_REQUEST, "100"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_LINK_REQUEST, "100"));
 
-- Send a link-response with unexpected ackId.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01001", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01001", "11111",
STYPE1_NOP, "000"));
-- Create the frame.
CreateRandomPayload(payload.data, seed1, seed2);
2039,23 → 1934,20
frameWrite(9) <= frame;
 
-- Receive the frame.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
for i in 0 to frame.length-1 loop
ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
ReceiveSymbolData(frame.payload(i));
end loop;
 
wait until frameComplete(9) = '1' and clk'event and clk = '1';
frameValid(9) <= '0';
 
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01001", "11111",
STYPE1_NOP, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01001", "11111",
STYPE1_NOP, "000"));
 
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
2077,36 → 1969,31
frameWrite(10) <= frame;
 
-- Receive the frame.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
for i in 0 to frame.length-1 loop
ReceiveSymbol(SYMBOL_DATA, frame.payload(i));
ReceiveSymbolData(frame.payload(i));
end loop;
 
wait until frameComplete(10) = '1' and clk'event and clk = '1';
frameValid(10) <= '0';
 
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
-- Send unexpected ackId in packet-accepted.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "10000", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "10000", "11111",
STYPE1_NOP, "000"));
 
-- Receive link-request.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_LINK_REQUEST, "100"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_LINK_REQUEST, "100"));
 
-- Send a link-response with expected ackId.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01011", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_LINK_RESPONSE, "01011", "11111",
STYPE1_NOP, "000"));
 
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
2139,20 → 2026,18
frameWrite(12) <= frame;
 
-- Receive the frame.
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
ReceiveSymbolIdle;
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
for i in 0 to frameWrite(11).length-1 loop
ReceiveSymbol(SYMBOL_DATA, frameWrite(11).payload(i));
ReceiveSymbolData(frameWrite(11).payload(i));
end loop;
 
-- Receive the frame.
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
for i in 0 to frameWrite(12).length-1 loop
ReceiveSymbol(SYMBOL_DATA, frameWrite(12).payload(i));
ReceiveSymbolData(frameWrite(12).payload(i));
end loop;
 
wait until frameComplete(11) = '1' and clk'event and clk = '1';
2160,17 → 2045,14
wait until frameComplete(12) = '1' and clk'event and clk = '1';
frameValid(12) <= '0';
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
-- Send packet-accepted for both packets.
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01011", "11111",
STYPE1_NOP, "000"));
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01100", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01011", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01100", "11111",
STYPE1_NOP, "000"));
 
---------------------------------------------------------------------------
PrintS("-----------------------------------------------------------------");
2202,14 → 2084,13
-- Receive the frames.
---------------------------------------------------------------------------
 
ReceiveSymbol(SYMBOL_IDLE);
ReceiveSymbolIdle;
for j in 0 to 29 loop
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
for i in 0 to frameWrite(j+13).length-1 loop
ReceiveSymbol(SYMBOL_DATA, frameWrite(j+13).payload(i));
ReceiveSymbolData(frameWrite(j+13).payload(i));
end loop;
 
wait until frameComplete(j+13) = '1' and clk'event and clk = '1';
2216,22 → 2097,19
frameValid(j+13) <= '0';
end loop;
 
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_START_OF_PACKET, "000"));
for i in 0 to frameWrite(43).length-1 loop
ReceiveSymbol(SYMBOL_DATA, frameWrite(43).payload(i));
ReceiveSymbolData(frameWrite(43).payload(i));
end loop;
ReceiveSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
ReceiveSymbolControl(RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
STYPE1_END_OF_PACKET, "000"));
wait until frameComplete(43) = '1' and clk'event and clk = '1';
frameValid(43) <= '0';
 
-- REMARK: Complete the testcase and acknowledge all transmitted packets...
SendSymbol(SYMBOL_CONTROL,
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01101", "11111",
STYPE1_NOP, "000"));
SendSymbolControl(RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01101", "11111",
STYPE1_NOP, "000"));
 
---------------------------------------------------------------------------
2265,9 → 2143,41
TestEnd;
end process;
 
-----------------------------------------------------------------------------
--
-----------------------------------------------------------------------------
OutboundSymbolCheck: process
begin
wait until clk = '1';
assert not ((outboundControlValid = '1') and (outboundDataValid = '1'))
report "Unallowed symbol sent."
severity error;
if (outboundControlExpected = '1') then
assert outboundControlValid = '1'
report "Expected an outbound control symbol."
severity error;
assert outboundControlSymbol = outboundControlSymbolExpected
report "Unexpected outbound control symbol content."
severity error;
elsif (outboundDataExpected = '1') then
assert outboundDataValid = '1'
report "Expected an outbound data symbol."
severity error;
assert outboundDataSymbol = outboundDataSymbolExpected
report "Unexpected outbound data symbol content."
severity error;
else
assert outboundControlValid = '0'
report "Not expecting outbound control symbol."
severity error;
assert outboundDataValid = '0'
report "Not expecting outbound data symbol."
severity error;
end if;
end process;
-----------------------------------------------------------------------------
-- Instantiate the uart.
-- Instantiate a SwitchPort emulator.
-----------------------------------------------------------------------------
 
TestPort: TestSwitchPort
2286,11 → 2196,15
writeFrameFull_o=>writeFrameFull, writeFrame_i=>writeFrame, writeFrameAbort_i=>writeFrameAbort,
writeContent_i=>writeContent, writeContentData_i=>writeContentData);
 
TestPhy: RioSerial
-----------------------------------------------------------------------------
-- Instantiate the test object.
-----------------------------------------------------------------------------
TestObject: RioSerial
generic map(
TIMEOUT_WIDTH=>11)
TIMEOUT_WIDTH=>11, SYMBOL_COUNTER_WIDTH=>8,
TICKS_SEND_STATUS_STARTUP=>15, TICKS_SEND_STATUS_OPERATIONAL=>255)
port map(
clk=>clk, areset_n=>areset_n,
clk=>clk, areset_n=>areset_n, enable=>enable,
portLinkTimeout_i=>portLinkTimeout,
linkInitialized_o=>linkInitialized,
inputPortEnable_i=>inputPortEnable,
2303,21 → 2217,31
inboundAckId_o=>inboundAckIdRead,
outstandingAckId_o=>outstandingAckIdRead,
outboundAckId_o=>outboundAckIdRead,
readFrameEmpty_i=>readFrameEmpty, readFrame_o=>readFrame, readFrameRestart_o=>readFrameRestart,
readFrameEmpty_i=>readFrameEmpty,
readFrame_o=>readFrame,
readFrameRestart_o=>readFrameRestart,
readFrameAborted_i=>readFrameAborted,
readWindowEmpty_i=>readWindowEmpty,
readWindowReset_o=>readWindowReset, readWindowNext_o=>readWindowNext,
readWindowReset_o=>readWindowReset,
readWindowNext_o=>readWindowNext,
readContentEmpty_i=>readContentEmpty,
readContent_o=>readContent, readContentEnd_i=>readContentEnd, readContentData_i=>readContentData,
writeFrameFull_i=>writeFrameFull, writeFrame_o=>writeFrame, writeFrameAbort_o=>writeFrameAbort,
writeContent_o=>writeContent, writeContentData_o=>writeContentData,
readContent_o=>readContent,
readContentEnd_i=>readContentEnd,
readContentData_i=>readContentData,
writeFrameFull_i=>writeFrameFull,
writeFrame_o=>writeFrame,
writeFrameAbort_o=>writeFrameAbort,
writeContent_o=>writeContent,
writeContentData_o=>writeContentData,
portInitialized_i=>portInitialized,
outboundSymbolFull_i=>outboundSymbolFull,
outboundSymbolWrite_o=>outboundSymbolWrite,
outboundSymbol_o=>outboundSymbol,
inboundSymbolEmpty_i=>inboundSymbolEmpty,
inboundSymbolRead_o=>inboundSymbolRead,
inboundSymbol_i=>inboundSymbol);
outboundControlValid_o=>outboundControlValid,
outboundControlSymbol_o=>outboundControlSymbol,
outboundDataValid_o=>outboundDataValid,
outboundDataSymbol_o=>outboundDataSymbol,
inboundControlValid_i=>inboundControlValid,
inboundControlSymbol_i=>inboundControlSymbol,
inboundDataValid_i=>inboundDataValid,
inboundDataSymbol_i=>inboundDataSymbol);
 
end architecture;
 
/singleSymbol/bench/vhdl/TestRioLogicalCommon.vhd
96,7 → 96,7
 
configStb_o : out std_logic;
configWe_o : out std_logic;
configAdr_o : out std_logic_vector(23 downto 0);
configAdr_o : out std_logic_vector(20 downto 0);
configDat_o : out std_logic_vector(63 downto 0);
configSel_o : out std_logic_vector(7 downto 0);
configDat_i : in std_logic_vector(63 downto 0);
170,7 → 170,7
signal configStb, configStbExpected : std_logic;
signal configWe, configWeExpected : std_logic;
signal configAddr, configAddrExpected : std_logic_vector(23 downto 0);
signal configAddr, configAddrExpected : std_logic_vector(20 downto 0);
signal configSel, configSelExpected : std_logic_vector(7 downto 0);
signal configDataWrite, configDataWriteExpected : std_logic_vector(63 downto 0);
signal configDataRead, configDataReadExpected : std_logic_vector(63 downto 0);
315,6 → 315,8
 
frameValid <= '0';
frameExpected <= '0';
 
configAddrExpected(20) <= '0';
wait until clk'event and clk = '1';
wait until clk'event and clk = '1';
339,7 → 341,7
 
configStbExpected <= '1';
configWeExpected <= '0';
configAddrExpected <= x"010000";
configAddrExpected(19 downto 0) <= x"01000";
configDataReadExpected <= x"00000000deadbeef";
ReadConfig32(destinationId=>x"0000", sourceId=>x"0002", hop=>x"00",
347,7 → 349,7
 
configStbExpected <= '1';
configWeExpected <= '1';
configAddrExpected <= x"010004";
configAddrExpected(19 downto 0) <= x"01000";
configDataWriteExpected <= x"c0debabe00000000";
WriteConfig32(destinationId=>x"0000", sourceId=>x"0002", hop=>x"00",
/singleSymbol/rtl/vhdl/RioCommon.vhd
87,12 → 87,6
-- Commonly used constants.
-----------------------------------------------------------------------------
-- Symbol types between the serial and the PCS layer.
constant SYMBOL_IDLE : std_logic_vector(1 downto 0) := "00";
constant SYMBOL_CONTROL : std_logic_vector(1 downto 0) := "01";
constant SYMBOL_ERROR : std_logic_vector(1 downto 0) := "10";
constant SYMBOL_DATA : std_logic_vector(1 downto 0) := "11";
-- STYPE0 constants.
constant STYPE0_PACKET_ACCEPTED : std_logic_vector(2 downto 0) := "000";
constant STYPE0_PACKET_RETRY : std_logic_vector(2 downto 0) := "001";
343,7 → 337,7
constant stype1 : in std_logic_vector(2 downto 0);
constant cmd : in std_logic_vector(2 downto 0))
return std_logic_vector is
variable returnValue : std_logic_vector(31 downto 0);
variable returnValue : std_logic_vector(23 downto 0);
variable symbolData : std_logic_vector(18 downto 0);
begin
symbolData(18 downto 16) := stype0;
352,9 → 346,8
symbolData(5 downto 3) := stype1;
symbolData(2 downto 0) := cmd;
 
returnValue(31 downto 13) := symbolData;
returnValue(12 downto 8) := Crc5(symbolData, "11111");
returnValue(7 downto 0) := x"00";
returnValue(23 downto 5) := symbolData;
returnValue(4 downto 0) := Crc5(symbolData, "11111");
 
return returnValue;
end function;
/singleSymbol/rtl/vhdl/RioSerial.vhd
193,7 → 193,7
-------------------------------------------------------------------------------
entity RioSerial is
generic(
TIMEOUT_WIDTH : natural := 20;
TIMEOUT_WIDTH : natural;
SYMBOL_COUNTER_WIDTH : natural := 8;
TICKS_SEND_STATUS_STARTUP : natural := 15;
TICKS_SEND_STATUS_OPERATIONAL : natural := 255);
296,10 → 296,10
outboundAckId_o : out std_logic_vector(4 downto 0);
portInitialized_i : in std_logic;
txControlValid_o : out std_logic;
txControlSymbol_o : out std_logic_vector(23 downto 0);
txDataValid_o : out std_logic;
txDataSymbol_o : out std_logic_vector(31 downto 0);
outboundControlValid_o : out std_logic;
outboundControlSymbol_o : out std_logic_vector(23 downto 0);
outboundDataValid_o : out std_logic;
outboundDataSymbol_o : out std_logic_vector(31 downto 0);
 
txControlEmpty_i : in std_logic_vector(NUMBER_SYMBOLS-1 downto 0);
txControlSymbol_i : in std_logic_vector(12*NUMBER_SYMBOLS downto 0);
332,6 → 332,7
port(
clk : in std_logic;
areset_n : in std_logic;
enable : in std_logic;
 
portEnable_i : in std_logic;
340,10 → 341,10
inboundAckId_o : out std_logic_vector(4 downto 0);
portInitialized_i : in std_logic;
rxControlValid_i : in std_logic;
rxControlSymbol_i : in std_logic_vector(23 downto 0);
rxDataValid_i : in std_logic;
rxDataSymbol_i : in std_logic_vector(31 downto 0);
inboundControlValid_i : in std_logic;
inboundControlSymbol_i : in std_logic_vector(23 downto 0);
inboundDataValid_i : in std_logic;
inboundDataSymbol_i : in std_logic_vector(31 downto 0);
 
txControlWrite_o : out std_logic_vector(NUMBER_SYMBOLS-1 downto 0);
txControlSymbol_o : out std_logic_vector(12*NUMBER_SYMBOLS downto 0);
405,10 → 406,10
outstandingAckId_o=>outstandingAckId_o,
outboundAckId_o=>outboundAckId_o,
portInitialized_i=>portInitialized_i,
txControlValid_o=>outboundControlValid_o,
txControlSymbol_o=>outboundControlSymbol_o,
txDataValid_o=>outboundDataValid_o,
txDataSymbol_o=>outboundDataSymbol_o,
outboundControlValid_o=>outboundControlValid_o,
outboundControlSymbol_o=>outboundControlSymbol_o,
outboundDataValid_o=>outboundDataValid_o,
outboundDataSymbol_o=>outboundDataSymbol_o,
txControlEmpty_i=>txControlReadEmpty,
txControlSymbol_i=>txControlReadSymbol,
txControlUpdate_o=>txControlRead,
455,16 → 456,16
Receiver: RioReceiver
generic map(NUMBER_SYMBOLS=>NUMBER_SYMBOLS)
port map(
clk=>clk, areset_n=>areset_n,
clk=>clk, areset_n=>areset_n, enable=>enable,
portEnable_i=>inputPortEnable_i,
localAckIdWrite_i=>localAckIdWrite_i,
inboundAckId_i=>inboundAckId_i,
inboundAckId_o=>inboundAckId_o,
portInitialized_i=>portInitialized_i,
rxControlValid_i=>rxControlValid_i,
rxControlSymbol_i=>rxControlSymbol_i,
rxDataValid_i=>rxDataValid_i,
rxDataSymbol_i=>rxDataSymbol_i,
inboundControlValid_i=>inboundControlValid_i,
inboundControlSymbol_i=>inboundControlSymbol_i,
inboundDataValid_i=>inboundDataValid_i,
inboundDataSymbol_i=>inboundDataSymbol_i,
txControlWrite_o=>txControlWrite,
txControlSymbol_o=>txControlWriteSymbol,
rxControlWrite_o=>rxControlWrite,
520,10 → 521,10
-- Port output interface.
portInitialized_i : in std_logic;
txControlValid_o : out std_logic;
txControlSymbol_o : out std_logic_vector(23 downto 0);
txDataValid_o : out std_logic;
txDataSymbol_o : out std_logic_vector(31 downto 0);
outboundControlValid_o : out std_logic;
outboundControlSymbol_o : out std_logic_vector(23 downto 0);
outboundDataValid_o : out std_logic;
outboundDataSymbol_o : out std_logic_vector(31 downto 0);
 
-- Control symbols aimed to the transmitter.
txControlEmpty_i : in std_logic_vector(NUMBER_SYMBOLS-1 downto 0);
573,10 → 574,10
portEnable_i : in std_logic;
 
portInitialized_i : in std_logic;
txControlValid_o : out std_logic;
txControlSymbol_o : out std_logic_vector(23 downto 0);
txDataValid_o : out std_logic;
txDataSymbol_o : out std_logic_vector(31 downto 0);
outboundControlValid_o : out std_logic;
outboundControlSymbol_o : out std_logic_vector(23 downto 0);
outboundDataValid_o : out std_logic;
outboundDataSymbol_o : out std_logic_vector(31 downto 0);
 
txControlEmpty_i : in std_logic;
txControlSymbol_i : in std_logic_vector(12 downto 0);
620,8 → 621,6
frameContent_o : out std_logic_vector(31 downto 0);
statusCounter_i : in std_logic_vector(3 downto 0);
statusCounter_o : out std_logic_vector(3 downto 0);
symbolCounter_i : in std_logic_vector(SYMBOL_COUNTER_WIDTH-1 downto 0);
symbolCounter_o : out std_logic_vector(SYMBOL_COUNTER_WIDTH-1 downto 0);
 
readFrameEmpty_i : in std_logic;
readFrame_o : out std_logic;
676,7 → 675,6
signal frameStateCurrent, frameStateNext : std_logic_vector(4*NUMBER_SYMBOLS-1 downto 0);
signal frameContentCurrent, frameContentNext : std_logic_vector(32*NUMBER_SYMBOLS-1 downto 0);
signal statusCounterCurrent, statusCounterNext : std_logic_vector(4*NUMBER_SYMBOLS-1 downto 0);
signal symbolCounterCurrent, symbolCounterNext : std_logic_vector(8*NUMBER_SYMBOLS-1 downto 0);
 
signal readFrame : std_logic_vector(NUMBER_SYMBOLS-1 downto 0);
signal readFrameRestart : std_logic_vector(NUMBER_SYMBOLS-1 downto 0);
773,9 → 771,8
frameStateCurrent <= (others=>'0');
frameContentCurrent <= (others=>'0');
statusCounterCurrent <= (others=>'0');
symbolCounterCurrent <= (others=>'0');
elsif (clk'event and clk = '1') then
if (enable = '0') then
if (enable = '1') then
operationalCurrent <= operationalNext;
ackIdCurrent <= ackIdNext;
bufferStatusCurrent <= bufferStatusNext;
789,7 → 786,6
frameStateCurrent <= frameStateNext;
frameContentCurrent <= frameContentNext;
statusCounterCurrent <= statusCounterNext;
symbolCounterCurrent <= symbolCounterNext;
end if;
end if;
end process;
803,10 → 799,10
clk=>clk, areset_n=>areset_n, enable=>enable,
portEnable_i=>portEnable_i,
portInitialized_i=>portInitialized_i,
txControlValid_o=>txControlValid_o,
txControlSymbol_o=>txControlSymbol_o,
txDataValid_o=>txDataValid_o,
txDataSymbol_o=>txDataSymbol_o,
outboundControlValid_o=>outboundControlValid_o,
outboundControlSymbol_o=>outboundControlSymbol_o,
outboundDataValid_o=>outboundDataValid_o,
outboundDataSymbol_o=>outboundDataSymbol_o,
txControlEmpty_i=>txControlEmpty_i(i),
txControlSymbol_i=>txControlSymbol_i(13*(i+1)-1 downto 13*i),
txControlUpdate_o=>txControlUpdate_o(i),
845,8 → 841,6
frameContent_o=>frameContentNext(32*(i+1)-1 downto 32*i),
statusCounter_i=>statusCounterCurrent(4*(i+1)-1 downto 4*i),
statusCounter_o=>statusCounterNext(4*(i+1)-1 downto 4*i),
symbolCounter_i=>symbolCounterCurrent(SYMBOL_COUNTER_WIDTH*(i+1)-1 downto SYMBOL_COUNTER_WIDTH*i),
symbolCounter_o=>symbolCounterNext(SYMBOL_COUNTER_WIDTH*(i+1)-1 downto SYMBOL_COUNTER_WIDTH*i),
readFrameEmpty_i=>readFrameEmpty_i,
readFrame_o=>readFrame(i),
readFrameRestart_o=>readFrameRestart(i),
873,10 → 867,10
-- TICKS_SEND_STATUS - The number of consequtive ticks sending nothing to wait
-- before a status-control-symbol is transmitted.
--
-- txControlValid_o='0' and txDataValid_o='0': nothing to send.
-- txControlValid_o='0' and txDataValid_o='1': txDataSymbol_o contains a data-symbol.
-- txControlValid_o='1' and txDataValid_o='0': txControlSymbol_o contains a control-symbol.
-- txControlValid_o='1' and txDataValid_o='1': an error has occurred.
-- outboundControlValid_o='0' and outboundDataValid_o='0': nothing to send.
-- outboundControlValid_o='0' and outboundDataValid_o='1': outboundDataSymbol_o contains a data-symbol.
-- outboundControlValid_o='1' and outboundDataValid_o='0': outboundControlSymbol_o contains a control-symbol.
-- outboundControlValid_o='1' and outboundDataValid_o='1': an error has occurred.
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
902,10 → 896,10
 
-- Port output interface.
portInitialized_i : in std_logic;
txControlValid_o : out std_logic;
txControlSymbol_o : out std_logic_vector(23 downto 0);
txDataValid_o : out std_logic;
txDataSymbol_o : out std_logic_vector(31 downto 0);
outboundControlValid_o : out std_logic;
outboundControlSymbol_o : out std_logic_vector(23 downto 0);
outboundDataValid_o : out std_logic;
outboundDataSymbol_o : out std_logic_vector(31 downto 0);
 
-- Control symbols aimed to the transmitter.
txControlEmpty_i : in std_logic;
954,8 → 948,6
frameContent_o : out std_logic_vector(31 downto 0);
statusCounter_i : in std_logic_vector(3 downto 0);
statusCounter_o : out std_logic_vector(3 downto 0);
symbolCounter_i : in std_logic_vector(SYMBOL_COUNTER_WIDTH-1 downto 0);
symbolCounter_o : out std_logic_vector(SYMBOL_COUNTER_WIDTH-1 downto 0);
-- Frame buffer interface.
readFrameEmpty_i : in std_logic;
1042,7 → 1034,8
signal dataContent : std_logic_vector(31 downto 0);
 
-- Stage-4 signals.
signal sendStatusRequiredOut, sendStatusRequired : std_logic;
signal symbolCounter : std_logic_vector(SYMBOL_COUNTER_WIDTH-1 downto 0);
signal sendStatusRequired : std_logic;
signal controlContent : std_logic_vector(23 downto 0);
signal crc5 : std_logic_vector(4 downto 0);
 
1612,7 → 1605,7
-- before the operational-state is entered.
-- Input: symbolControlStart, symbolControlEnd, symbolControlRestart,
-- symbolControlLinkRequest, symbolData, symbolDataContent
-- Output: symbolCounter_o, operational_o,
-- Output: operational_o,
-- symbolControl, stype0, parameter0, parameter1, stype1, cmd
-----------------------------------------------------------------------------
 
1625,6 → 1618,7
process(linkInitialized_i, ackIdStatus_i, portInitialized_i,
operational_i, statusCounter_i, statusReceived_i,
rxControlEmpty_i,
sendStatusRequired,
symbolControlStype1, symbolData,
rxControlStype0, rxControlParameter0, rxControlParameter1,
fatalError_i)
1803,28 → 1797,41
-- Inputs: controlValid, stype0, parameter0, parameter1, stype1, cmd
-----------------------------------------------------------------------------
 
process(controlValid, stype0, portInitialized_i, symbolCounter_i)
process(clk, areset_n)
begin
if ((controlValid = '1') and
((stype0 = STYPE0_STATUS) or
(stype0 = STYPE0_PACKET_ACCEPTED) or
(stype0 = STYPE0_PACKET_RETRY))) then
if (areset_n = '0') then
sendStatusRequired <= '0';
symbolCounter <= (others=>'0');
elsif (clk'event and clk = '1') then
if (portInitialized_i = '0') then
symbolCounter_o <=
sendStatusRequired <= '0';
symbolCounter <=
std_logic_vector(to_unsigned(TICKS_SEND_STATUS_STARTUP,
SYMBOL_COUNTER_WIDTH));
else
symbolCounter_o <=
std_logic_vector(to_unsigned(TICKS_SEND_STATUS_OPERATIONAL,
SYMBOL_COUNTER_WIDTH));
elsif (enable = '1') then
if ((controlValid = '1') and
((stype0 = STYPE0_STATUS) or
(stype0 = STYPE0_PACKET_ACCEPTED) or
(stype0 = STYPE0_PACKET_RETRY))) then
if (operational_i = '0') then
symbolCounter <=
std_logic_vector(to_unsigned(TICKS_SEND_STATUS_STARTUP,
SYMBOL_COUNTER_WIDTH));
else
symbolCounter <=
std_logic_vector(to_unsigned(TICKS_SEND_STATUS_OPERATIONAL,
SYMBOL_COUNTER_WIDTH));
end if;
else
if (unsigned(symbolCounter) = 0) then
sendStatusRequired <= '1';
symbolCounter <= std_logic_vector(unsigned(symbolCounter) - 1);
else
sendStatusRequired <= '0';
symbolCounter <= std_logic_vector(unsigned(symbolCounter) - 1);
end if;
end if;
end if;
else
if (unsigned(symbolCounter_i) = 0) then
sendStatusRequiredOut <= '1';
else
sendStatusRequiredOut <= '0';
symbolCounter_o <= std_logic_vector(unsigned(symbolCounter_i) - 1);
end if;
end if;
end process;
1842,18 → 1849,16
process(clk, areset_n)
begin
if (areset_n = '0') then
sendStatusRequired <= '0';
txControlValid_o <= '0';
txControlSymbol_o <= (others=>'0');
txDataValid_o <= '0';
txDataSymbol_o <= (others=>'0');
outboundControlValid_o <= '0';
outboundControlSymbol_o <= (others=>'0');
outboundDataValid_o <= '0';
outboundDataSymbol_o <= (others=>'0');
elsif (clk'event and clk = '1') then
if (enable = '1') then
sendStatusRequired <= sendStatusRequiredOut;
txControlValid_o <= controlValid;
txControlSymbol_o <= controlContent;
txDataValid_o <= dataValid;
txDataSymbol_o <= dataContent;
outboundControlValid_o <= controlValid;
outboundControlSymbol_o <= controlContent;
outboundDataValid_o <= dataValid;
outboundDataSymbol_o <= dataContent;
end if;
end if;
end process;
1889,10 → 1894,10
inboundAckId_o : out std_logic_vector(4 downto 0);
portInitialized_i : in std_logic;
rxControlValid_i : in std_logic;
rxControlSymbol_i : in std_logic_vector(23 downto 0);
rxDataValid_i : in std_logic;
rxDataSymbol_i : in std_logic_vector(31 downto 0);
inboundControlValid_i : in std_logic;
inboundControlSymbol_i : in std_logic_vector(23 downto 0);
inboundDataValid_i : in std_logic;
inboundDataSymbol_i : in std_logic_vector(31 downto 0);
txControlWrite_o : out std_logic_vector(NUMBER_SYMBOLS-1 downto 0);
txControlSymbol_o : out std_logic_vector(12*NUMBER_SYMBOLS downto 0);
1934,10 → 1939,10
-- Port input interface.
portInitialized_i : in std_logic;
rxControlValid_i : in std_logic;
rxControlSymbol_i : in std_logic_vector(23 downto 0);
rxDataValid_i : in std_logic;
rxDataSymbol_i : in std_logic_vector(31 downto 0);
inboundControlValid_i : in std_logic;
inboundControlSymbol_i : in std_logic_vector(23 downto 0);
inboundDataValid_i : in std_logic;
inboundDataSymbol_i : in std_logic_vector(31 downto 0);
 
-- Receiver has received a control symbol containing:
-- packet-accepted, packet-retry, packet-not-accepted,
1959,7 → 1964,6
linkInitialized_o : out std_logic;
 
-- Core->Core cascading signals.
enable_o : out std_logic;
operational_i : in std_logic;
operational_o : out std_logic;
inputRetryStopped_i : in std_logic;
1991,12 → 1995,6
signal txControlWrite : std_logic_vector(NUMBER_SYMBOLS-1 downto 0);
signal rxControlWrite : std_logic_vector(NUMBER_SYMBOLS-1 downto 0);
signal writeFrame : std_logic_vector(NUMBER_SYMBOLS-1 downto 0);
signal writeFrameAbort : std_logic_vector(NUMBER_SYMBOLS-1 downto 0);
signal writeContent : std_logic_vector(NUMBER_SYMBOLS-1 downto 0);
signal writeContentWords : std_logic_vector(2*NUMBER_SYMBOLS-1 downto 0);
signal writeContentData : std_logic_vector(32*NUMBER_SYMBOLS-1 downto 0);
 
begin
 
-----------------------------------------------------------------------------
2038,10 → 2036,10
inboundAckId_i=>inboundAckId_i,
inboundAckId_o=>inboundAckId_o,
portInitialized_i=>portInitialized_i,
rxControlValid_i=>rxControlValid_i,
rxControlSymbol_i=>rxControlSymbol_i,
rxDataValid_i=>rxDataValid_i,
rxDataSymbol_i=>rxDataSymbol_i,
inboundControlValid_i=>inboundControlValid_i,
inboundControlSymbol_i=>inboundControlSymbol_i,
inboundDataValid_i=>inboundDataValid_i,
inboundDataSymbol_i=>inboundDataSymbol_i,
txControlWrite_o=>txControlWrite(i),
txControlSymbol_o=>txControlSymbol_o(13*(i+1)-1 downto 13*i),
rxControlWrite_o=>rxControlWrite(i),
2100,10 → 2098,10
-- Port input interface.
portInitialized_i : in std_logic;
rxControlValid_i : in std_logic;
rxControlSymbol_i : in std_logic_vector(23 downto 0);
rxDataValid_i : in std_logic;
rxDataSymbol_i : in std_logic_vector(31 downto 0);
inboundControlValid_i : in std_logic;
inboundControlSymbol_i : in std_logic_vector(23 downto 0);
inboundDataValid_i : in std_logic;
inboundDataSymbol_i : in std_logic_vector(31 downto 0);
 
-- Receiver has received a control symbol containing:
-- packet-accepted, packet-retry, packet-not-accepted,
2210,7 → 2208,7
-----------------------------------------------------------------------------
 
Crc5Calculator: Crc5ITU
port map(d_i=>rxControlSymbol_i(23 downto 5), crc_o=>crc5);
port map(d_i=>inboundControlSymbol_i(23 downto 5), crc_o=>crc5);
 
process(clk, areset_n)
begin
2223,21 → 2221,21
symbolDataContent0 <= (others=>'0');
elsif (clk'event and clk = '1') then
if (enable = '1') then
if (crc5 = rxControlSymbol_i(4 downto 0)) then
if (crc5 = inboundControlSymbol_i(4 downto 0)) then
crc5Valid <= '1';
else
crc5Valid <= '0';
end if;
if (rxControlValid_i = '1') and (rxDataValid_i = '1') then
if (inboundControlValid_i = '1') and (inboundDataValid_i = '1') then
symbolErrorValid0 <= '1';
symbolControlValid0 <= '0';
symbolDataValid0 <= '0';
else
symbolErrorValid0 <= '0';
symbolControlValid0 <= rxControlValid_i;
symbolControlContent0 <= rxControlSymbol_i;
symbolDataValid0 <= rxDataValid_i;
symbolDataContent0 <= rxDataSymbol_i;
symbolControlValid0 <= inboundControlValid_i;
symbolControlContent0 <= inboundControlSymbol_i;
symbolDataValid0 <= inboundDataValid_i;
symbolDataContent0 <= inboundDataSymbol_i;
end if;
end if;
end if;
2418,7 → 2416,7
inputErrorStopped_o <= '0';
-- Reset all packets.
writeFrameAbort_o <= '1';
writeFrameAbortOut <= '1';
else
-- Increase the number of error-free status symbols that
-- has been received.
2489,7 → 2487,7
 
-- Update the frame buffer to indicate that the frame has
-- been completly received.
writeFrame_o <= '1';
writeFrameOut <= '1';
 
-- Update ackId.
ackId_o <= ackId_i + 1;
2561,7 → 2559,7
 
-- Abort the frame and reset frame reception.
frameIndex_o <= (others => '0');
writeFrameAbort_o <= '1';
writeFrameAbortOut <= '1';
-- Go back to the normal operational state.
inputRetryStopped_o <= '0';
2621,7 → 2619,7
inputRetryStopped_o <= '0';
inputErrorStopped_o <= '0';
frameIndex_o <= (others=>'0');
writeFrameAbort_o <= '1';
writeFrameAbortOut <= '1';
end if;
else
-- A control symbol contains a crc error.
2669,7 → 2667,7
-- Write the symbol content and increment the number of
-- received data symbols.
writeContent_o <= '1';
writeContentOut <= '1';
frameIndex_o <= std_logic_vector(unsigned(frameIndex_i) + 1);
else
-- The packet buffer is full.
2702,7 → 2700,7
-- A frame has been started and is not too long.
-- Check if the buffer entry is ready to be written
-- into the packet buffer.
writeContent_o <= '1';
writeContentOut <= '1';
 
-- Increment the number of received data symbols.
frameIndex_o <= std_logic_vector(unsigned(frameIndex_i) + 1);
/singleSymbol/rtl/vhdl/RioLogicalCommon.vhd
161,7 → 161,7
 
configStb_o : out std_logic;
configWe_o : out std_logic;
configAdr_o : out std_logic_vector(23 downto 0);
configAdr_o : out std_logic_vector(20 downto 0);
configSel_o : out std_logic_vector(7 downto 0);
configDat_o : out std_logic_vector(63 downto 0);
configDat_i : in std_logic_vector(63 downto 0);
214,7 → 214,7
 
configStb_o : out std_logic;
configWe_o : out std_logic;
configAdr_o : out std_logic_vector(23 downto 0);
configAdr_o : out std_logic_vector(20 downto 0);
configDat_o : out std_logic_vector(63 downto 0);
configSel_o : out std_logic_vector(7 downto 0);
configDat_i : in std_logic_vector(63 downto 0);
231,20 → 231,35
masterDat_o : out std_logic_vector(31 downto 0);
masterAck_i : in std_logic);
end component;
 
signal masterCyc : std_logic;
signal masterStb : std_logic;
signal masterAdr : std_logic_vector(7 downto 0);
signal masterDat : std_logic_vector(31 downto 0);
signal masterAck : std_logic;
 
signal slaveCyc : std_logic;
signal slaveStb : std_logic;
signal slaveDat : std_logic_vector(31 downto 0);
signal slaveAck : std_logic;
 
signal masterMaintenanceAck : std_logic;
signal slaveMaintenanceAck : std_logic;
begin
 
-- REMARK: Add crossbar for slave interface?
masterCyc_o <= masterCyc;
masterStb_o <= masterStb;
masterAdr_o <= masterAdr;
masterDat_o <= masterDat;
masterAck_i <= masterAck;
 
slaveCyc_i <= slaveCyc;
slaveStb_i <= slaveStb;
slaveAdr_i <= slaveAdr;
slaveDat_i <= slaveDat;
slaveAck_o <= slaveAck or maintenanceAck;
masterAck <= masterAck_i or masterMaintenanceAck;
slaveCyc <= slaveCyc_i;
slaveStb <= slaveStb_i;
slaveDat <= slaveDat_i;
slaveAck_o <= slaveAck or slaveMaintenanceAck;
LogicalMaintenance: RioLogicalMaintenance
port map(
clk=>clk, areset_n=>areset_n, enable=>enable,
255,15 → 270,15
configSel_o=>configSel_o,
configDat_i=>configDat_i,
configAck_i=>configAck_i,
slaveCyc_i=>slaveCyc,
slaveStb_i=>slaveStb,
slaveAdr_i=>slaveAdr,
slaveDat_i=>slaveDat,
slaveAck_o=>maintenanceAck,
masterCyc_o=>masterCyc,
masterStb_o=>masterStb,
masterDat_o=>masterDat,
masterAck_i=>masterAck);
slaveCyc_i=>masterCyc,
slaveStb_i=>masterStb,
slaveAdr_i=>masterAdr,
slaveDat_i=>masterDat,
slaveAck_o=>masterMaintenanceAck,
masterCyc_o=>slaveCyc,
masterStb_o=>slaveStb,
masterDat_o=>slaveDat,
masterAck_i=>slaveMaintenanceAck);
 
-- REMARK: Add interconnect for master signals...
608,10 → 623,14
signal dstAddr : std_logic_vector(31 downto 0);
signal srcAddr : std_logic_vector(31 downto 0);
signal writeContentData : std_logic_vector(31 downto 0);
 
signal crc16Current, crc16Temp, crc16Next: std_logic_vector(15 downto 0);
 
begin
 
writeContentData_o <= writeContentData;
process(clk, areset_n)
begin
if (areset_n = '0') then
638,22 → 657,10
--
---------------------------------------------------------------------
if ((slaveCyc_i = '1') and (slaveStb_i = '1')) then
-- REMARK: Only support the header in one position?
if (slaveSelect_i = "1100") then
header <= slaveData_i(31 downto 16);
tt <= slaveData_i(21 downto 20);
elsif (slaveSelect_i = "0110") then
header <= slaveData_i(23 downto 8);
tt <= slaveData_i(13 downto 12);
elsif (slaveSelect_i = "0011") then
header <= slaveData_i(15 downto 0);
tt <= slaveData_i(5 downto 4);
else
-- REMARK: Not supported.
end if;
header <= slaveDat_i(15 downto 0);
tt <= slaveDat_i(5 downto 4);
 
slaveAck_o <= '1';
 
state <= HEADER_ACK;
else
state <= RESTART_FRAME;
672,33 → 679,17
---------------------------------------------------------------------
if ((slaveCyc_i = '1') and (slaveStb_i = '1')) then
-- REMARK: Only support the destination in one position?
if (slaveSelect_i = "1000") and (tt = "00") then
dstAddr <= slaveData_i(31 downto 24);
elsif (slaveSelect_i = "0100") and (tt = "00") then
dstAddr <= slaveData_i(23 downto 16);
elsif (slaveSelect_i = "0010") and (tt = "00") then
dstAddr <= slaveData_i(15 downto 8);
elsif (slaveSelect_i = "0001") and (tt = "00") then
dstAddr <= slaveData_i(7 downto 0);
elsif (slaveSelect_i = "1100") and (tt = "01") then
if (tt = "00") then
dstAddr <= x"00" & slaveDat_i(7 downto 0);
elsif (tt = "01") then
writeContent_o <= '1';
writeContentData <= header & slaveData_i(31 downto 16);
writeContentData <= header & slaveDat_i(15 downto 0);
packetPosition <= packetPosition + 1;
elsif (slaveSelect_i = "0110") and (tt = "01") then
writeContent_o <= '1';
writeContentData <= header & slaveData_i(24 downto 8);
packetPosition <= packetPosition + 1;
elsif (slaveSelect_i = "0011") and (tt = "01") then
writeContent_o <= '1';
writeContentData <= header & slaveData_i(15 downto 0);
packetPosition <= packetPosition + 1;
else
-- REMARK: Not supported.
end if;
slaveAck_o <= '1';
 
state <= DESTINATION_ACK;
else
state <= RESTART_FRAME;
717,42 → 708,19
---------------------------------------------------------------------
if ((slaveCyc_i = '1') and (slaveStb_i = '1')) then
-- REMARK: Only support the source in one position?
if (slaveSelect_i = "1000") and (tt = "00") then
if (tt = "00") then
halfWordPending <= '0';
writeContent_o <= '1';
writeContentData <= header & dstAddr & slaveData_i(31 downto 24);
writeContentData <= header & dstAddr & slaveDat_i(7 downto 0);
packetPosition <= packetPosition + 1;
elsif (slaveSelect_i = "0100") and (tt = "00") then
halfWordPending <= '0';
writeContent_o <= '1';
writeContentData <= header & dstAddr & slaveData_i(23 downto 16);
packetPosition <= packetPosition + 1;
elsif (slaveSelect_i = "0010") and (tt = "00") then
halfWordPending <= '0';
writeContent_o <= '1';
writeContentData <= header & dstAddr & slaveData_i(15 downto 8);
packetPosition <= packetPosition + 1;
elsif (slaveSelect_i = "0001") and (tt = "00") then
halfWordPending <= '0';
writeContent_o <= '1';
writeContentData <= header & dstAddr & slaveData_i(7 downto 0);
packetPosition <= packetPosition + 1;
elsif (slaveSelect_i = "1100") and (tt = "01") then
elsif (tt = "01") then
halfWordPending <= '1';
halfWord <= slaveData_i(31 downto 16);
elsif (slaveSelect_i = "0110") and (tt = "01") then
halfWordPending <= '1';
halfWord <= slaveData_i(24 downto 8);
elsif (slaveSelect_i = "0011") and (tt = "01") then
halfWordPending <= '1';
halfWord <= slaveData_i(15 downto 0);
halfWord <= slaveDat_i(15 downto 0);
else
-- REMARK: Not supported.
end if;
slaveAck_o <= '1';
 
state <= SOURCE_ACK;
else
state <= RESTART_FRAME;
765,7 → 733,7
slaveAck_o <= '0';
 
if (tt = "00") then
crcCurrent <= crcNext;
crc16Current <= crc16Next;
end if;
state <= CONTENT_GET;
775,43 → 743,18
--
---------------------------------------------------------------------
if ((slaveCyc_i = '1') and (slaveStb_i = '1')) then
-- REMARK: Only support full writes? Not possible with the last
-- access though.
if (slaveSelect_i = "1111") then
if (halfWordPending = '0') then
writeContent_o <= '1';
writeContentData <= slaveData_i;
packetPosition <= packetPosition + 1;
else
writeContent_o <= '1';
writeContentData <= halfWord & slaveData_i(31 downto 16);
packetPosition <= packetPosition + 1;
halfWord <= slaveData_i(15 downto 0);
end if;
elsif (slaveSelect_i = "1100") then
if (halfWordPending = '0') then
halfWordPending <= '1';
halfWord <= slaveData_i(31 downto 16);
else
writeContent_o <= '1';
writeContentData <= halfWord & slaveData_i(31 downto 16);
packetPosition <= packetPosition + 1;
halfWordPending <= '0';
end if;
elsif (slaveSelect_i = "0011") then
if (halfWordPending = '0') then
halfWordPending <= '1';
halfWord <= slaveData_i(15 downto 0);
else
writeContent_o <= '1';
writeContentData <= halfWord & slaveData_i(15 downto 0);
packetPosition <= packetPosition + 1;
halfWordPending <= '0';
end if;
if (halfWordPending = '0') then
writeContent_o <= '1';
writeContentData <= slaveDat_i;
packetPosition <= packetPosition + 1;
else
writeContent_o <= '1';
writeContentData <= halfWord & slaveDat_i(31 downto 16);
packetPosition <= packetPosition + 1;
halfWord <= slaveDat_i(15 downto 0);
end if;
slaveAck_o <= '1';
 
state <= CONTENT_ACK;
else
state <= CRC_APPEND;
926,7 → 869,7
 
configStb_o : out std_logic;
configWe_o : out std_logic;
configAdr_o : out std_logic_vector(23 downto 0);
configAdr_o : out std_logic_vector(20 downto 0);
configDat_o : out std_logic_vector(63 downto 0);
configSel_o : out std_logic_vector(7 downto 0);
configDat_i : in std_logic_vector(63 downto 0);
965,9 → 908,9
requestDstId_o : out std_logic_vector(31 downto 0);
requestSrcId_o : out std_logic_vector(31 downto 0);
requestTid_o : out std_logic_vector(7 downto 0);
requestOffset_o : out std_logic_vector(21 downto 0);
requestOffset_o : out std_logic_vector(20 downto 0);
requestPayloadSelect_o : out std_logic_vector(7 downto 0);
requestPayloadLength_o : out std_logic_vector(3 downto 0);
requestPayloadLength_o : out std_logic_vector(4 downto 0);
requestPayloadIndex_i : in std_logic_vector(4 downto 0);
requestPayload_o : out std_logic_vector(63 downto 0);
requestDone_i : in std_logic;
1002,7 → 945,6
masterCyc_o : out std_logic;
masterStb_o : out std_logic;
masterAdr_o : out std_logic_vector(7 downto 0);
masterDat_o : out std_logic_vector(31 downto 0);
masterAck_i : in std_logic);
end component;
1020,15 → 962,17
signal srcId : std_logic_vector(31 downto 0);
signal tid : std_logic_vector(7 downto 0);
 
signal configAdr : std_logic_vector(20 downto 0);
signal requestReadReady : std_logic;
signal requestWriteReady : std_logic;
signal requestOffset : std_logic_vector(21 downto 0);
signal requestPayloadLength : std_logic_vector(3 downto 0);
signal requestOffset : std_logic_vector(20 downto 0);
signal requestPayloadLength : std_logic_vector(4 downto 0);
signal requestPayloadIndex : std_logic_vector(4 downto 0);
signal requestDone : std_logic;
signal responseReadReady : std_logic;
signal responseWriteRead : std_logic;
signal responseWriteReady : std_logic;
signal responsePayloadLength : std_logic_vector(3 downto 0);
signal responsePayloadWrite : std_logic;
signal responsePayloadIndex : std_logic_vector(4 downto 0);
1036,6 → 980,8
begin
 
configAdr_o <= configAdr;
-----------------------------------------------------------------------------
--
-----------------------------------------------------------------------------
1052,13 → 998,13
if (requestReadReady = '1') then
configStb_o <= '1';
configWe_o <= '0';
configAdr_o <= requestOffset;
configAdr <= requestOffset;
responsePayloadIndex <= (others=>'0');
state <= CONFIG_READ;
elsif (requestWriteReady = '1') then
configStb_o <= '1';
configWe_o <= '1';
configAdr_o <= requestOffset;
configAdr <= requestOffset;
requestPayloadIndex <= (others=>'0');
state <= CONFIG_WRITE;
end if;
1069,10 → 1015,11
---------------------------------------------------------------------
if (configAck_i = '1') then
responsePayloadWrite <= '1';
responsePayloadIndex <= responsePayloadIndex + 1;
responsePayloadIndex <=
std_logic_vector(unsigned(responsePayloadIndex) + 1);
if (responsePayloadIndex /= requestPayloadLength) then
configAdr_o <= configAdr_o + 1;
configAdr <= std_logic_vector(unsigned(configAdr) + 1);
else
requestDone <= '1';
configStb_o <= '0';
1095,8 → 1042,9
---------------------------------------------------------------------
if (configAck_i = '1') then
if (responsePayloadIndex /= requestPayloadLength) then
configAdr_o <= configAdr_o + 1;
requestIndex <= requestIndex + 1;
configAdr <= std_logic_vector(unsigned(configAdr) + 1);
requestPayloadIndex <=
std_logic_vector(unsigned(requestPayloadIndex) + 1);
else
requestDone <= '1';
configStb_o <= '0';
1108,7 → 1056,7
---------------------------------------------------------------------
--
---------------------------------------------------------------------
responseReadReady <= '1';
responseWriteReady <= '1';
if (responseDone = '1') then
state <= IDLE;
end if;
1135,7 → 1083,7
requestTt_o=>tt,
requestDstId_o=>dstId,
requestSrcId_o=>srcId,
requestTid_o=>requestTid,
requestTid_o=>tid,
requestOffset_o=>requestOffset,
requestPayloadSelect_o=>configSel_o,
requestPayloadLength_o=>requestPayloadLength,
1172,7 → 1120,6
responseDone_o=>responseDone,
masterCyc_o=>masterCyc_o,
masterStb_o=>masterStb_o,
masterAdr_o=>masterAdr_o,
masterDat_o=>masterDat_o,
masterAck_i=>masterAck_i);
 
1206,9 → 1153,9
requestDstId_o : out std_logic_vector(31 downto 0);
requestSrcId_o : out std_logic_vector(31 downto 0);
requestTid_o : out std_logic_vector(7 downto 0);
requestOffset_o : out std_logic_vector(21 downto 0);
requestOffset_o : out std_logic_vector(20 downto 0);
requestPayloadSelect_o : out std_logic_vector(7 downto 0);
requestPayloadLength_o : out std_logic_vector(3 downto 0);
requestPayloadLength_o : out std_logic_vector(4 downto 0);
requestPayloadIndex_i : in std_logic_vector(4 downto 0);
requestPayload_o : out std_logic_vector(63 downto 0);
requestDone_i : in std_logic;
1244,13 → 1191,23
type StateType is (RECEIVE_PACKET, READY);
signal state : StateType;
 
signal wdptr : std_logic;
signal size : std_logic_vector(3 downto 0);
signal byteLanes : std_logic_vector(7 downto 0);
signal doubleWords : natural range 0 to 32;
 
signal slaveAck : std_logic;
signal maintReadComplete : std_logic;
signal maintWriteComplete : std_logic;
 
signal packetIndex : natural range 0 to 33;
signal requstPayload : std_logic_vector(63 downto 0);
signal requestData : std_logic_vector(63 downto 0);
 
signal memoryEnable : std_logic;
signal memoryWrite : std_logic;
signal memoryAddress : std_logic_vector(4 downto 0);
signal memoryDataIn : std_logic_vector(63 downto 0);
 
begin
 
slaveAck_o <= slaveAck;
1272,7 → 1229,7
if (slaveCyc_i = '1') then
if (slaveAck = '0') then
if (slaveStb_i = '1') then
if (slaveAddress_i = x"80") then
if (slaveAdr_i = x"80") then
-------------------------------------------------------------
-- Maintenance Read Request packet parser.
-------------------------------------------------------------
1279,7 → 1236,10
case (packetIndex) is
when 0 =>
-- x"0000" & ackid & vc & crf & prio & tt & ftype
requestHeader_o <= slaveDat_i(15 downto 0);
requestVc_o <= slaveDat_i(9);
requestCrf_o <= slaveDat_i(8);
requestPrio_o <= slaveDat_i(7 downto 6);
requestTt_o <= slaveDat_i(5 downto 4);
packetIndex <= packetIndex + 1;
when 1 =>
-- destid
1297,7 → 1257,7
packetIndex <= packetIndex + 1;
when 4 =>
-- config_offset(12:0) & wdptr & rsrv & crc(15:0)
requestOffset_o(12 downto 0) <= slaveDat_i(31 downto 16);
requestOffset_o(12 downto 0) <= slaveDat_i(31 downto 19);
wdptr <= slaveDat_i(18);
packetIndex <= packetIndex + 1;
maintReadComplete <= '1';
1305,7 → 1265,7
-- There should be no more content in a maintenance read request.
-- Discard.
end case;
elsif (slaveAddress_i = x"81") then
elsif (slaveAdr_i = x"81") then
-------------------------------------------------------------
-- Maintenance Write Request packet parser.
-------------------------------------------------------------
1312,7 → 1272,10
case (packetIndex) is
when 0 =>
-- x"0000" & ackid & vc & crf & prio & tt & ftype
requestHeader_o <= slaveDat_i(15 downto 0);
requestVc_o <= slaveDat_i(9);
requestCrf_o <= slaveDat_i(8);
requestPrio_o <= slaveDat_i(7 downto 6);
requestTt_o <= slaveDat_i(5 downto 4);
packetIndex <= packetIndex + 1;
when 1 =>
-- destId
1330,23 → 1293,25
packetIndex <= packetIndex + 1;
when 4 =>
-- config_offset(12:0) & wdptr & rsrv & double-word(63:48)
requestOffset_o(12 downto 0) <= slaveDat_i(31 downto 16);
requestData(63 downto 48) <= slaveData_i(15 downto 0);
requestOffset_o(12 downto 0) <= slaveDat_i(31 downto 19);
requestData(63 downto 48) <= slaveDat_i(15 downto 0);
wdptr <= slaveDat_i(18);
packetIndex <= packetIndex + 1;
when 5 | 7 | 9 | 11 | 13 | 15 | 17 | 19 | 21 | 23 | 25 | 27 | 29 | 31 =>
-- double-word(47:16)
requestData(47 downto 16) <= slaveData_i;
requestData(47 downto 16) <= slaveDat_i;
packetIndex <= packetIndex + 1;
when 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 | 32 =>
-- double-word(15:0) & double-word(63:48)
requestData(63 downto 48) <= slaveData_i(15 downto 0);
requestData(63 downto 48) <= slaveDat_i(15 downto 0);
packetIndex <= packetIndex + 1;
 
memoryEnable <= '1';
memoryAddress <= memoryAddress + 1;
memoryAddress <=
std_logic_vector(unsigned(memoryAddress) + 1);
memoryWrite <= '1';
memoryDataIn <= requestData(63 downto 16) & slaveData_i(31 downto 16);
memoryDataIn <=
requestData(63 downto 16) & slaveDat_i(31 downto 16);
maintWriteComplete <= '1';
when others =>
-- There should be no more content in a maintenance write request.
1376,7 → 1341,7
if (requestDone_i = '1') then
maintReadComplete <= '0';
maintWriteComplete <= '0';
state <= WAIT_PACKET;
state <= RECEIVE_PACKET;
end if;
when others =>
1388,131 → 1353,121
-----------------------------------------------------------------------------
-- Transformation of rdsize/wrsize into length of access and byte lanes.
-----------------------------------------------------------------------------
requestPayloadLength_o <= doubleWords;
requestPayloadLength_o <= std_logic_vector(to_unsigned(doubleWords, 5));
requestPayloadSelect_o <= byteLanes;
-- REMARK: Make this a common component? Can be used in IO-accesses as well.
-- REMARK: Not all of these are allowed in a maintenance request.
process(wdptr, size)
process(clk, areset_n)
begin
if (areset_n = '0') then
doubleWords <= (others=>'0');
doubleWords <= 0;
byteLanes <= (others=>'0');
elsif (clk'event and clk = '1') then
if (maintReadComplete = '1') or (maintWriteComplete = '1') then
case (wdptr & size) is
when "00000" =>
doubleWords <= 1;
byteLanes <= "10000000";
when "00001" =>
doubleWords <= 1;
byteLanes <= "01000000";
when "00010" =>
doubleWords <= 1;
byteLanes <= "00100000";
when "00011" =>
doubleWords <= 1;
byteLanes <= "00010000";
when "10000" =>
doubleWords <= 1;
byteLanes <= "00001000";
when "10001" =>
doubleWords <= 1;
byteLanes <= "00000100";
when "10010" =>
doubleWords <= 1;
byteLanes <= "00000010";
when "10011" =>
doubleWords <= 1;
byteLanes <= "00000001";
when "00100" =>
doubleWords <= 1;
byteLanes <= "11000000";
when "00101" =>
doubleWords <= 1;
byteLanes <= "11100000";
when "00110" =>
doubleWords <= 1;
byteLanes <= "00110000";
when "00111" =>
doubleWords <= 1;
byteLanes <= "11111000";
when "10100" =>
doubleWords <= 1;
byteLanes <= "00001100";
when "10101" =>
doubleWords <= 1;
byteLanes <= "00000111";
when "10110" =>
doubleWords <= 1;
byteLanes <= "00000011";
when "10111" =>
doubleWords <= 1;
byteLanes <= "00011111";
when "01000" =>
doubleWords <= 1;
byteLanes <= "11110000";
when "11000" =>
doubleWords <= 1;
byteLanes <= "00001111";
when "01001" =>
doubleWords <= 1;
byteLanes <= "11111100";
when "11001" =>
doubleWords <= 1;
byteLanes <= "00111111";
when "01010" =>
doubleWords <= 1;
byteLanes <= "11111110";
when "11010" =>
doubleWords <= 1;
byteLanes <= "01111111";
when "01011" =>
doubleWords <= 1;
byteLanes <= "11111111";
when "11011" =>
doubleWords <= 2;
byteLanes <= "11111111";
when "01100" =>
doubleWords <= 4;
byteLanes <= "11111111";
when "11100" =>
doubleWords <= 8;
byteLanes <= "11111111";
when "01101" =>
doubleWords <= 12;
byteLanes <= "11111111";
when "11101" =>
doubleWords <= 16;
byteLanes <= "11111111";
when "01110" =>
doubleWords <= 20;
byteLanes <= "11111111";
when "11110" =>
doubleWords <= 24;
byteLanes <= "11111111";
when "01111" =>
doubleWords <= 28;
byteLanes <= "11111111";
when "11111" =>
doubleWords <= 32;
byteLanes <= "11111111";
end case;
if (wdptr = '0') then
case to_integer(unsigned(size)) is
when 0 =>
doubleWords <= 1;
byteLanes <= "10000000";
when 1 =>
doubleWords <= 1;
byteLanes <= "01000000";
when 2 =>
doubleWords <= 1;
byteLanes <= "00100000";
when 3 =>
doubleWords <= 1;
byteLanes <= "00010000";
when 4 =>
doubleWords <= 1;
byteLanes <= "11000000";
when 5 =>
doubleWords <= 1;
byteLanes <= "11100000";
when 6 =>
doubleWords <= 1;
byteLanes <= "00110000";
when 7 =>
doubleWords <= 1;
byteLanes <= "11111000";
when 8 =>
doubleWords <= 1;
byteLanes <= "11110000";
when 9 =>
doubleWords <= 1;
byteLanes <= "11111100";
when 10 =>
doubleWords <= 1;
byteLanes <= "11111110";
when 11 =>
doubleWords <= 1;
byteLanes <= "11111111";
when 12 =>
doubleWords <= 4;
byteLanes <= "11111111";
when 13 =>
doubleWords <= 12;
byteLanes <= "11111111";
when 14 =>
doubleWords <= 20;
byteLanes <= "11111111";
when others =>
doubleWords <= 28;
byteLanes <= "11111111";
end case;
else
case to_integer(unsigned(size)) is
when 0 =>
doubleWords <= 1;
byteLanes <= "00001000";
when 1 =>
doubleWords <= 1;
byteLanes <= "00000100";
when 2 =>
doubleWords <= 1;
byteLanes <= "00000010";
when 3 =>
doubleWords <= 1;
byteLanes <= "00000001";
when 4 =>
doubleWords <= 1;
byteLanes <= "00001100";
when 5 =>
doubleWords <= 1;
byteLanes <= "00000111";
when 6 =>
doubleWords <= 1;
byteLanes <= "00000011";
when 7 =>
doubleWords <= 1;
byteLanes <= "00011111";
when 8 =>
doubleWords <= 1;
byteLanes <= "00001111";
when 9 =>
doubleWords <= 1;
byteLanes <= "00111111";
when 10 =>
doubleWords <= 1;
byteLanes <= "01111111";
when 11 =>
doubleWords <= 2;
byteLanes <= "11111111";
when 12 =>
doubleWords <= 8;
byteLanes <= "11111111";
when 13 =>
doubleWords <= 16;
byteLanes <= "11111111";
when 14 =>
doubleWords <= 24;
byteLanes <= "11111111";
when others =>
doubleWords <= 32;
byteLanes <= "11111111";
end case;
end if;
end if;
end if;
end process;
1521,7 → 1476,7
-- Payload content memory.
-----------------------------------------------------------------------------
PayloadMemory: MemorySimpleDualPort
generic map(ADDRESS_WIDTH=>3, DATA_WIDTH=>64)
generic map(ADDRESS_WIDTH=>5, DATA_WIDTH=>64)
port map(clkA_i=>clk,
enableA_i=>memoryWrite,
addressA_i=>memoryAddress,
1569,7 → 1524,6
masterCyc_o : out std_logic;
masterStb_o : out std_logic;
masterAdr_o : out std_logic_vector(7 downto 0);
masterDat_o : out std_logic_vector(31 downto 0);
masterAck_i : in std_logic);
end entity;
1601,7 → 1555,7
signal state : StateType;
 
signal packetIndex : natural range 0 to 33;
signal responseHeader : std_logic_vector(15 downto 0);
signal responseHeader : std_logic_vector(31 downto 0);
signal responsePayload : std_logic_vector(63 downto 0);
signal memoryEnable : std_logic;
1614,8 → 1568,6
x"0000" & "000000" & responseVc_i & responseCrf_i &
responsePrio_i & responseTt_i & x"8";
 
slaveAck_o <= slaveAck;
MaintenanceResponse: process(clk, areset_n)
begin
if (areset_n = '0') then
1647,7 → 1599,7
--
---------------------------------------------------------------------
if (masterAck_i = '1') then
if (packetIndex = responseLength_i) then
if (packetIndex = unsigned(responsePayloadLength_i)) then
masterCyc_o <= '0';
masterStb_o <= '0';
state <= RESPONSE_DONE;
1665,21 → 1617,23
-- transaction & status & targetTID & hop & reserved(7:0)
masterDat_o <= "0010" & "0000" & responseTid_i & x"ff" & x"00";
responsePayload <= memoryDataRead;
memoryAddress <= memoryAddress + 1;
memoryAddress <=
std_logic_vector(unsigned(memoryAddress) + 1);
packetIndex <= packetIndex + 1;
when 4 =>
-- reserved(15:0) & double-wordN(63:48)
masterDat_o <= x"0000" & responsePayload(63 downto 48);
packetIndex <= packetIndex + 1;
when 5 | 7 | 9 | 11 | 13 | 15 | 17 | 19 | 21 | 23 | 25 | 27 | 29 | 31 | 33 =>
when 5 | 7 | 9 | 11 | 13 | 15 | 17 | 19 | 21 | 23 | 25 | 27 | 29 | 31 =>
-- double-wordN(47:16)
masterDat_o <= responsePayload(47 downto 16);
packetIndex <= packetIndex + 1;
when 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 | 32 | 34 =>
when 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 | 32 =>
-- double-wordN(15:0) & double-wordN(63:32)
masterDat_o <= responsePayload(15 downto 0) & responsePayload_i(63 downto 48);
responsePayload <= memoryDataRead;
memoryAddress <= memoryAddress + 1;
memoryAddress <=
std_logic_vector(unsigned(memoryAddress) + 1);
packetIndex <= packetIndex + 1;
when others =>
-- Unallowed response length.
1724,7 → 1678,7
--
---------------------------------------------------------------------
memoryEnable <= '0';
if (responseRead_i = '0') and (responseWrite = '0') then
if (responseReadReady_i = '0') and (responseWriteReady_i = '0') then
state <= WAIT_PACKET;
responseDone_o <= '0';
else

powered by: WebSVN 2.1.0

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