Line 86... |
Line 86... |
writeContent_o : out Array1(SWITCH_PORTS-1 downto 0);
|
writeContent_o : out Array1(SWITCH_PORTS-1 downto 0);
|
writeContentData_o : out Array32(SWITCH_PORTS-1 downto 0);
|
writeContentData_o : out Array32(SWITCH_PORTS-1 downto 0);
|
|
|
readFrameEmpty_i : in Array1(SWITCH_PORTS-1 downto 0);
|
readFrameEmpty_i : in Array1(SWITCH_PORTS-1 downto 0);
|
readFrame_o : out Array1(SWITCH_PORTS-1 downto 0);
|
readFrame_o : out Array1(SWITCH_PORTS-1 downto 0);
|
readFrameRestart_o : out Array1(SWITCH_PORTS-1 downto 0);
|
|
readFrameAborted_i : in Array1(SWITCH_PORTS-1 downto 0);
|
|
readContentEmpty_i : in Array1(SWITCH_PORTS-1 downto 0);
|
|
readContent_o : out Array1(SWITCH_PORTS-1 downto 0);
|
readContent_o : out Array1(SWITCH_PORTS-1 downto 0);
|
readContentEnd_i : in Array1(SWITCH_PORTS-1 downto 0);
|
readContentEnd_i : in Array1(SWITCH_PORTS-1 downto 0);
|
readContentData_i : in Array32(SWITCH_PORTS-1 downto 0);
|
readContentData_i : in Array32(SWITCH_PORTS-1 downto 0);
|
|
|
portLinkTimeout_o : out std_logic_vector(23 downto 0);
|
portLinkTimeout_o : out std_logic_vector(23 downto 0);
|
Line 130... |
Line 127... |
frameRead_i : in RioFrame;
|
frameRead_i : in RioFrame;
|
frameReceived_o : out std_logic;
|
frameReceived_o : out std_logic;
|
|
|
readFrameEmpty_o : out std_logic;
|
readFrameEmpty_o : out std_logic;
|
readFrame_i : in std_logic;
|
readFrame_i : in std_logic;
|
readFrameRestart_i : in std_logic;
|
|
readFrameAborted_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(31 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;
|
Line 170... |
Line 164... |
signal writeContent : Array1(PORTS-1 downto 0);
|
signal writeContent : Array1(PORTS-1 downto 0);
|
signal writeContentData : Array32(PORTS-1 downto 0);
|
signal writeContentData : Array32(PORTS-1 downto 0);
|
|
|
signal readFrameEmpty : Array1(PORTS-1 downto 0);
|
signal readFrameEmpty : Array1(PORTS-1 downto 0);
|
signal readFrame : Array1(PORTS-1 downto 0);
|
signal readFrame : Array1(PORTS-1 downto 0);
|
signal readFrameRestart : Array1(PORTS-1 downto 0);
|
|
signal readFrameAborted : Array1(PORTS-1 downto 0);
|
|
signal readContentEmpty : Array1(PORTS-1 downto 0);
|
|
signal readContent : Array1(PORTS-1 downto 0);
|
signal readContent : Array1(PORTS-1 downto 0);
|
signal readContentEnd : Array1(PORTS-1 downto 0);
|
signal readContentEnd : Array1(PORTS-1 downto 0);
|
signal readContentData : Array32(PORTS-1 downto 0);
|
signal readContentData : Array32(PORTS-1 downto 0);
|
|
|
signal portLinkTimeout : std_logic_vector(23 downto 0);
|
signal portLinkTimeout : std_logic_vector(23 downto 0);
|
Line 218... |
Line 209... |
-- Serial port emulator.
|
-- Serial port emulator.
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
TestDriver: process
|
TestDriver: process
|
|
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
--
|
-- Place a new ingress frame on a port.
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
procedure SendFrame(constant portIndex : natural range 0 to 7;
|
procedure SendFrame(constant portIndex : natural range 0 to 7;
|
constant frame : RioFrame) is
|
constant frame : RioFrame) is
|
begin
|
begin
|
frameValid(portIndex) <= '1';
|
frameValid(portIndex) <= '1';
|
frameWrite(portIndex) <= frame;
|
frameWrite(portIndex) <= frame;
|
wait until frameComplete(portIndex) = '1';
|
wait until frameComplete(portIndex) = '1';
|
frameValid(portIndex) <= '0';
|
frameValid(portIndex) <= '0';
|
end procedure;
|
end procedure;
|
|
|
|
procedure SendFrame(constant portIndex : natural range 0 to 7;
|
|
constant sourceId : std_logic_vector(15 downto 0);
|
|
constant destinationId : std_logic_vector(15 downto 0);
|
|
constant payload : RioPayload) is
|
|
variable frame : RioFrame;
|
|
begin
|
|
frame := RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
|
|
tt=>"01", ftype=>"0000",
|
|
sourceId=>sourceId, destId=>destinationId,
|
|
payload=>payload);
|
|
|
|
frameValid(portIndex) <= '1';
|
|
frameWrite(portIndex) <= frame;
|
|
end procedure;
|
|
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
--
|
-- Expect a new egress frame on a port.
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
procedure ReceiveFrame(constant portIndex : natural range 0 to 7;
|
procedure ReceiveFrame(constant portIndex : natural range 0 to 7;
|
constant frame : RioFrame) is
|
constant frame : RioFrame) is
|
begin
|
begin
|
frameExpected(portIndex) <= '1';
|
frameExpected(portIndex) <= '1';
|
frameRead(portIndex) <= frame;
|
frameRead(portIndex) <= frame;
|
wait until frameReceived(portIndex) = '1';
|
wait until frameReceived(portIndex) = '1';
|
frameExpected(portIndex) <= '0';
|
frameExpected(portIndex) <= '0';
|
end procedure;
|
end procedure;
|
|
|
|
procedure ReceiveFrame(constant portIndex : natural range 0 to 7;
|
|
constant sourceId : std_logic_vector(15 downto 0);
|
|
constant destinationId : std_logic_vector(15 downto 0);
|
|
constant payload : RioPayload) is
|
|
variable frame : RioFrame;
|
|
begin
|
|
frame := RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
|
|
tt=>"01", ftype=>"0000",
|
|
sourceId=>sourceId, destId=>destinationId,
|
|
payload=>payload);
|
|
|
|
frameExpected(portIndex) <= '1';
|
|
frameRead(portIndex) <= frame;
|
|
end procedure;
|
|
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
--
|
-- Read a configuration-space register.
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
procedure ReadConfig32(constant portIndex : natural range 0 to 7;
|
procedure ReadConfig32(constant portIndex : natural range 0 to 7;
|
constant destinationId : std_logic_vector(15 downto 0);
|
constant destinationId : std_logic_vector(15 downto 0);
|
constant sourceId : std_logic_vector(15 downto 0);
|
constant sourceId : std_logic_vector(15 downto 0);
|
constant hop : std_logic_vector(7 downto 0);
|
constant hop : std_logic_vector(7 downto 0);
|
Line 284... |
Line 305... |
dataLength=>1,
|
dataLength=>1,
|
data=>maintData)));
|
data=>maintData)));
|
end procedure;
|
end procedure;
|
|
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
--
|
-- Write a configuration-space register.
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
procedure WriteConfig32(constant portIndex : natural range 0 to 7;
|
procedure WriteConfig32(constant portIndex : natural range 0 to 7;
|
constant destinationId : std_logic_vector(15 downto 0);
|
constant destinationId : std_logic_vector(15 downto 0);
|
constant sourceId : std_logic_vector(15 downto 0);
|
constant sourceId : std_logic_vector(15 downto 0);
|
constant hop : std_logic_vector(7 downto 0);
|
constant hop : std_logic_vector(7 downto 0);
|
Line 327... |
Line 348... |
dataLength=>0,
|
dataLength=>0,
|
data=>maintData)));
|
data=>maintData)));
|
end procedure;
|
end procedure;
|
|
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
--
|
-- Set a route table entry.
|
|
---------------------------------------------------------------------------
|
|
procedure RouteSet(constant deviceId : std_logic_vector(15 downto 0);
|
|
constant portIndex : std_logic_vector(7 downto 0)) is
|
|
variable frame : RioFrame;
|
|
begin
|
|
WriteConfig32(portIndex=>0, destinationId=>x"ffff", sourceId=>x"ffff", hop=>x"00",
|
|
tid=>x"de", address=>x"000070", data=>(x"0000" & deviceId));
|
|
WriteConfig32(portIndex=>0, destinationId=>x"ffff", sourceId=>x"ffff", hop=>x"00",
|
|
tid=>x"ad", address=>x"000074", data=>(x"000000" & portIndex));
|
|
end procedure;
|
|
|
|
---------------------------------------------------------------------------
|
|
-- Set the default route table entry.
|
|
---------------------------------------------------------------------------
|
|
procedure RouteSetDefault(constant portIndex : std_logic_vector(7 downto 0)) is
|
|
variable frame : RioFrame;
|
|
begin
|
|
WriteConfig32(portIndex=>0, destinationId=>x"ffff", sourceId=>x"ffff", hop=>x"00",
|
|
tid=>x"ad", address=>x"000078", data=>(x"000000" & portIndex));
|
|
end procedure;
|
|
|
|
---------------------------------------------------------------------------
|
|
-- Send a frame on an ingress port and expect it at an egress port.
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
procedure RouteFrame(constant sourcePortIndex : natural range 0 to 7;
|
procedure RouteFrame(constant sourcePortIndex : natural range 0 to 7;
|
constant destinationPortIndex : natural range 0 to 7;
|
constant destinationPortIndex : natural range 0 to 7;
|
constant sourceId : std_logic_vector(15 downto 0);
|
constant sourceId : std_logic_vector(15 downto 0);
|
constant destinationId : std_logic_vector(15 downto 0);
|
constant destinationId : std_logic_vector(15 downto 0);
|
Line 355... |
Line 399... |
frameExpected(destinationPortIndex) <= '0';
|
frameExpected(destinationPortIndex) <= '0';
|
|
|
end procedure;
|
end procedure;
|
|
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
--
|
-- Variable definitions.
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
procedure SendFrame(constant portIndex : natural range 0 to 7;
|
|
constant sourceId : std_logic_vector(15 downto 0);
|
|
constant destinationId : std_logic_vector(15 downto 0);
|
|
constant payload : RioPayload) is
|
|
variable frame : RioFrame;
|
|
begin
|
|
frame := RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
|
|
tt=>"01", ftype=>"0000",
|
|
sourceId=>sourceId, destId=>destinationId,
|
|
payload=>payload);
|
|
|
|
frameValid(portIndex) <= '1';
|
|
frameWrite(portIndex) <= frame;
|
|
end procedure;
|
|
|
|
---------------------------------------------------------------------------
|
|
--
|
|
---------------------------------------------------------------------------
|
|
procedure ReceiveFrame(constant portIndex : natural range 0 to 7;
|
|
constant sourceId : std_logic_vector(15 downto 0);
|
|
constant destinationId : std_logic_vector(15 downto 0);
|
|
constant payload : RioPayload) is
|
|
variable frame : RioFrame;
|
|
begin
|
|
frame := RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
|
|
tt=>"01", ftype=>"0000",
|
|
sourceId=>sourceId, destId=>destinationId,
|
|
payload=>payload);
|
|
|
|
frameExpected(portIndex) <= '1';
|
|
frameRead(portIndex) <= frame;
|
|
end procedure;
|
|
|
|
-- These variabels are needed for the random number generation.
|
-- These variabels are needed for the random number generation.
|
variable seed1 : positive := 1;
|
variable seed1 : positive := 1;
|
variable seed2: positive := 1;
|
variable seed2: positive := 1;
|
|
|
Line 867... |
Line 879... |
PrintS("TG_RioSwitch-TC3");
|
PrintS("TG_RioSwitch-TC3");
|
PrintS("Description: Test the routing of normal packets.");
|
PrintS("Description: Test the routing of normal packets.");
|
PrintS("Requirement: XXXXX");
|
PrintS("Requirement: XXXXX");
|
PrintS("-----------------------------------------------------------------");
|
PrintS("-----------------------------------------------------------------");
|
PrintS("Step 1:");
|
PrintS("Step 1:");
|
PrintS("Action: Send two packets but not the same time.");
|
PrintS("Action: Send two packets but not at the same time.");
|
PrintS("Result: Both packets should be received at the expected ports.");
|
PrintS("Result: Both packets should be received at the expected ports.");
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
PrintR("TG_RioSwitch-TC3-Step1");
|
PrintR("TG_RioSwitch-TC3-Step1");
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
|
|
|
-- Setup the routing table for the following steps.
|
|
RouteSet(x"0000", x"00");
|
|
RouteSet(x"0001", x"00");
|
|
RouteSet(x"0002", x"00");
|
|
RouteSet(x"0003", x"00");
|
|
RouteSet(x"0004", x"01");
|
|
RouteSet(x"0005", x"02");
|
|
RouteSet(x"0006", x"03");
|
|
RouteSetDefault(x"06");
|
|
|
-- Frame on port 0 to port 1.
|
-- Frame on port 0 to port 1.
|
randomPayload.length := 3;
|
randomPayload.length := 3;
|
CreateRandomPayload(randomPayload.data, seed1, seed2);
|
CreateRandomPayload(randomPayload.data, seed1, seed2);
|
SendFrame(portIndex=>0,
|
SendFrame(portIndex=>0,
|
sourceId=>x"ffff", destinationId=>x"0000", payload=>randomPayload);
|
sourceId=>x"ffff", destinationId=>x"0004", payload=>randomPayload);
|
ReceiveFrame(portIndex=>1,
|
ReceiveFrame(portIndex=>1,
|
sourceId=>x"ffff", destinationId=>x"0000", payload=>randomPayload);
|
sourceId=>x"ffff", destinationId=>x"0004", payload=>randomPayload);
|
|
|
-- Frame on port 1 to port 6.
|
-- Frame on port 1 to port 6.
|
randomPayload.length := 4;
|
randomPayload.length := 4;
|
CreateRandomPayload(randomPayload.data, seed1, seed2);
|
CreateRandomPayload(randomPayload.data, seed1, seed2);
|
SendFrame(portIndex=>1,
|
SendFrame(portIndex=>1,
|
Line 902... |
Line 924... |
frameExpected(1) <= '0';
|
frameExpected(1) <= '0';
|
|
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
PrintS("-----------------------------------------------------------------");
|
PrintS("-----------------------------------------------------------------");
|
PrintS("Step 2:");
|
PrintS("Step 2:");
|
PrintS("Action: Send two packets to the same port with is full and one to");
|
PrintS("Action: Send two packets to the same port that is full and one to");
|
PrintS(" another that is also full. Then receive the packets one at");
|
PrintS(" another that is also full. Then receive the packets one at");
|
PrintS(" a time.");
|
PrintS(" a time.");
|
PrintS("Result: The packet to the port that is ready should go though.");
|
PrintS("Result: The packet to the port that is ready should go though.");
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
PrintR("TG_RioSwitch-TC3-Step2");
|
PrintR("TG_RioSwitch-TC3-Step2");
|
Line 914... |
Line 936... |
|
|
-- Frame on port 0 to port 1.
|
-- Frame on port 0 to port 1.
|
randomPayload.length := 5;
|
randomPayload.length := 5;
|
CreateRandomPayload(randomPayload.data, seed1, seed2);
|
CreateRandomPayload(randomPayload.data, seed1, seed2);
|
SendFrame(portIndex=>0,
|
SendFrame(portIndex=>0,
|
sourceId=>x"ffff", destinationId=>x"0000", payload=>randomPayload);
|
sourceId=>x"ffff", destinationId=>x"0004", payload=>randomPayload);
|
|
|
-- Frame on port 1 to port 6.
|
-- Frame on port 1 to port 2.
|
randomPayload1.length := 6;
|
randomPayload1.length := 6;
|
CreateRandomPayload(randomPayload1.data, seed1, seed2);
|
CreateRandomPayload(randomPayload1.data, seed1, seed2);
|
SendFrame(portIndex=>1,
|
SendFrame(portIndex=>1,
|
sourceId=>x"0000", destinationId=>x"ffff", payload=>randomPayload1);
|
sourceId=>x"0000", destinationId=>x"0005", payload=>randomPayload1);
|
|
|
-- Frame on port 2 to port 6.
|
-- Frame on port 2 to port 2.
|
randomPayload2.length := 7;
|
randomPayload2.length := 7;
|
CreateRandomPayload(randomPayload2.data, seed1, seed2);
|
CreateRandomPayload(randomPayload2.data, seed1, seed2);
|
SendFrame(portIndex=>2,
|
SendFrame(portIndex=>2,
|
sourceId=>x"0000", destinationId=>x"ffff", payload=>randomPayload2);
|
sourceId=>x"0000", destinationId=>x"0005", payload=>randomPayload2);
|
|
|
wait for 10 us;
|
wait for 10 us;
|
|
|
ReceiveFrame(portIndex=>1,
|
ReceiveFrame(portIndex=>1,
|
sourceId=>x"ffff", destinationId=>x"0000", payload=>randomPayload);
|
sourceId=>x"ffff", destinationId=>x"0004", payload=>randomPayload);
|
wait until frameComplete(0) = '1';
|
wait until frameComplete(0) = '1';
|
frameValid(0) <= '0';
|
frameValid(0) <= '0';
|
wait until frameReceived(1) = '1';
|
wait until frameReceived(1) = '1';
|
frameExpected(1) <= '0';
|
frameExpected(1) <= '0';
|
|
|
wait for 10 us;
|
wait for 10 us;
|
|
|
ReceiveFrame(portIndex=>6,
|
ReceiveFrame(portIndex=>2,
|
sourceId=>x"0000", destinationId=>x"ffff", payload=>randomPayload1);
|
sourceId=>x"0000", destinationId=>x"0005", payload=>randomPayload1);
|
wait until frameComplete(1) = '1';
|
wait until frameComplete(1) = '1';
|
frameValid(1) <= '0';
|
frameValid(1) <= '0';
|
wait until frameReceived(6) = '1';
|
wait until frameReceived(2) = '1';
|
frameExpected(6) <= '0';
|
frameExpected(2) <= '0';
|
|
|
wait for 10 us;
|
wait for 10 us;
|
|
|
ReceiveFrame(portIndex=>6,
|
ReceiveFrame(portIndex=>2,
|
sourceId=>x"0000", destinationId=>x"ffff", payload=>randomPayload2);
|
sourceId=>x"0000", destinationId=>x"0005", payload=>randomPayload2);
|
wait until frameComplete(2) = '1';
|
wait until frameComplete(2) = '1';
|
frameValid(2) <= '0';
|
frameValid(2) <= '0';
|
wait until frameReceived(6) = '1';
|
wait until frameReceived(2) = '1';
|
frameExpected(6) <= '0';
|
frameExpected(2) <= '0';
|
|
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
-- Test completed.
|
-- Test completed.
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
|
|
wait for 10 us;
|
wait for 10 us;
|
|
|
assert readContentEmpty = "1111111"
|
assert readFrameEmpty = "1111111"
|
report "Pending frames exist." severity error;
|
report "Pending frames exist." severity error;
|
|
|
TestEnd;
|
TestEnd;
|
end process;
|
end process;
|
|
|
Line 1002... |
Line 1024... |
frameExpected_i=>frameExpected(portIndex),
|
frameExpected_i=>frameExpected(portIndex),
|
frameRead_i=>frameRead(portIndex),
|
frameRead_i=>frameRead(portIndex),
|
frameReceived_o=>frameReceived(portIndex),
|
frameReceived_o=>frameReceived(portIndex),
|
readFrameEmpty_o=>readFrameEmpty(portIndex),
|
readFrameEmpty_o=>readFrameEmpty(portIndex),
|
readFrame_i=>readFrame(portIndex),
|
readFrame_i=>readFrame(portIndex),
|
readFrameRestart_i=>readFrameRestart(portIndex),
|
|
readFrameAborted_o=>readFrameAborted(portIndex),
|
|
readContentEmpty_o=>readContentEmpty(portIndex),
|
|
readContent_i=>readContent(portIndex),
|
readContent_i=>readContent(portIndex),
|
readContentEnd_o=>readContentEnd(portIndex),
|
readContentEnd_o=>readContentEnd(portIndex),
|
readContentData_o=>readContentData(portIndex),
|
readContentData_o=>readContentData(portIndex),
|
writeFrameFull_o=>writeFrameFull(portIndex),
|
writeFrameFull_o=>writeFrameFull(portIndex),
|
writeFrame_i=>writeFrame(portIndex),
|
writeFrame_i=>writeFrame(portIndex),
|
Line 1031... |
Line 1050... |
ASSY_VENDOR_IDENTITY=>SWITCH_ASSY_VENDOR_IDENTITY,
|
ASSY_VENDOR_IDENTITY=>SWITCH_ASSY_VENDOR_IDENTITY,
|
ASSY_REV=>SWITCH_ASSY_REV)
|
ASSY_REV=>SWITCH_ASSY_REV)
|
port map(
|
port map(
|
clk=>clk, areset_n=>areset_n,
|
clk=>clk, areset_n=>areset_n,
|
writeFrameFull_i=>writeFrameFull,
|
writeFrameFull_i=>writeFrameFull,
|
writeFrame_o=>writeFrame, writeFrameAbort_o=>writeFrameAbort,
|
writeFrame_o=>writeFrame,
|
writeContent_o=>writeContent, writeContentData_o=>writeContentData,
|
writeFrameAbort_o=>writeFrameAbort,
|
|
writeContent_o=>writeContent,
|
|
writeContentData_o=>writeContentData,
|
readFrameEmpty_i=>readFrameEmpty,
|
readFrameEmpty_i=>readFrameEmpty,
|
readFrame_o=>readFrame, readFrameRestart_o=>readFrameRestart,
|
readFrame_o=>readFrame,
|
readFrameAborted_i=>readFrameAborted,
|
readContent_o=>readContent,
|
readContentEmpty_i=>readContentEmpty,
|
readContentEnd_i=>readContentEnd,
|
readContent_o=>readContent, readContentEnd_i=>readContentEnd,
|
|
readContentData_i=>readContentData,
|
readContentData_i=>readContentData,
|
portLinkTimeout_o=>portLinkTimeout,
|
portLinkTimeout_o=>portLinkTimeout,
|
linkInitialized_i=>linkInitialized,
|
linkInitialized_i=>linkInitialized,
|
outputPortEnable_o=>outputPortEnable, inputPortEnable_o=>inputPortEnable,
|
outputPortEnable_o=>outputPortEnable,
|
|
inputPortEnable_o=>inputPortEnable,
|
localAckIdWrite_o=>localAckIdWrite,
|
localAckIdWrite_o=>localAckIdWrite,
|
clrOutstandingAckId_o=>clrOutstandingAckId,
|
clrOutstandingAckId_o=>clrOutstandingAckId,
|
inboundAckId_o=>inboundAckIdWrite,
|
inboundAckId_o=>inboundAckIdWrite,
|
outstandingAckId_o=>outstandingAckIdWrite,
|
outstandingAckId_o=>outstandingAckIdWrite,
|
outboundAckId_o=>outboundAckIdWrite,
|
outboundAckId_o=>outboundAckIdWrite,
|
Line 1059... |
Line 1080... |
end architecture;
|
end architecture;
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
--
|
-- Switch port test stub.
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
-- REMARK: Add support for testing partially complete frames, cut-through-routing...
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use ieee.numeric_std.all;
|
use ieee.numeric_std.all;
|
library std;
|
library std;
|
use std.textio.all;
|
use std.textio.all;
|
use work.rio_common.all;
|
use work.rio_common.all;
|
|
|
|
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
--
|
-- Entity for TestPort.
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
entity TestPort is
|
entity TestPort is
|
port(
|
port(
|
clk : in std_logic;
|
clk : in std_logic;
|
areset_n : in std_logic;
|
areset_n : in std_logic;
|
Line 1088... |
Line 1108... |
frameRead_i : in RioFrame;
|
frameRead_i : in RioFrame;
|
frameReceived_o : out std_logic;
|
frameReceived_o : out std_logic;
|
|
|
readFrameEmpty_o : out std_logic;
|
readFrameEmpty_o : out std_logic;
|
readFrame_i : in std_logic;
|
readFrame_i : in std_logic;
|
readFrameRestart_i : in std_logic;
|
|
readFrameAborted_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(31 downto 0);
|
readContentData_o : out std_logic_vector(31 downto 0);
|
|
|
writeFrameFull_o : out std_logic;
|
writeFrameFull_o : out std_logic;
|
Line 1104... |
Line 1121... |
writeContentData_i : in std_logic_vector(31 downto 0));
|
writeContentData_i : in std_logic_vector(31 downto 0));
|
end entity;
|
end entity;
|
|
|
|
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
--
|
-- Architecture for TestPort.
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
architecture TestPortImpl of TestPort is
|
architecture TestPortImpl of TestPort is
|
begin
|
begin
|
|
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
--
|
-- Egress frame receiver.
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
FrameReader: process
|
FrameReader: process
|
type StateType is (STATE_IDLE, STATE_WRITE);
|
type StateType is (STATE_IDLE, STATE_WRITE);
|
variable state : StateType;
|
variable state : StateType;
|
variable frameIndex : natural range 0 to 69;
|
variable frameIndex : natural range 0 to 69;
|
Line 1187... |
Line 1204... |
end case;
|
end case;
|
end loop;
|
end loop;
|
end process;
|
end process;
|
|
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
--
|
-- Ingress frame sender.
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
-- REMARK: add support for these signals...
|
|
-- readFrameEmpty_i : in std_logic;
|
|
-- readFrameAborted_i : in std_logic;
|
|
FrameSender: process
|
FrameSender: process
|
type StateType is (STATE_IDLE, STATE_READ);
|
type StateType is (STATE_IDLE, STATE_READ);
|
variable state : StateType;
|
variable state : StateType;
|
variable frameIndex : natural range 0 to 69;
|
variable frameIndex : natural range 0 to 69;
|
begin
|
begin
|
readFrameEmpty_o <= '1';
|
readFrameEmpty_o <= '1';
|
readFrameAborted_o <= '0';
|
|
readContentEmpty_o <= '1';
|
|
readContentEnd_o <= '1';
|
readContentEnd_o <= '1';
|
readContentData_o <= (others => 'U');
|
readContentData_o <= (others => 'U');
|
frameComplete_o <= '0';
|
frameComplete_o <= '0';
|
wait until areset_n = '1';
|
wait until areset_n = '1';
|
|
|
Line 1217... |
Line 1229... |
when STATE_IDLE =>
|
when STATE_IDLE =>
|
frameComplete_o <= '0';
|
frameComplete_o <= '0';
|
if (frameValid_i = '1') then
|
if (frameValid_i = '1') then
|
state := STATE_READ;
|
state := STATE_READ;
|
frameIndex := 0;
|
frameIndex := 0;
|
readContentEmpty_o <= '0';
|
|
readFrameEmpty_o <= '0';
|
readFrameEmpty_o <= '0';
|
else
|
|
readContentEmpty_o <= '1';
|
|
end if;
|
end if;
|
|
|
when STATE_READ =>
|
when STATE_READ =>
|
if (readFrameRestart_i = '1') then
|
|
readContentEnd_o <= '0';
|
|
frameIndex := 0;
|
|
else
|
|
-- Not restarting a frame.
|
|
end if;
|
|
|
|
if (readContent_i = '1') then
|
if (readContent_i = '1') then
|
if (frameIndex < frameWrite_i.length) then
|
if (frameIndex < frameWrite_i.length) then
|
readContentData_o <= frameWrite_i.payload(frameIndex);
|
readContentData_o <= frameWrite_i.payload(frameIndex);
|
readContentEnd_o <= '0';
|
readContentEnd_o <= '0';
|
frameIndex := frameIndex + 1;
|
frameIndex := frameIndex + 1;
|
Line 1250... |
Line 1252... |
if (readFrame_i = '1') then
|
if (readFrame_i = '1') then
|
state := STATE_IDLE;
|
state := STATE_IDLE;
|
assert frameIndex = frameWrite_i.length report "Unread frame data discarded." severity error;
|
assert frameIndex = frameWrite_i.length report "Unread frame data discarded." severity error;
|
frameComplete_o <= '1';
|
frameComplete_o <= '1';
|
readFrameEmpty_o <= '1';
|
readFrameEmpty_o <= '1';
|
readContentEmpty_o <= '1';
|
|
readContentData_o <= (others => 'U');
|
readContentData_o <= (others => 'U');
|
else
|
else
|
-- Not reading a frame.
|
-- Not reading a frame.
|
end if;
|
end if;
|
|
|