Line 60... |
Line 60... |
type TestPortMessageWishbone is record
|
type TestPortMessageWishbone is record
|
writeAccess : boolean;
|
writeAccess : boolean;
|
address : std_logic_vector(ADDRESS_WIDTH-1 downto 0);
|
address : std_logic_vector(ADDRESS_WIDTH-1 downto 0);
|
byteSelect : std_logic_vector(7 downto 0);
|
byteSelect : std_logic_vector(7 downto 0);
|
length : natural range 1 to DATA_SIZE_MAX;
|
length : natural range 1 to DATA_SIZE_MAX;
|
data : DoublewordArray(DATA_SIZE_MAX-1 downto 0);
|
data : DoublewordArray(0 to DATA_SIZE_MAX-1);
|
latency : natural;
|
latency : natural;
|
end record;
|
end record;
|
|
|
type TestPortMessageSymbol is record
|
type TestPortMessageSymbol is record
|
symbolType : std_logic_vector(1 downto 0);
|
symbolType : std_logic_vector(1 downto 0);
|
Line 95... |
Line 95... |
stb_i : in std_logic;
|
stb_i : in std_logic;
|
we_i : in std_logic;
|
we_i : in std_logic;
|
adr_i : in std_logic_vector(30 downto 0);
|
adr_i : in std_logic_vector(30 downto 0);
|
sel_i : in std_logic_vector(7 downto 0);
|
sel_i : in std_logic_vector(7 downto 0);
|
dat_i : in std_logic_vector(63 downto 0);
|
dat_i : in std_logic_vector(63 downto 0);
|
dat_o : in std_logic_vector(63 downto 0);
|
dat_o : out std_logic_vector(63 downto 0);
|
err_o : out std_logic;
|
err_o : out std_logic;
|
ack_o : out std_logic);
|
ack_o : out std_logic);
|
end component;
|
end component;
|
|
|
component TestPortPacketBuffer is
|
component TestPortPacketBuffer is
|
port(
|
port(
|
clk : in std_logic;
|
clk : in std_logic;
|
areset_n : in std_logic;
|
areset_n : in std_logic;
|
|
|
outboundEmpty_o : out std_logic;
|
readEmpty_o : out std_logic;
|
outboundWrite_i : in std_logic;
|
readWrite_i : in std_logic;
|
outboundMessage_i : in TestPortMessagePacketBuffer;
|
readMessage_i : in TestPortMessagePacketBuffer;
|
outboundAck_o : out std_logic;
|
readAck_o : out std_logic;
|
|
|
inboundEmpty_o : out std_logic;
|
writeEmpty_o : out std_logic;
|
inboundWrite_i : in std_logic;
|
writeWrite_i : in std_logic;
|
inboundMessage_i : in TestPortMessagePacketBuffer;
|
writeMessage_i : in TestPortMessagePacketBuffer;
|
inboundAck_o : out std_logic;
|
writeAck_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;
|
readFrameRestart_i : in std_logic;
|
readFrameAborted_o : out std_logic;
|
readFrameAborted_o : out std_logic;
|
Line 230... |
Line 230... |
entity TestPortPacketBuffer is
|
entity TestPortPacketBuffer is
|
port(
|
port(
|
clk : in std_logic;
|
clk : in std_logic;
|
areset_n : in std_logic;
|
areset_n : in std_logic;
|
|
|
outboundEmpty_o : out std_logic;
|
readEmpty_o : out std_logic;
|
outboundWrite_i : in std_logic;
|
readWrite_i : in std_logic;
|
outboundMessage_i : in TestPortMessagePacketBuffer;
|
readMessage_i : in TestPortMessagePacketBuffer;
|
outboundAck_o : out std_logic;
|
readAck_o : out std_logic;
|
|
|
inboundEmpty_o : out std_logic;
|
writeEmpty_o : out std_logic;
|
inboundWrite_i : in std_logic;
|
writeWrite_i : in std_logic;
|
inboundMessage_i : in TestPortMessagePacketBuffer;
|
writeMessage_i : in TestPortMessagePacketBuffer;
|
inboundAck_o : out std_logic;
|
writeAck_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;
|
readFrameRestart_i : in std_logic;
|
readFrameAborted_o : out std_logic;
|
readFrameAborted_o : out std_logic;
|
Line 266... |
Line 266... |
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
--
|
--
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
architecture TestPortPacketBufferPortImpl of TestPortPacketBuffer is
|
architecture TestPortPacketBufferPortImpl of TestPortPacketBuffer is
|
constant QUEUE_SIZE : natural := 63;
|
constant QUEUE_SIZE : natural := 63;
|
type QueueArray is array (natural range <>) of MessageFrame;
|
type QueueArray is array (natural range <>) of TestPortMessagePacketBuffer;
|
|
|
function QueueIndexInc(constant i : natural) return natural is
|
function QueueIndexInc(constant i : natural) return natural is
|
variable returnValue : natural;
|
variable returnValue : natural;
|
begin
|
begin
|
if(i = QUEUE_SIZE) then
|
if(i = QUEUE_SIZE) then
|
Line 284... |
Line 284... |
begin
|
begin
|
|
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
--
|
--
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
Outbound: process
|
Reader: process
|
variable frameQueue : QueueArray(0 to QUEUE_SIZE);
|
variable frameQueue : QueueArray(0 to QUEUE_SIZE);
|
variable front, back, window : natural range 0 to QUEUE_SIZE;
|
variable front, back, window : natural range 0 to QUEUE_SIZE;
|
variable frameIndex : natural;
|
variable frameIndex : natural;
|
begin
|
begin
|
wait until areset_n = '1';
|
wait until areset_n = '1';
|
Line 302... |
Line 302... |
|
|
front := 0;
|
front := 0;
|
back := 0;
|
back := 0;
|
window := 0;
|
window := 0;
|
frameIndex := 0;
|
frameIndex := 0;
|
outboundEmpty_o <= '1';
|
readEmpty_o <= '1';
|
outboundAck_o <= '0';
|
readAck_o <= '0';
|
|
|
loop
|
loop
|
wait until clk = '1' or outboundWrite_i = '1';
|
wait until clk = '1' or readWrite_i = '1';
|
|
|
if (clk'event) then
|
if (clk'event) then
|
if (readFrame_i = '1') then
|
if (readFrame_i = '1') then
|
if (back /= front) then
|
if (back /= front) then
|
back := QueueIndexInc(back);
|
back := QueueIndexInc(back);
|
else
|
else
|
TestError("OUTBOUND:BACK:reading when no frame is present");
|
TestError("READ:BACK:reading when no frame is present");
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
if (readFrameRestart_i = '1') then
|
if (readFrameRestart_i = '1') then
|
frameIndex := 0;
|
frameIndex := 0;
|
Line 331... |
Line 331... |
if (readWindowNext_i = '1') then
|
if (readWindowNext_i = '1') then
|
if (window /= front) then
|
if (window /= front) then
|
window := QueueIndexInc(window);
|
window := QueueIndexInc(window);
|
frameIndex := 0;
|
frameIndex := 0;
|
else
|
else
|
TestError("OUTBOUND:WINDOW:reading when no frame is present");
|
TestError("READ:WINDOW:reading when no frame is present");
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
if (readContent_i = '1') then
|
if (readContent_i = '1') then
|
if (back /= front) then
|
if (back /= front) then
|
Line 346... |
Line 346... |
readContentEnd_o <= '1';
|
readContentEnd_o <= '1';
|
else
|
else
|
readContentEnd_o <= '0';
|
readContentEnd_o <= '0';
|
end if;
|
end if;
|
else
|
else
|
TestError("OUTBOUND:CONTENT:reading when frame has ended");
|
TestError("READ:CONTENT:reading when frame has ended");
|
end if;
|
end if;
|
else
|
else
|
TestError("OUTBOUND:CONTENT:reading when no frame is present");
|
TestError("READ:CONTENT:reading when no frame is present");
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
if (front = back) then
|
if (front = back) then
|
readFrameEmpty_o <= '1';
|
readFrameEmpty_o <= '1';
|
Line 372... |
Line 372... |
readContentEmpty_o <= '1';
|
readContentEmpty_o <= '1';
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
if (front = back) then
|
if (front = back) then
|
outboundEmpty_o <= '1';
|
readEmpty_o <= '1';
|
else
|
else
|
outboundEmpty_o <= '0';
|
readEmpty_o <= '0';
|
end if;
|
end if;
|
elsif (outboundWrite_i'event) then
|
elsif (readWrite_i'event) then
|
frameQueue(front) := outboundMessage_i;
|
frameQueue(front) := readMessage_i;
|
front := QueueIndexInc(front);
|
front := QueueIndexInc(front);
|
|
|
outboundEmpty_o <= '0';
|
readEmpty_o <= '0';
|
outboundAck_o <= '1';
|
readAck_o <= '1';
|
wait until outboundWrite_i = '0';
|
wait until readWrite_i = '0';
|
outboundAck_o <= '0';
|
readAck_o <= '0';
|
end if;
|
end if;
|
end loop;
|
end loop;
|
end process;
|
end process;
|
|
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
--
|
--
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
Inbound: process
|
Writer: process
|
variable frameQueue : QueueArray(0 to QUEUE_SIZE);
|
variable frameQueue : QueueArray(0 to QUEUE_SIZE);
|
variable front, back : natural range 0 to QUEUE_SIZE;
|
variable front, back : natural range 0 to QUEUE_SIZE;
|
variable frameIndex : natural range 0 to 69;
|
variable frameIndex : natural range 0 to 69;
|
begin
|
begin
|
wait until areset_n = '1';
|
wait until areset_n = '1';
|
|
|
inboundEmpty_o <= '1';
|
writeEmpty_o <= '1';
|
inboundAck_o <= '0';
|
writeAck_o <= '0';
|
|
|
front := 0;
|
front := 0;
|
back := 0;
|
back := 0;
|
frameIndex := 0;
|
frameIndex := 0;
|
|
|
loop
|
loop
|
wait until clk = '1' or inboundWrite_i = '1';
|
wait until clk = '1' or writeWrite_i = '1';
|
|
|
if (clk'event) then
|
if (clk'event) then
|
|
|
if (writeFrame_i = '1') then
|
if (writeFrame_i = '1') then
|
if (frameIndex = 0) then
|
if (frameIndex = 0) then
|
TestError("INBOUND:Empty frame written.");
|
TestError("WRITE:Empty frame written.");
|
end if;
|
end if;
|
if (frameIndex /= frameQueue(back).frame.length) then
|
if (frameIndex /= frameQueue(back).frame.length) then
|
TestError("INBOUND:Frame with unmatching length was written.");
|
TestError("WRITE:Frame with unmatching length was written.");
|
end if;
|
end if;
|
if (back /= front) then
|
if (back /= front) then
|
back := QueueIndexInc(back);
|
back := QueueIndexInc(back);
|
else
|
else
|
TestError("INBOUND:Unexpected frame written.");
|
TestError("WRITE:Unexpected frame written.");
|
end if;
|
end if;
|
frameIndex := 0;
|
frameIndex := 0;
|
end if;
|
end if;
|
|
|
if (writeFrameAbort_i = '1') then
|
if (writeFrameAbort_i = '1') then
|
if (back /= front) then
|
if (back /= front) then
|
if (frameQueue(back).willAbort) then
|
if (frameQueue(back).willAbort) then
|
if (frameIndex /= frameQueue(back).frame.length) then
|
TestCompare(frameIndex,
|
TestError("INBOUND:Frame with unmatching length was aborted.");
|
frameQueue(back).frame.length,
|
end if;
|
"frameIndex abort");
|
back := QueueIndexInc(back);
|
back := QueueIndexInc(back);
|
else
|
else
|
TestError("INBOUND:Not expecting this frame to abort.");
|
TestError("WRITE:Not expecting this frame to abort.");
|
end if;
|
end if;
|
end if;
|
end if;
|
frameIndex := 0;
|
frameIndex := 0;
|
end if;
|
end if;
|
|
|
if (writeContent_i = '1') then
|
if (writeContent_i = '1') then
|
if (frameIndex < frameQueue(back).frame.length) then
|
if (frameIndex < frameQueue(back).frame.length) then
|
if (frameQueue(back).frame.payload(frameIndex) /= writeContentData_i) then
|
TestCompare(writeContentData_i,
|
TestError("INBOUND:Unexpected frame content written.");
|
frameQueue(back).frame.payload(frameIndex),
|
end if;
|
"frame content");
|
frameIndex := frameIndex + 1;
|
frameIndex := frameIndex + 1;
|
else
|
else
|
TestError("INBOUND:Receiving more frame content than expected.");
|
TestError("WRITE:Receiving more frame content than expected.");
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
if (front = back) then
|
if (front = back) then
|
inboundEmpty_o <= '1';
|
writeEmpty_o <= '1';
|
else
|
else
|
inboundEmpty_o <= '0';
|
writeEmpty_o <= '0';
|
end if;
|
end if;
|
elsif (inboundWrite_i'event) then
|
elsif (writeWrite_i'event) then
|
frameQueue(front) := inboundMessage_i;
|
frameQueue(front) := writeMessage_i;
|
front := QueueIndexInc(front);
|
front := QueueIndexInc(front);
|
|
|
inboundEmpty_o <= '0';
|
writeEmpty_o <= '0';
|
inboundAck_o <= '1';
|
writeAck_o <= '1';
|
wait until inboundWrite_i = '0';
|
wait until writeWrite_i = '0';
|
inboundAck_o <= '0';
|
writeAck_o <= '0';
|
end if;
|
end if;
|
end loop;
|
end loop;
|
end process;
|
end process;
|
|
|
end architecture;
|
end architecture;
|
Line 502... |
Line 502... |
stb_i : in std_logic;
|
stb_i : in std_logic;
|
we_i : in std_logic;
|
we_i : in std_logic;
|
adr_i : in std_logic_vector(30 downto 0);
|
adr_i : in std_logic_vector(30 downto 0);
|
sel_i : in std_logic_vector(7 downto 0);
|
sel_i : in std_logic_vector(7 downto 0);
|
dat_i : in std_logic_vector(63 downto 0);
|
dat_i : in std_logic_vector(63 downto 0);
|
dat_o : in std_logic_vector(63 downto 0);
|
dat_o : out std_logic_vector(63 downto 0);
|
err_o : out std_logic;
|
err_o : out std_logic;
|
ack_o : out std_logic);
|
ack_o : out std_logic);
|
end entity;
|
end entity;
|
|
|
|
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
--
|
--
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
architecture TestWishbonePortImpl of TestWishbonePort is
|
architecture TestPortWishboneImpl of TestPortWishbone is
|
constant QUEUE_SIZE : natural := 63;
|
constant QUEUE_SIZE : natural := 63;
|
type QueueArray is array (natural range <>) of MessageFrame;
|
type QueueArray is array (natural range <>) of TestPortMessageWishbone;
|
|
|
function QueueIndexInc(constant i : natural) return natural is
|
function QueueIndexInc(constant i : natural) return natural is
|
variable returnValue : natural;
|
variable returnValue : natural;
|
begin
|
begin
|
if(i = QUEUE_SIZE) then
|
if(i = QUEUE_SIZE) then
|
Line 557... |
Line 557... |
wait until clk = '1' or messageWrite_i = '1';
|
wait until clk = '1' or messageWrite_i = '1';
|
|
|
if (clk'event) then
|
if (clk'event) then
|
if (cyc_i = '1') then
|
if (cyc_i = '1') then
|
if (front /= back) then
|
if (front /= back) then
|
|
if (cyclePosition < queue(back).length) then
|
TestCompare(stb_i, '1', "stb_i");
|
TestCompare(stb_i, '1', "stb_i");
|
if (queue(back).writeAccess) then
|
if (queue(back).writeAccess) then
|
TestCompare(we_i, '1', "we_i");
|
TestCompare(we_i, '1', "we_i");
|
else
|
else
|
TestCompare(we_i, '0', "we_i");
|
TestCompare(we_i, '0', "we_i");
|
end if;
|
end if;
|
TestCompare(adr_i, queue(back).address, "adr_i");
|
-- REMARK: Add this...
|
|
--TestCompare(adr_i, std_logic_vector(unsigned(queue(back).address)+cyclePosition), "adr_i");
|
TestCompare(sel_i, queue(back).byteSelect, "sel_i");
|
TestCompare(sel_i, queue(back).byteSelect, "sel_i");
|
|
if (queue(back).writeAccess) then
|
TestCompare(dat_i, queue(back).data(cyclePosition), "dat_i");
|
TestCompare(dat_i, queue(back).data(cyclePosition), "dat_i");
|
|
end if;
|
|
|
if (latencyCounter = queue(back).latency) then
|
if (latencyCounter = queue(back).latency) then
|
|
dat_o <= queue(back).data(cyclePosition);
|
ack_o <= '1';
|
ack_o <= '1';
|
latencyCounter := 0;
|
latencyCounter := 0;
|
if(cyclePosition = queue(back).length) then
|
|
back := QueueIndexInc(back);
|
|
cyclePosition := 0;
|
|
else
|
|
cyclePosition := cyclePosition + 1;
|
cyclePosition := cyclePosition + 1;
|
end if;
|
|
else
|
else
|
|
dat_o <= (others=>'U');
|
ack_o <= '0';
|
ack_o <= '0';
|
latencyCounter := latencyCounter + 1;
|
latencyCounter := latencyCounter + 1;
|
end if;
|
end if;
|
else
|
else
|
|
back := QueueIndexInc(back);
|
|
cyclePosition := 0;
|
|
latencyCounter := 0;
|
|
dat_o <= (others=>'U');
|
|
ack_o <= '0';
|
|
end if;
|
|
else
|
TestError("Unexpected access.");
|
TestError("Unexpected access.");
|
end if;
|
end if;
|
else
|
else
|
if (cyclePostion /= 0) or (latencyCounter /= 0) then
|
if (cyclePosition /= 0) or (latencyCounter /= 0) then
|
TestError("Cycle unexpectedly aborted.");
|
TestError("Cycle unexpectedly aborted.");
|
cyclePosition := 0;
|
cyclePosition := 0;
|
latencyCounter := 0;
|
latencyCounter := 0;
|
end if;
|
end if;
|
TestCompare(stb_i, '0', "stb_i");
|
TestCompare(stb_i, '0', "stb_i");
|
end if;
|
end if;
|
|
|
if (front = back) then
|
if (front = back) then
|
outboundWriteEmpty_o <= '1';
|
messageEmpty_o <= '1';
|
else
|
else
|
outboundWriteEmpty_o <= '0';
|
messageEmpty_o <= '0';
|
end if;
|
end if;
|
elsif (messageWrite_i'event) then
|
elsif (messageWrite_i'event) then
|
queue(front) := message_i;
|
queue(front) := message_i;
|
front := QueueIndexInc(front);
|
front := QueueIndexInc(front);
|
|
|
Line 650... |
Line 658... |
ASSY_VENDOR_IDENTITY : std_logic_vector(15 downto 0);
|
ASSY_VENDOR_IDENTITY : std_logic_vector(15 downto 0);
|
ASSY_REV : std_logic_vector(15 downto 0));
|
ASSY_REV : std_logic_vector(15 downto 0));
|
port(
|
port(
|
clk : in std_logic;
|
clk : in std_logic;
|
areset_n : in std_logic;
|
areset_n : in std_logic;
|
|
enable : in std_logic;
|
|
|
readFrameEmpty_i : in std_logic;
|
readFrameEmpty_i : in std_logic;
|
readFrame_o : out std_logic;
|
readFrame_o : out std_logic;
|
readContent_o : out std_logic;
|
readContent_o : out std_logic;
|
readContentEnd_i : in std_logic;
|
readContentEnd_i : in std_logic;
|
Line 763... |
Line 772... |
procedure SetSlaveAccess(constant writeAccess : in boolean;
|
procedure SetSlaveAccess(constant writeAccess : in boolean;
|
constant address : in std_logic_vector(ADDRESS_WIDTH-1 downto 0);
|
constant address : in std_logic_vector(ADDRESS_WIDTH-1 downto 0);
|
constant byteSelect : in std_logic_vector(7 downto 0);
|
constant byteSelect : in std_logic_vector(7 downto 0);
|
constant length : in natural range 1 to DATA_SIZE_MAX;
|
constant length : in natural range 1 to DATA_SIZE_MAX;
|
constant data : in DoublewordArray(0 to DATA_SIZE_MAX-1);
|
constant data : in DoublewordArray(0 to DATA_SIZE_MAX-1);
|
constant latency : natural := 0) is
|
constant latency : natural := 1) is
|
begin
|
begin
|
TestPortWishboneWrite(wbMessageWrite, wbMessage, wbMessageAck,
|
TestPortWishboneWrite(wbMessageWrite, wbMessage, wbMessageAck,
|
writeAccess, address, byteSelect, length, data, latency);
|
writeAccess, address, byteSelect, length, data, latency);
|
end procedure;
|
end procedure;
|
|
|
|
---------------------------------------------------------------------------
|
|
--
|
|
---------------------------------------------------------------------------
|
|
function getReadSize(constant rdsize : in std_logic_vector(3 downto 0);
|
|
constant wdptr : in std_logic) return natural is
|
|
begin
|
|
case rdsize is
|
|
when "0000" | "0001" | "0010" | "0011" =>
|
|
return 1;
|
|
when "0100" | "0110" =>
|
|
return 1;
|
|
when "0101" =>
|
|
return 1;
|
|
when "1000" =>
|
|
return 1;
|
|
when "0111" =>
|
|
return 1;
|
|
when "1001" =>
|
|
return 1;
|
|
when "1010" =>
|
|
return 1;
|
|
when "1011" =>
|
|
if (wdptr = '0') then
|
|
return 1;
|
|
else
|
|
return 2;
|
|
end if;
|
|
when "1100" =>
|
|
if (wdptr = '0') then
|
|
return 4;
|
|
else
|
|
return 8;
|
|
end if;
|
|
when "1101" =>
|
|
if (wdptr = '0') then
|
|
return 12;
|
|
else
|
|
return 16;
|
|
end if;
|
|
when "1110" =>
|
|
if (wdptr = '0') then
|
|
return 20;
|
|
else
|
|
return 24;
|
|
end if;
|
|
when "1111" =>
|
|
if (wdptr = '0') then
|
|
return 28;
|
|
else
|
|
return 32;
|
|
end if;
|
|
when others =>
|
|
return 0;
|
|
end case;
|
|
end function;
|
|
|
|
function getReadMask(constant rdsize : in std_logic_vector(3 downto 0);
|
|
constant wdptr : in std_logic) return std_logic_vector is
|
|
begin
|
|
case rdsize is
|
|
when "0000" =>
|
|
if (wdptr = '0') then
|
|
return "10000000";
|
|
else
|
|
return "00001000";
|
|
end if;
|
|
when "0001" =>
|
|
if (wdptr = '0') then
|
|
return "01000000";
|
|
else
|
|
return "00000100";
|
|
end if;
|
|
when "0010" =>
|
|
if (wdptr = '0') then
|
|
return "00100000";
|
|
else
|
|
return "00000010";
|
|
end if;
|
|
when "0011" =>
|
|
if (wdptr = '0') then
|
|
return "00010000";
|
|
else
|
|
return "00000001";
|
|
end if;
|
|
when "0100" =>
|
|
if (wdptr = '0') then
|
|
return "11000000";
|
|
else
|
|
return "00001100";
|
|
end if;
|
|
when "0110" =>
|
|
if (wdptr = '0') then
|
|
return "00110000";
|
|
else
|
|
return "00000011";
|
|
end if;
|
|
when "0101" =>
|
|
if (wdptr = '0') then
|
|
return "11100000";
|
|
else
|
|
return "00000111";
|
|
end if;
|
|
when "1000" =>
|
|
if (wdptr = '0') then
|
|
return "11110000";
|
|
else
|
|
return "00001111";
|
|
end if;
|
|
when "0111" =>
|
|
if (wdptr = '0') then
|
|
return "11111000";
|
|
else
|
|
return "00011111";
|
|
end if;
|
|
when "1001" =>
|
|
if (wdptr = '0') then
|
|
return "11111100";
|
|
else
|
|
return "00111111";
|
|
end if;
|
|
when "1010" =>
|
|
if (wdptr = '0') then
|
|
return "11111110";
|
|
else
|
|
return "01111111";
|
|
end if;
|
|
when others =>
|
|
return "11111111";
|
|
end case;
|
|
end function;
|
|
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
--
|
--
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
variable seed1 : positive := 1;
|
variable seed1 : positive := 1;
|
variable seed2: positive := 1;
|
variable seed2: positive := 1;
|
|
|
|
variable rdsize : std_logic_vector(3 downto 0);
|
|
variable wdptr : std_logic;
|
variable ioData : DoubleWordArray(0 to 31);
|
variable ioData : DoubleWordArray(0 to 31);
|
variable frame : RioFrame;
|
variable frame : RioFrame;
|
|
|
begin
|
begin
|
areset_n <= '0';
|
areset_n <= '0';
|
|
enable <= '1';
|
|
|
|
inboundWrite <= '0';
|
|
outboundWrite <= '0';
|
|
wbMessageWrite <= '0';
|
|
|
writeFrameFull <= '0';
|
writeFrameFull <= '0';
|
|
|
wait until clk'event and clk = '1';
|
wait until clk'event and clk = '1';
|
wait until clk'event and clk = '1';
|
wait until clk'event and clk = '1';
|
Line 792... |
Line 938... |
wait until clk'event and clk = '1';
|
wait until clk'event and clk = '1';
|
wait until clk'event and clk = '1';
|
wait until clk'event and clk = '1';
|
|
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
PrintS("-----------------------------------------------------------------");
|
PrintS("-----------------------------------------------------------------");
|
PrintS("TG_RioLogicalCommon");
|
PrintS("TG_RioWbBridge");
|
PrintS("-----------------------------------------------------------------");
|
PrintS("-----------------------------------------------------------------");
|
PrintS("TG_RioLogicalCommon-TC1");
|
PrintS("TG_RioWbBridge-TC1");
|
PrintS("Description: Test maintenance read requests.");
|
PrintS("Description: Test maintenance requests.");
|
PrintS("Requirement: XXXXX");
|
PrintS("Requirement: XXXXX");
|
PrintS("-----------------------------------------------------------------");
|
PrintS("-----------------------------------------------------------------");
|
PrintS("Step 1:");
|
PrintS("Step 1:");
|
PrintS("Action: Send maintenance read request for one word on even offset.");
|
PrintS("Action: Send maintenance read request for one word on even offset.");
|
PrintS("Result: Check the accesses on the external configuration port.");
|
PrintS("Result: Check the accesses on the external configuration port.");
|
PrintS("-----------------------------------------------------------------");
|
PrintS("-----------------------------------------------------------------");
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
PrintR("TG_RioLogicalCommon-TC1-Step1");
|
PrintR("TG_RioWbBridge-TC1-Step1");
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
|
|
ioData(0) := x"deadbeefc0debabe";
|
---------------------------------------------------------------------------
|
|
PrintS("-----------------------------------------------------------------");
|
|
PrintS("TG_RioWbBridge-TC2");
|
|
PrintS("Description: Test request class packets.");
|
|
PrintS("Requirement: XXXXX");
|
|
PrintS("-----------------------------------------------------------------");
|
|
PrintS("Step 1:");
|
|
PrintS("Action: Send maintenance read request for one word on even offset.");
|
|
PrintS("Result: Check the accesses on the external configuration port.");
|
|
PrintS("-----------------------------------------------------------------");
|
|
---------------------------------------------------------------------------
|
|
PrintR("TG_RioWbBridge-TC2-Step1");
|
|
---------------------------------------------------------------------------
|
|
-- REMARK: Change the address also...
|
|
for i in 0 to 15 loop
|
|
for j in 0 to 1 loop
|
|
rdsize := std_logic_vector(to_unsigned(i, 4));
|
|
if (j = 0) then
|
|
wdptr := '0';
|
|
else
|
|
wdptr:= '1';
|
|
end if;
|
|
|
|
CreateRandomPayload(ioData, seed1, seed2);
|
|
|
InboundFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
|
InboundFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
|
tt=>"01", ftype=>FTYPE_REQUEST_CLASS,
|
tt=>"01", ftype=>FTYPE_REQUEST_CLASS,
|
sourceId=>x"dead", destId=>x"beef",
|
sourceId=>x"dead", destId=>x"beef",
|
payload=>RioNread(rdsize=>"0000",
|
payload=>RioNread(rdsize=>rdsize,
|
tid=>x"aa",
|
tid=>x"aa",
|
address=>"00000000000000000000000000000",
|
address=>"00000000000000000000000000000",
|
wdptr=>'0',
|
wdptr=>wdptr,
|
xamsbs=>"00")));
|
xamsbs=>"00")));
|
|
|
OutboundFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
|
OutboundFrame(RioFrameCreate(ackId=>"00000", vc=>'0', crf=>'0', prio=>"00",
|
tt=>"01", ftype=>FTYPE_RESPONSE_CLASS,
|
tt=>"01", ftype=>FTYPE_RESPONSE_CLASS,
|
sourceId=>x"beef", destId=>x"dead",
|
sourceId=>x"beef", destId=>x"dead",
|
payload=>RioResponse(status=>"0000",
|
payload=>RioResponse(status=>"0000",
|
tid=>x"aa",
|
tid=>x"aa",
|
dataLength=>1,
|
dataLength=>getReadSize(rdsize, wdptr),
|
data=>ioData)));
|
data=>ioData)));
|
|
|
SetSlaveAccess(false, "0000000000000000000000000000000", "00000001", 1, ioData);
|
SetSlaveAccess(false, "0000000000000000000000000000000",
|
|
getReadMask(rdsize, wdptr),
|
|
getReadSize(rdsize, wdptr),
|
|
ioData);
|
|
|
TestWait(inboundEmpty, '1', "inbound frame");
|
TestWait(inboundEmpty, '1', "inbound frame");
|
TestWait(outboundEmpty, '1', "outbound frame");
|
TestWait(outboundEmpty, '1', "outbound frame");
|
TestWait(wbMessageEmpty, '1', "wishbone access");
|
TestWait(wbMessageEmpty, '1', "wishbone access");
|
|
end loop;
|
|
end loop;
|
|
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
-- Test completed.
|
-- Test completed.
|
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
|
|
Line 843... |
Line 1017... |
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
-- Instantiate the test object.
|
-- Instantiate the test object.
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
TestObject: RioWbBridge
|
TestObject: RioWbBridge
|
generic map(
|
generic map(
|
EXTENDED_ADDRESS=>0)
|
EXTENDED_ADDRESS=>0,
|
|
DEVICE_IDENTITY=>x"dead",
|
|
DEVICE_VENDOR_IDENTITY=>x"beef",
|
|
DEVICE_REV=>x"c0debabe",
|
|
ASSY_IDENTITY=>x"1111",
|
|
ASSY_VENDOR_IDENTITY=>x"2222",
|
|
ASSY_REV=>x"3333")
|
port map(
|
port map(
|
clk=>clk,
|
clk=>clk,
|
areset_n=>areset_n,
|
areset_n=>areset_n,
|
|
enable=>enable,
|
readFrameEmpty_i=>readFrameEmpty,
|
readFrameEmpty_i=>readFrameEmpty,
|
readFrame_o=>readFrame,
|
readFrame_o=>readFrame,
|
readContent_o=>readContent,
|
readContent_o=>readContent,
|
readContentEnd_i=>readContentEnd,
|
readContentEnd_i=>readContentEnd,
|
readContentData_i=>readContentData,
|
readContentData_i=>readContentData,
|
Line 874... |
Line 1055... |
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
|
|
TestPortPacketBufferInst: TestPortPacketBuffer
|
TestPortPacketBufferInst: TestPortPacketBuffer
|
port map(
|
port map(
|
clk=>clk, areset_n=>areset_n,
|
clk=>clk, areset_n=>areset_n,
|
outboundEmpty_o=>outboundEmpty,
|
readEmpty_o=>inboundEmpty,
|
outboundWrite_i=>outboundWrite,
|
readWrite_i=>inboundWrite,
|
outboundMessage_i=>outboundMessage,
|
readMessage_i=>inboundMessage,
|
outboundAck_o=>outboundAck,
|
readAck_o=>inboundAck,
|
inboundEmpty_o=>inboundEmpty,
|
writeEmpty_o=>outboundEmpty,
|
inboundWrite_i=>inboundWrite,
|
writeWrite_i=>outboundWrite,
|
inboundMessage_i=>inboundMessage,
|
writeMessage_i=>outboundMessage,
|
inboundAck_o=>inboundAck,
|
writeAck_o=>outboundAck,
|
readFrameEmpty_o=>readFrameEmpty,
|
readFrameEmpty_o=>readFrameEmpty,
|
readFrame_i=>readFrame,
|
readFrame_i=>readFrame,
|
readFrameRestart_i=>readFrameRestart,
|
readFrameRestart_i=>'0',
|
readFrameAborted_o=>readFrameAborted,
|
readFrameAborted_o=>readFrameAborted,
|
|
readWindowEmpty_o=>open,
|
|
readWindowReset_i=>'0',
|
|
readWindowNext_i=>readFrame,
|
readContentEmpty_o=>readContentEmpty,
|
readContentEmpty_o=>readContentEmpty,
|
readContent_i=>readContent,
|
readContent_i=>readContent,
|
readContentEnd_o=>readContentEnd,
|
readContentEnd_o=>readContentEnd,
|
readContentData_o=>readContentData,
|
readContentData_o=>readContentData,
|
writeFrame_i=>writeFrame,
|
writeFrame_i=>writeFrame,
|