Line 91... |
Line 91... |
readWindowNext_i : in std_logic;
|
readWindowNext_i : in std_logic;
|
|
|
readContentEmpty_o : out std_logic;
|
readContentEmpty_o : out std_logic;
|
readContent_i : in std_logic;
|
readContent_i : in std_logic;
|
readContentEnd_o : out std_logic;
|
readContentEnd_o : out std_logic;
|
readContentData_o : out std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
|
readContentData_o : out std_logic_vector(31 downto 0);
|
|
|
writeFrameFull_o : out std_logic;
|
writeFrameFull_o : out std_logic;
|
writeFrame_i : in std_logic;
|
writeFrame_i : in std_logic;
|
writeFrameAbort_i : in std_logic;
|
writeFrameAbort_i : in std_logic;
|
writeContent_i : in std_logic;
|
writeContent_i : in std_logic;
|
writeContentData_i : in std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0));
|
writeContentData_i : in std_logic_vector(31 downto 0));
|
end component;
|
end component;
|
|
|
component RioSerial is
|
component RioSerial is
|
generic(
|
generic(
|
TIMEOUT_WIDTH : natural;
|
TIMEOUT_WIDTH : natural);
|
NUMBER_WORDS : natural range 1 to 8 := 1);
|
|
port(
|
port(
|
clk : in std_logic;
|
clk : in std_logic;
|
areset_n : in std_logic;
|
areset_n : in std_logic;
|
|
|
portLinkTimeout_i : in std_logic_vector(TIMEOUT_WIDTH-1 downto 0);
|
portLinkTimeout_i : in std_logic_vector(TIMEOUT_WIDTH-1 downto 0);
|
Line 132... |
Line 131... |
readWindowReset_o : out std_logic;
|
readWindowReset_o : out std_logic;
|
readWindowNext_o : out std_logic;
|
readWindowNext_o : out std_logic;
|
readContentEmpty_i : in std_logic;
|
readContentEmpty_i : in std_logic;
|
readContent_o : out std_logic;
|
readContent_o : out std_logic;
|
readContentEnd_i : in std_logic;
|
readContentEnd_i : in std_logic;
|
readContentData_i : in std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
|
readContentData_i : in std_logic_vector(31 downto 0);
|
|
|
writeFrameFull_i : in std_logic;
|
writeFrameFull_i : in std_logic;
|
writeFrame_o : out std_logic;
|
writeFrame_o : out std_logic;
|
writeFrameAbort_o : out std_logic;
|
writeFrameAbort_o : out std_logic;
|
writeContent_o : out std_logic;
|
writeContent_o : out std_logic;
|
writeContentData_o : out std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
|
writeContentData_o : out std_logic_vector(31 downto 0);
|
|
|
portInitialized_i : in std_logic;
|
portInitialized_i : in std_logic;
|
outboundSymbolFull_i : in std_logic;
|
outboundSymbolFull_i : in std_logic;
|
outboundSymbolWrite_o : out std_logic;
|
outboundSymbolWrite_o : out std_logic;
|
outboundSymbol_o : out std_logic_vector(((2+32)*NUMBER_WORDS-1) downto 0);
|
outboundSymbol_o : out std_logic_vector(((2+32)-1) downto 0);
|
inboundSymbolEmpty_i : in std_logic;
|
inboundSymbolEmpty_i : in std_logic;
|
inboundSymbolRead_o : out std_logic;
|
inboundSymbolRead_o : out std_logic;
|
inboundSymbol_i : in std_logic_vector(((2+32)*NUMBER_WORDS-1) downto 0));
|
inboundSymbol_i : in std_logic_vector(((2+32)-1) downto 0));
|
end component;
|
end component;
|
|
|
constant NUMBER_WORDS : natural range 1 to 8 := 1;
|
constant NUMBER_WORDS : natural range 1 to 4 := 1;
|
|
|
signal clk : std_logic;
|
signal clk : std_logic;
|
signal areset_n : std_logic;
|
signal areset_n : std_logic;
|
|
|
signal portLinkTimeout : std_logic_vector(10 downto 0);
|
signal portLinkTimeout : std_logic_vector(10 downto 0);
|
Line 171... |
Line 170... |
signal outboundAckIdRead : std_logic_vector(4 downto 0);
|
signal outboundAckIdRead : std_logic_vector(4 downto 0);
|
|
|
signal portInitialized : std_logic;
|
signal portInitialized : std_logic;
|
signal outboundSymbolFull : std_logic;
|
signal outboundSymbolFull : std_logic;
|
signal outboundSymbolWrite : std_logic;
|
signal outboundSymbolWrite : std_logic;
|
signal outboundSymbol : std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
|
signal outboundSymbol : std_logic_vector((2+32)-1 downto 0);
|
signal inboundSymbolEmpty : std_logic;
|
signal inboundSymbolEmpty : std_logic;
|
signal inboundSymbolRead : std_logic;
|
signal inboundSymbolRead : std_logic;
|
signal inboundSymbol : std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
|
signal inboundSymbol : std_logic_vector((2+32)-1 downto 0);
|
|
|
signal readFrameEmpty : std_logic;
|
signal readFrameEmpty : std_logic;
|
signal readFrame : std_logic;
|
signal readFrame : std_logic;
|
signal readFrameRestart : std_logic;
|
signal readFrameRestart : std_logic;
|
signal readFrameAborted : std_logic;
|
signal readFrameAborted : std_logic;
|
Line 186... |
Line 185... |
signal readWindowReset : std_logic;
|
signal readWindowReset : std_logic;
|
signal readWindowNext : std_logic;
|
signal readWindowNext : std_logic;
|
signal readContentEmpty : std_logic;
|
signal readContentEmpty : std_logic;
|
signal readContent : std_logic;
|
signal readContent : std_logic;
|
signal readContentEnd : std_logic;
|
signal readContentEnd : std_logic;
|
signal readContentData : std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
|
signal readContentData : std_logic_vector(31 downto 0);
|
|
|
signal writeFrameFull : std_logic;
|
signal writeFrameFull : std_logic;
|
signal writeFrame : std_logic;
|
signal writeFrame : std_logic;
|
signal writeFrameAbort : std_logic;
|
signal writeFrameAbort : std_logic;
|
signal writeContent : std_logic;
|
signal writeContent : std_logic;
|
signal writeContentData : std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
|
signal writeContentData : std_logic_vector(31 downto 0);
|
|
|
signal frameValid : std_logic_vector(0 to 63);
|
signal frameValid : std_logic_vector(0 to 63);
|
signal frameWrite : RioFrameArray(0 to 63);
|
signal frameWrite : RioFrameArray(0 to 63);
|
signal frameComplete : std_logic_vector(0 to 63);
|
signal frameComplete : std_logic_vector(0 to 63);
|
signal frameExpected : std_logic;
|
signal frameExpected : std_logic;
|
Line 225... |
Line 224... |
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
-- Procedure to receive a symbol.
|
-- Procedure to receive a symbol.
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
procedure ReceiveSymbol(
|
procedure ReceiveSymbol(
|
constant symbolType : in std_logic_vector(1 downto 0);
|
constant symbolType : in std_logic_vector(1 downto 0);
|
constant symbolContent : in std_logic_vector(31 downto 0) := x"00000000") is
|
constant symbolContent : in std_logic_vector(31 downto 0) := x"00000000";
|
|
constant acceptIdle : in boolean := true) is
|
begin
|
begin
|
outboundSymbolFull <= '0';
|
outboundSymbolFull <= '0';
|
wait until clk'event and clk = '1' and outboundSymbolWrite = '1';
|
wait until clk'event and clk = '1' and outboundSymbolWrite = '1';
|
|
|
|
if (acceptIdle) then
|
while ((outboundSymbol(33 downto 32) = SYMBOL_IDLE) and
|
while ((outboundSymbol(33 downto 32) = SYMBOL_IDLE) and
|
(symbolType /= SYMBOL_IDLE)) loop
|
(symbolType /= SYMBOL_IDLE)) loop
|
wait until clk'event and clk = '1' and outboundSymbolWrite = '1';
|
wait until clk'event and clk = '1' and outboundSymbolWrite = '1';
|
end loop;
|
end loop;
|
|
end if;
|
|
|
assert symbolType = outboundSymbol(33 downto 32)
|
assert symbolType = outboundSymbol(33 downto 32)
|
report "Missmatching symbol type:expected=" &
|
report "Missmatching symbol type:expected=" &
|
integer'image(to_integer(unsigned(symbolType))) &
|
integer'image(to_integer(unsigned(symbolType))) &
|
" got=" &
|
" got=" &
|
Line 354... |
Line 356... |
-- Initialize the port to trigger a change of state.
|
-- Initialize the port to trigger a change of state.
|
portInitialized <= '1';
|
portInitialized <= '1';
|
|
|
-- The transmitter should send idle sequences at startup and a status once
|
-- The transmitter should send idle sequences at startup and a status once
|
-- in a while.
|
-- in a while.
|
|
for i in 0 to 256 loop
|
|
ReceiveSymbol(SYMBOL_IDLE);
|
|
end loop;
|
|
ReceiveSymbol(SYMBOL_CONTROL,
|
|
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
|
|
STYPE1_NOP, "000"),
|
|
false);
|
for i in 0 to 254 loop
|
for i in 0 to 254 loop
|
ReceiveSymbol(SYMBOL_IDLE);
|
ReceiveSymbol(SYMBOL_IDLE);
|
end loop;
|
end loop;
|
ReceiveSymbol(SYMBOL_CONTROL,
|
ReceiveSymbol(SYMBOL_CONTROL,
|
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
|
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
|
STYPE1_NOP, "000"));
|
STYPE1_NOP, "000"),
|
|
false);
|
for i in 0 to 254 loop
|
for i in 0 to 254 loop
|
ReceiveSymbol(SYMBOL_IDLE);
|
ReceiveSymbol(SYMBOL_IDLE);
|
end loop;
|
end loop;
|
ReceiveSymbol(SYMBOL_CONTROL,
|
ReceiveSymbol(SYMBOL_CONTROL,
|
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
|
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
|
STYPE1_NOP, "000"));
|
STYPE1_NOP, "000"),
|
|
false);
|
|
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
PrintS("-----------------------------------------------------------------");
|
PrintS("-----------------------------------------------------------------");
|
PrintS("Step 2:");
|
PrintS("Step 2:");
|
PrintS("Action: Toggle port initialized pin and check that no status ");
|
PrintS("Action: Toggle port initialized pin and check that no status ");
|
Line 390... |
Line 401... |
-- Initialize the port to trigger a change of state.
|
-- Initialize the port to trigger a change of state.
|
portInitialized <= '1';
|
portInitialized <= '1';
|
|
|
-- The transmitter should send idle sequences at startup and a status once
|
-- The transmitter should send idle sequences at startup and a status once
|
-- in a while.
|
-- in a while.
|
|
for i in 0 to 256 loop
|
|
ReceiveSymbol(SYMBOL_IDLE);
|
|
end loop;
|
|
ReceiveSymbol(SYMBOL_CONTROL,
|
|
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
|
|
STYPE1_NOP, "000"),
|
|
false);
|
for i in 0 to 254 loop
|
for i in 0 to 254 loop
|
ReceiveSymbol(SYMBOL_IDLE);
|
ReceiveSymbol(SYMBOL_IDLE);
|
end loop;
|
end loop;
|
ReceiveSymbol(SYMBOL_CONTROL,
|
ReceiveSymbol(SYMBOL_CONTROL,
|
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
|
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
|
STYPE1_NOP, "000"));
|
STYPE1_NOP, "000"),
|
|
false);
|
for i in 0 to 254 loop
|
for i in 0 to 254 loop
|
ReceiveSymbol(SYMBOL_IDLE);
|
ReceiveSymbol(SYMBOL_IDLE);
|
end loop;
|
end loop;
|
ReceiveSymbol(SYMBOL_CONTROL,
|
ReceiveSymbol(SYMBOL_CONTROL,
|
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
|
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
|
STYPE1_NOP, "000"));
|
STYPE1_NOP, "000"),
|
|
false);
|
|
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
PrintS("-----------------------------------------------------------------");
|
PrintS("-----------------------------------------------------------------");
|
PrintS("Step 3:");
|
PrintS("Step 3:");
|
PrintS("Action: Send one error free status symbol to trigger the ");
|
PrintS("Action: Send one error free status symbol to trigger the ");
|
Line 429... |
Line 449... |
ReceiveSymbol(SYMBOL_IDLE);
|
ReceiveSymbol(SYMBOL_IDLE);
|
end loop;
|
end loop;
|
|
|
ReceiveSymbol(SYMBOL_CONTROL,
|
ReceiveSymbol(SYMBOL_CONTROL,
|
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
|
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
|
STYPE1_NOP, "000"));
|
STYPE1_NOP, "000"),
|
|
false);
|
end loop;
|
end loop;
|
|
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
PrintS("-----------------------------------------------------------------");
|
PrintS("-----------------------------------------------------------------");
|
PrintS("Step 4:");
|
PrintS("Step 4:");
|
Line 464... |
Line 485... |
SendSymbol(SYMBOL_CONTROL,
|
SendSymbol(SYMBOL_CONTROL,
|
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
|
RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
|
STYPE1_NOP, "000"));
|
STYPE1_NOP, "000"));
|
end loop;
|
end loop;
|
|
|
|
-- Tick the transmitter by reading it and check that the link is initialized.
|
ReceiveSymbol(SYMBOL_IDLE);
|
ReceiveSymbol(SYMBOL_IDLE);
|
ReceiveSymbol(SYMBOL_IDLE);
|
ReceiveSymbol(SYMBOL_IDLE);
|
ReceiveSymbol(SYMBOL_IDLE);
|
ReceiveSymbol(SYMBOL_IDLE);
|
wait until linkInitialized = '1';
|
wait until linkInitialized = '1';
|
|
|
Line 1988... |
Line 2010... |
PrintS("Result: The transmitter should enter output-error-stopped.");
|
PrintS("Result: The transmitter should enter output-error-stopped.");
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
PrintR("TG_RioSerial-TC4-Step11");
|
PrintR("TG_RioSerial-TC4-Step11");
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
|
|
-- REMARK: Set the fifo size to two instead of this...
|
|
ReceiveSymbol(SYMBOL_IDLE);
|
|
ReceiveSymbol(SYMBOL_IDLE);
|
|
ReceiveSymbol(SYMBOL_IDLE);
|
|
|
|
|
|
-- Send a packet-accepted with unexpected ackId.
|
-- Send a packet-accepted with unexpected ackId.
|
SendSymbol(SYMBOL_CONTROL,
|
SendSymbol(SYMBOL_CONTROL,
|
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "10000", "11111",
|
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "10000", "11111",
|
STYPE1_NOP, "000"));
|
STYPE1_NOP, "000"));
|
|
|
Line 2146... |
Line 2162... |
|
|
ReceiveSymbol(SYMBOL_CONTROL,
|
ReceiveSymbol(SYMBOL_CONTROL,
|
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
|
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
|
STYPE1_END_OF_PACKET, "000"));
|
STYPE1_END_OF_PACKET, "000"));
|
|
|
|
|
-- Send packet-accepted for both packets.
|
-- Send packet-accepted for both packets.
|
SendSymbol(SYMBOL_CONTROL,
|
SendSymbol(SYMBOL_CONTROL,
|
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01011", "11111",
|
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01011", "11111",
|
STYPE1_NOP, "000"));
|
STYPE1_NOP, "000"));
|
-- REMARK: Remove these...
|
|
ReceiveSymbol(SYMBOL_IDLE);
|
|
ReceiveSymbol(SYMBOL_IDLE);
|
|
|
|
SendSymbol(SYMBOL_CONTROL,
|
SendSymbol(SYMBOL_CONTROL,
|
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01100", "11111",
|
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01100", "11111",
|
STYPE1_NOP, "000"));
|
STYPE1_NOP, "000"));
|
|
|
ReceiveSymbol(SYMBOL_IDLE);
|
|
ReceiveSymbol(SYMBOL_IDLE);
|
|
|
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
PrintS("-----------------------------------------------------------------");
|
PrintS("-----------------------------------------------------------------");
|
PrintS("Step 14:");
|
PrintS("Step 14:");
|
PrintS("Action: Set maximum number of valid packets.");
|
PrintS("Action: Set maximum number of valid packets.");
|
PrintS("Result: Maximum 31 packets should be sent without waiting for ");
|
PrintS("Result: Maximum 31 packets should be sent without waiting for ");
|
Line 2218... |
Line 2226... |
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
|
RioControlSymbolCreate(STYPE0_STATUS, "01100", "11111",
|
STYPE1_END_OF_PACKET, "000"));
|
STYPE1_END_OF_PACKET, "000"));
|
wait until frameComplete(43) = '1' and clk'event and clk = '1';
|
wait until frameComplete(43) = '1' and clk'event and clk = '1';
|
frameValid(43) <= '0';
|
frameValid(43) <= '0';
|
|
|
ReceiveSymbol(SYMBOL_IDLE);
|
-- REMARK: Complete the testcase and acknowledge all transmitted packets...
|
ReceiveSymbol(SYMBOL_IDLE);
|
|
|
|
SendSymbol(SYMBOL_CONTROL,
|
SendSymbol(SYMBOL_CONTROL,
|
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01101", "11111",
|
RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "01101", "11111",
|
STYPE1_NOP, "000"));
|
STYPE1_NOP, "000"));
|
|
|
|
|
Line 2280... |
Line 2286... |
writeFrameFull_o=>writeFrameFull, writeFrame_i=>writeFrame, writeFrameAbort_i=>writeFrameAbort,
|
writeFrameFull_o=>writeFrameFull, writeFrame_i=>writeFrame, writeFrameAbort_i=>writeFrameAbort,
|
writeContent_i=>writeContent, writeContentData_i=>writeContentData);
|
writeContent_i=>writeContent, writeContentData_i=>writeContentData);
|
|
|
TestPhy: RioSerial
|
TestPhy: RioSerial
|
generic map(
|
generic map(
|
TIMEOUT_WIDTH=>11, NUMBER_WORDS=>1)
|
TIMEOUT_WIDTH=>11)
|
port map(
|
port map(
|
clk=>clk, areset_n=>areset_n,
|
clk=>clk, areset_n=>areset_n,
|
portLinkTimeout_i=>portLinkTimeout,
|
portLinkTimeout_i=>portLinkTimeout,
|
linkInitialized_o=>linkInitialized,
|
linkInitialized_o=>linkInitialized,
|
inputPortEnable_i=>inputPortEnable,
|
inputPortEnable_i=>inputPortEnable,
|
Line 2356... |
Line 2362... |
readWindowNext_i : in std_logic;
|
readWindowNext_i : in std_logic;
|
|
|
readContentEmpty_o : out std_logic;
|
readContentEmpty_o : out std_logic;
|
readContent_i : in std_logic;
|
readContent_i : in std_logic;
|
readContentEnd_o : out std_logic;
|
readContentEnd_o : out std_logic;
|
readContentData_o : out std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
|
readContentData_o : out std_logic_vector(31 downto 0);
|
|
|
writeFrameFull_o : out std_logic;
|
writeFrameFull_o : out std_logic;
|
writeFrame_i : in std_logic;
|
writeFrame_i : in std_logic;
|
writeFrameAbort_i : in std_logic;
|
writeFrameAbort_i : in std_logic;
|
writeContent_i : in std_logic;
|
writeContent_i : in std_logic;
|
writeContentData_i : in std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0));
|
writeContentData_i : in std_logic_vector(31 downto 0));
|
end entity;
|
end entity;
|
|
|
|
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
--
|
--
|
Line 2448... |
Line 2454... |
readContentData_o <= (others=>'U');
|
readContentData_o <= (others=>'U');
|
end if;
|
end if;
|
|
|
if (readContent_i = '1') then
|
if (readContent_i = '1') then
|
assert frameValid_i(frontIndex) = '1' report "Unexpected content read." severity error;
|
assert frameValid_i(frontIndex) = '1' report "Unexpected content read." severity error;
|
readContentData_o <= "00" & frameWrite_i(frontIndex).payload(frameIndex);
|
readContentData_o <= frameWrite_i(frontIndex).payload(frameIndex);
|
frameIndex := frameIndex + 1;
|
frameIndex := frameIndex + 1;
|
if (frameIndex /= frameWrite_i(frontIndex).length) then
|
if (frameIndex /= frameWrite_i(frontIndex).length) then
|
readContentEnd_o <= '0';
|
readContentEnd_o <= '0';
|
else
|
else
|
readContentEnd_o <= '1';
|
readContentEnd_o <= '1';
|