Line 42... |
Line 42... |
--
|
--
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
|
|
|
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
|
-- RioSerial common package.
|
|
-------------------------------------------------------------------------------
|
|
library ieee;
|
|
use ieee.std_logic_1164.all;
|
|
use ieee.numeric_std.all;
|
|
use work.rio_common.all;
|
|
|
|
-------------------------------------------------------------------------------
|
|
--
|
|
-------------------------------------------------------------------------------
|
|
package rioserial_common is
|
|
type TxInternalType is record
|
|
operational : std_logic;
|
|
ackId : std_logic_vector(4 downto 0);
|
|
bufferStatus : std_logic_vector(4 downto 0);
|
|
statusReceived : std_logic;
|
|
numberSentLinkRequests : std_logic_vector(1 downto 0);
|
|
outputErrorStopped : std_logic;
|
|
fatalError : std_logic;
|
|
recoverActive : std_logic;
|
|
recoverCounter : std_logic_vector(4 downto 0);
|
|
ackIdWindow : std_logic_vector(4 downto 0);
|
|
frameState : std_logic_vector(3 downto 0);
|
|
frameWordCounter : std_logic_vector(1 downto 0);
|
|
frameContent : std_logic_vector(63 downto 0);
|
|
counter : std_logic_vector(3 downto 0);
|
|
symbolsTransmitted : std_logic_vector(7 downto 0);
|
|
maintenanceClass : std_logic;
|
|
end record;
|
|
|
|
type TxInternalArrayType is array(natural range <>) of TxInternalType;
|
|
|
|
-- REMARK: What to do about the NUMBER_WORDS?!
|
|
type RxInternalType is record
|
|
operational : std_logic;
|
|
inputRetryStopped : std_logic;
|
|
inputErrorStopped : std_logic;
|
|
ackId : unsigned(4 downto 0);
|
|
frameIndex : std_logic_vector(6 downto 0);
|
|
frameWordCounter : std_logic_vector(1 downto 0);
|
|
frameContent : std_logic_vector(32*NUMBER_WORDS-1 downto 0);
|
|
crc : std_logic_vector(15 downto 0);
|
|
end record;
|
|
|
|
type RxInternalArrayType is array(natural range <>) of RxInternalType;
|
|
end package;
|
|
|
|
package body rioserial_common is
|
|
-- Empty.
|
|
end package body;
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
-- RioSerial
|
-- RioSerial
|
--
|
--
|
-- Generics
|
-- Generics
|
-- --------
|
-- --------
|
-- TIMEOUT_WIDTH - The number of bits to be used in the portLinkTimeout signal.
|
-- TIMEOUT_WIDTH - The number of bits to be used in the portLinkTimeout signal.
|
Line 192... |
Line 245... |
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
-- Entity for RioSerial.
|
-- Entity for RioSerial.
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
entity RioSerial is
|
entity RioSerial is
|
generic(
|
generic(
|
TIMEOUT_WIDTH : natural := 20);
|
TIMEOUT_WIDTH : natural := 20;
|
|
NUMBER_WORDS : natural range 1 to 4 := 1);
|
port(
|
port(
|
-- System signals.
|
-- System signals.
|
clk : in std_logic;
|
clk : in std_logic;
|
areset_n : in std_logic;
|
areset_n : in std_logic;
|
|
|
Line 225... |
Line 279... |
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(31 downto 0);
|
readContentData_i : in std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
|
|
|
-- Inbound frame interface.
|
-- Inbound frame interface.
|
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(31 downto 0);
|
writeContentData_o : out std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
|
|
|
-- PCS layer signals.
|
-- PCS layer signals.
|
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)-1) downto 0);
|
outboundSymbolType_o : out std_logic_vector(2*NUMBER_WORDS-1 downto 0);
|
|
outboundSymbol_o : out std_logic_vector(32*NUMBER_WORDS-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)-1) downto 0));
|
inboundSymbolType_i : in std_logic_vector(2*NUMBER_WORDS-1 downto 0);
|
|
inboundSymbol_i : in std_logic_vector(32*NUMBER_WORDS-1 downto 0));
|
end entity;
|
end entity;
|
|
|
|
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
-- Architecture for RioSerial.
|
-- Architecture for RioSerial.
|
Line 291... |
Line 347... |
txWrite_o : out std_logic;
|
txWrite_o : out std_logic;
|
txType_o : out std_logic_vector(2*NUMBER_WORDS-1 downto 0);
|
txType_o : out std_logic_vector(2*NUMBER_WORDS-1 downto 0);
|
txData_o : out std_logic_vector(32*NUMBER_WORDS-1 downto 0);
|
txData_o : out std_logic_vector(32*NUMBER_WORDS-1 downto 0);
|
|
|
txControlEmpty_i : in std_logic_vector(NUMBER_WORDS-1 downto 0);
|
txControlEmpty_i : in std_logic_vector(NUMBER_WORDS-1 downto 0);
|
txControlSymbol_i : in std_logic_vector(12*NUMBER_WORDS downto 0);
|
txControlSymbol_i : in std_logic_vector(13*NUMBER_WORDS-1 downto 0);
|
txControlUpdate_o : out std_logic_vector(NUMBER_WORDS-1 downto 0);
|
txControlUpdate_o : out std_logic_vector(NUMBER_WORDS-1 downto 0);
|
rxControlEmpty_i : in std_logic_vector(NUMBER_WORDS-1 downto 0);
|
rxControlEmpty_i : in std_logic_vector(NUMBER_WORDS-1 downto 0);
|
rxControlSymbol_i : in std_logic_vector(12*NUMBER_WORDS downto 0);
|
rxControlSymbol_i : in std_logic_vector(13*NUMBER_WORDS-1 downto 0);
|
rxControlUpdate_o : out std_logic_vector(NUMBER_WORDS-1 downto 0);
|
rxControlUpdate_o : out std_logic_vector(NUMBER_WORDS-1 downto 0);
|
|
|
linkInitialized_i : in std_logic;
|
linkInitialized_i : in std_logic;
|
linkInitialized_o : out std_logic;
|
linkInitialized_o : out std_logic;
|
ackIdStatus_i : in std_logic_vector(4 downto 0);
|
ackIdStatus_i : in std_logic_vector(4 downto 0);
|
Line 335... |
Line 391... |
rxRead_o : out std_logic;
|
rxRead_o : out std_logic;
|
rxType_i : in std_logic_vector(2*NUMBER_WORDS-1 downto 0);
|
rxType_i : in std_logic_vector(2*NUMBER_WORDS-1 downto 0);
|
rxData_i : in std_logic_vector(32*NUMBER_WORDS-1 downto 0);
|
rxData_i : in std_logic_vector(32*NUMBER_WORDS-1 downto 0);
|
|
|
txControlWrite_o : out std_logic_vector(NUMBER_WORDS-1 downto 0);
|
txControlWrite_o : out std_logic_vector(NUMBER_WORDS-1 downto 0);
|
txControlSymbol_o : out std_logic_vector(12*NUMBER_WORDS downto 0);
|
txControlSymbol_o : out std_logic_vector(13*NUMBER_WORDS-1 downto 0);
|
rxControlWrite_o : out std_logic_vector(NUMBER_WORDS-1 downto 0);
|
rxControlWrite_o : out std_logic_vector(NUMBER_WORDS-1 downto 0);
|
rxControlSymbol_o : out std_logic_vector(12*NUMBER_WORDS downto 0);
|
rxControlSymbol_o : out std_logic_vector(13*NUMBER_WORDS-1 downto 0);
|
|
|
ackIdStatus_o : out std_logic_vector(4 downto 0);
|
ackIdStatus_o : out std_logic_vector(4 downto 0);
|
linkInitialized_o : out std_logic;
|
linkInitialized_o : out std_logic;
|
|
|
writeFrameFull_i : in std_logic;
|
writeFrameFull_i : in std_logic;
|
Line 350... |
Line 406... |
writeContent_o : out std_logic;
|
writeContent_o : out std_logic;
|
writeContentWords_o : out std_logic_vector(1 downto 0);
|
writeContentWords_o : out std_logic_vector(1 downto 0);
|
writeContentData_o : out std_logic_vector(32*NUMBER_WORDS-1 downto 0));
|
writeContentData_o : out std_logic_vector(32*NUMBER_WORDS-1 downto 0));
|
end component;
|
end component;
|
|
|
constant NUMBER_WORDS : natural := 1;
|
|
|
|
signal linkInitializedRx : std_logic;
|
signal linkInitializedRx : std_logic;
|
signal linkInitializedTx : std_logic;
|
signal linkInitializedTx : std_logic;
|
signal ackIdStatus : std_logic_vector(4 downto 0);
|
signal ackIdStatus : std_logic_vector(4 downto 0);
|
|
|
signal txControlWrite : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal txControlWrite : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal txControlWriteSymbol : std_logic_vector(12*NUMBER_WORDS downto 0);
|
signal txControlWriteSymbol : std_logic_vector(13*NUMBER_WORDS-1 downto 0);
|
signal txControlReadEmpty : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal txControlReadEmpty : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal txControlRead : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal txControlRead : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal txControlReadSymbol : std_logic_vector(12*NUMBER_WORDS downto 0);
|
signal txControlReadSymbol : std_logic_vector(13*NUMBER_WORDS-1 downto 0);
|
|
|
signal rxControlWrite : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal rxControlWrite : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal rxControlWriteSymbol : std_logic_vector(12*NUMBER_WORDS downto 0);
|
signal rxControlWriteSymbol : std_logic_vector(13*NUMBER_WORDS-1 downto 0);
|
signal rxControlReadEmpty : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal rxControlReadEmpty : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal rxControlRead : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal rxControlRead : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal rxControlReadSymbol : std_logic_vector(12*NUMBER_WORDS downto 0);
|
signal rxControlReadSymbol : std_logic_vector(13*NUMBER_WORDS-1 downto 0);
|
|
|
signal outboundType : std_logic_vector(1 downto 0);
|
|
signal outboundData : std_logic_vector(32*NUMBER_WORDS-1 downto 0);
|
|
|
|
signal inboundType : std_logic_vector(1 downto 0);
|
|
signal inboundData : std_logic_vector(32*NUMBER_WORDS-1 downto 0);
|
|
|
|
begin
|
begin
|
|
|
linkInitialized_o <=
|
linkInitialized_o <=
|
'1' when ((linkInitializedRx = '1') and (linkInitializedTx = '1')) else '0';
|
'1' when ((linkInitializedRx = '1') and (linkInitializedTx = '1')) else '0';
|
|
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
-- Serial layer modules.
|
-- Serial layer modules.
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
|
|
outboundSymbol_o <= outboundType & outboundData;
|
|
Transmitter: RioTransmitter
|
Transmitter: RioTransmitter
|
generic map(
|
generic map(
|
TIMEOUT_WIDTH=>TIMEOUT_WIDTH,
|
TIMEOUT_WIDTH=>TIMEOUT_WIDTH,
|
NUMBER_WORDS=>NUMBER_WORDS)
|
NUMBER_WORDS=>NUMBER_WORDS)
|
port map(
|
port map(
|
Line 400... |
Line 447... |
outboundAckId_i=>outboundAckId_i,
|
outboundAckId_i=>outboundAckId_i,
|
outstandingAckId_o=>outstandingAckId_o,
|
outstandingAckId_o=>outstandingAckId_o,
|
outboundAckId_o=>outboundAckId_o,
|
outboundAckId_o=>outboundAckId_o,
|
portInitialized_i=>portInitialized_i,
|
portInitialized_i=>portInitialized_i,
|
txFull_i=>outboundSymbolFull_i,
|
txFull_i=>outboundSymbolFull_i,
|
txWrite_o=>outboundsymbolWrite_o,
|
txWrite_o=>outboundSymbolWrite_o,
|
txType_o=>outboundType,
|
txType_o=>outboundSymbolType_o,
|
txData_o=>outboundData,
|
txData_o=>outboundSymbol_o,
|
txControlEmpty_i=>txControlReadEmpty,
|
txControlEmpty_i=>txControlReadEmpty,
|
txControlSymbol_i=>txControlReadSymbol,
|
txControlSymbol_i=>txControlReadSymbol,
|
txControlUpdate_o=>txControlRead,
|
txControlUpdate_o=>txControlRead,
|
rxControlEmpty_i=>rxControlReadEmpty,
|
rxControlEmpty_i=>rxControlReadEmpty,
|
rxControlSymbol_i=>rxControlReadSymbol,
|
rxControlSymbol_i=>rxControlReadSymbol,
|
Line 422... |
Line 469... |
readWindowReset_o=>readWindowReset_o,
|
readWindowReset_o=>readWindowReset_o,
|
readWindowNext_o=>readWindowNext_o,
|
readWindowNext_o=>readWindowNext_o,
|
readContentEmpty_i=>readContentEmpty_i,
|
readContentEmpty_i=>readContentEmpty_i,
|
readContent_o=>readContent_o,
|
readContent_o=>readContent_o,
|
readContentEnd_i=>readContentEnd_i,
|
readContentEnd_i=>readContentEnd_i,
|
readContentWords_i=>"00",
|
readContentWords_i=>readContentData_i(32*NUMBER_WORDS+1 downto 32*NUMBER_WORDS),
|
readContentData_i=>readContentData_i(32*NUMBER_WORDS-1 downto 0));
|
readContentData_i=>readContentData_i(32*NUMBER_WORDS-1 downto 0));
|
|
|
SymbolFifo: for i in 0 to NUMBER_WORDS-1 generate
|
SymbolFifo: for i in 0 to NUMBER_WORDS-1 generate
|
TxSymbolFifo: RioFifo
|
TxSymbolFifo: RioFifo
|
generic map(DEPTH_WIDTH=>5, DATA_WIDTH=>13)
|
generic map(DEPTH_WIDTH=>5, DATA_WIDTH=>13)
|
port map(
|
port map(
|
clk=>clk, areset_n=>areset_n,
|
clk=>clk, areset_n=>areset_n,
|
empty_o=>txControlReadEmpty(i),
|
empty_o=>txControlReadEmpty(i),
|
read_i=>txControlRead(i),
|
read_i=>txControlRead(i),
|
data_o=>txControlReadSymbol(12*(i+1) downto 12*i),
|
data_o=>txControlReadSymbol(13*(i+1)-1 downto 13*i),
|
write_i=>txControlWrite(i),
|
write_i=>txControlWrite(i),
|
data_i=>txControlWriteSymbol(12*(i+1) downto 12*i));
|
data_i=>txControlWriteSymbol(13*(i+1)-1 downto 13*i));
|
|
|
RxSymbolFifo: RioFifo
|
RxSymbolFifo: RioFifo
|
generic map(DEPTH_WIDTH=>5, DATA_WIDTH=>13)
|
generic map(DEPTH_WIDTH=>5, DATA_WIDTH=>13)
|
port map(
|
port map(
|
clk=>clk, areset_n=>areset_n,
|
clk=>clk, areset_n=>areset_n,
|
empty_o=>rxControlReadEmpty(i),
|
empty_o=>rxControlReadEmpty(i),
|
read_i=>rxControlRead(i),
|
read_i=>rxControlRead(i),
|
data_o=>rxControlReadSymbol(12*(i+1) downto 12*i),
|
data_o=>rxControlReadSymbol(13*(i+1)-1 downto 13*i),
|
write_i=>rxControlWrite(i),
|
write_i=>rxControlWrite(i),
|
data_i=>rxControlWriteSymbol(12*(i+1) downto 12*i));
|
data_i=>rxControlWriteSymbol(13*(i+1)-1 downto 13*i));
|
end generate;
|
end generate;
|
|
|
inboundType <= inboundSymbol_i(2+(32*NUMBER_WORDS-1) downto 1+(32*NUMBER_WORDS-1));
|
|
inboundData <= inboundSymbol_i(32*NUMBER_WORDS-1 downto 0);
|
|
Receiver: RioReceiver
|
Receiver: RioReceiver
|
generic map(NUMBER_WORDS=>NUMBER_WORDS)
|
generic map(NUMBER_WORDS=>NUMBER_WORDS)
|
port map(
|
port map(
|
clk=>clk, areset_n=>areset_n,
|
clk=>clk, areset_n=>areset_n,
|
portEnable_i=>inputPortEnable_i,
|
portEnable_i=>inputPortEnable_i,
|
Line 460... |
Line 505... |
inboundAckId_i=>inboundAckId_i,
|
inboundAckId_i=>inboundAckId_i,
|
inboundAckId_o=>inboundAckId_o,
|
inboundAckId_o=>inboundAckId_o,
|
portInitialized_i=>portInitialized_i,
|
portInitialized_i=>portInitialized_i,
|
rxEmpty_i=>inboundSymbolEmpty_i,
|
rxEmpty_i=>inboundSymbolEmpty_i,
|
rxRead_o=>inboundSymbolRead_o,
|
rxRead_o=>inboundSymbolRead_o,
|
rxType_i=>inboundType,
|
rxType_i=>inboundSymbolType_i,
|
rxData_i=>inboundData,
|
rxData_i=>inboundSymbol_i,
|
txControlWrite_o=>txControlWrite,
|
txControlWrite_o=>txControlWrite,
|
txControlSymbol_o=>txControlWriteSymbol,
|
txControlSymbol_o=>txControlWriteSymbol,
|
rxControlWrite_o=>rxControlWrite,
|
rxControlWrite_o=>rxControlWrite,
|
rxControlSymbol_o=>rxControlWriteSymbol,
|
rxControlSymbol_o=>rxControlWriteSymbol,
|
ackIdStatus_o=>ackIdStatus,
|
ackIdStatus_o=>ackIdStatus,
|
linkInitialized_o=>linkInitializedRx,
|
linkInitialized_o=>linkInitializedRx,
|
writeFrameFull_i=>writeFrameFull_i,
|
writeFrameFull_i=>writeFrameFull_i,
|
writeFrame_o=>writeFrame_o,
|
writeFrame_o=>writeFrame_o,
|
writeFrameAbort_o=>writeFrameAbort_o,
|
writeFrameAbort_o=>writeFrameAbort_o,
|
writeContent_o=>writeContent_o,
|
writeContent_o=>writeContent_o,
|
writeContentWords_o=>open,
|
writeContentWords_o=>writeContentData_o(32*NUMBER_WORDS+1 downto 32*NUMBER_WORDS),
|
writeContentData_o=>writeContentData_o(32*NUMBER_WORDS-1 downto 0));
|
writeContentData_o=>writeContentData_o(32*NUMBER_WORDS-1 downto 0));
|
|
|
end architecture;
|
end architecture;
|
|
|
|
|
Line 486... |
Line 531... |
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
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;
|
use work.rio_common.all;
|
use work.rio_common.all;
|
|
use work.rioserial_common.all;
|
|
|
|
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
-- Entity for RioTransmitter.
|
-- Entity for RioTransmitter.
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
Line 521... |
Line 567... |
txType_o : out std_logic_vector(2*NUMBER_WORDS-1 downto 0);
|
txType_o : out std_logic_vector(2*NUMBER_WORDS-1 downto 0);
|
txData_o : out std_logic_vector(32*NUMBER_WORDS-1 downto 0);
|
txData_o : out std_logic_vector(32*NUMBER_WORDS-1 downto 0);
|
|
|
-- Control symbols aimed to the transmitter.
|
-- Control symbols aimed to the transmitter.
|
txControlEmpty_i : in std_logic_vector(NUMBER_WORDS-1 downto 0);
|
txControlEmpty_i : in std_logic_vector(NUMBER_WORDS-1 downto 0);
|
txControlSymbol_i : in std_logic_vector(12*NUMBER_WORDS downto 0);
|
txControlSymbol_i : in std_logic_vector(13*NUMBER_WORDS-1 downto 0);
|
txControlUpdate_o : out std_logic_vector(NUMBER_WORDS-1 downto 0);
|
txControlUpdate_o : out std_logic_vector(NUMBER_WORDS-1 downto 0);
|
|
|
-- Control symbols from the receiver to send.
|
-- Control symbols from the receiver to send.
|
rxControlEmpty_i : in std_logic_vector(NUMBER_WORDS-1 downto 0);
|
rxControlEmpty_i : in std_logic_vector(NUMBER_WORDS-1 downto 0);
|
rxControlSymbol_i : in std_logic_vector(12*NUMBER_WORDS downto 0);
|
rxControlSymbol_i : in std_logic_vector(13*NUMBER_WORDS-1 downto 0);
|
rxControlUpdate_o : out std_logic_vector(NUMBER_WORDS-1 downto 0);
|
rxControlUpdate_o : out std_logic_vector(NUMBER_WORDS-1 downto 0);
|
|
|
-- Internal signalling from the receiver part.
|
-- Internal signalling from the receiver part.
|
linkInitialized_o : out std_logic;
|
linkInitialized_o : out std_logic;
|
linkInitialized_i : in std_logic;
|
linkInitialized_i : in std_logic;
|
Line 573... |
Line 619... |
|
|
-- Port output interface.
|
-- Port output interface.
|
portInitialized_i : in std_logic;
|
portInitialized_i : in std_logic;
|
txFull_i : in std_logic;
|
txFull_i : in std_logic;
|
txWrite_o : out std_logic;
|
txWrite_o : out std_logic;
|
txType_o : out std_logic_vector(2*NUMBER_WORDS-1 downto 0);
|
txType_o : out std_logic_vector(1 downto 0);
|
txData_o : out std_logic_vector(32*NUMBER_WORDS-1 downto 0);
|
txData_o : out std_logic_vector(31 downto 0);
|
|
|
-- Control symbols aimed to the transmitter.
|
-- Control symbols aimed to the transmitter.
|
txControlEmpty_i : in std_logic;
|
txControlEmpty_i : in std_logic;
|
txControlSymbol_i : in std_logic_vector(13*NUMBER_WORDS-1 downto 0);
|
txControlSymbol_i : in std_logic_vector(12 downto 0);
|
txControlUpdate_o : out std_logic;
|
txControlUpdate_o : out std_logic;
|
|
|
-- Control symbols from the receiver to send.
|
-- Control symbols from the receiver to send.
|
rxControlEmpty_i : in std_logic;
|
rxControlEmpty_i : in std_logic;
|
rxControlSymbol_i : in std_logic_vector(13*NUMBER_WORDS-1 downto 0);
|
rxControlSymbol_i : in std_logic_vector(12 downto 0);
|
rxControlUpdate_o : out std_logic;
|
rxControlUpdate_o : out std_logic;
|
|
|
-- Internal signalling from the receiver part.
|
-- Internal signalling from the receiver part.
|
linkInitialized_o : out std_logic;
|
linkInitialized_o : out std_logic;
|
linkInitialized_i : in std_logic;
|
linkInitialized_i : in std_logic;
|
ackIdStatus_i : in std_logic_vector(4 downto 0);
|
ackIdStatus_i : in std_logic_vector(4 downto 0);
|
|
|
-- Internal core variables for cascading.
|
-- Timeout signals.
|
timeSentSet_o : out std_logic;
|
timeSentSet_o : out std_logic;
|
timeSentReset_o : out std_logic;
|
timeSentReset_o : out std_logic;
|
timeSentExpired_i : in std_logic;
|
timeSentExpired_i : in std_logic;
|
operational_i : in std_logic;
|
|
operational_o : out std_logic;
|
-- Internal core variables for cascading.
|
ackId_i : in std_logic_vector(4 downto 0);
|
frameLock_i : in std_logic;
|
ackId_o : out std_logic_vector(4 downto 0);
|
frameLock_o : out std_logic;
|
bufferStatus_i : in std_logic_vector(4 downto 0);
|
internalState_i : in TxInternalType;
|
bufferStatus_o : out std_logic_vector(4 downto 0);
|
internalState_o : out TxInternalType;
|
statusReceived_i : in std_logic;
|
|
statusReceived_o : out std_logic;
|
|
numberSentLinkRequests_i : in std_logic_vector(1 downto 0);
|
|
numberSentLinkRequests_o : out std_logic_vector(1 downto 0);
|
|
outputErrorStopped_i : in std_logic;
|
|
outputErrorStopped_o : out std_logic;
|
|
fatalError_i : in std_logic;
|
|
fatalError_o : out std_logic;
|
|
recoverActive_i : in std_logic;
|
|
recoverActive_o : out std_logic;
|
|
recoverCounter_i : in std_logic_vector(4 downto 0);
|
|
recoverCounter_o : out std_logic_vector(4 downto 0);
|
|
ackIdWindow_i : in std_logic_vector(4 downto 0);
|
|
ackIdWindow_o : out std_logic_vector(4 downto 0);
|
|
frameState_i : in std_logic_vector(3 downto 0);
|
|
frameState_o : out std_logic_vector(3 downto 0);
|
|
frameWordCounter_i : in std_logic_vector(1 downto 0);
|
|
frameWordCounter_o : out std_logic_vector(1 downto 0);
|
|
frameContent_i : in std_logic_vector(63 downto 0);
|
|
frameContent_o : out std_logic_vector(63 downto 0);
|
|
counter_i : in std_logic_vector(3 downto 0);
|
|
counter_o : out std_logic_vector(3 downto 0);
|
|
symbolsTransmitted_i : in std_logic_vector(7 downto 0);
|
|
symbolsTransmitted_o : out std_logic_vector(7 downto 0);
|
|
maintenanceClass_i : in std_logic;
|
|
maintenanceClass_o : out std_logic;
|
|
|
|
-- Frame buffer interface.
|
-- Frame buffer interface.
|
readFrameEmpty_i : in std_logic;
|
readFrameEmpty_i : in std_logic;
|
readFrame_o : out std_logic;
|
readFrame_o : out std_logic;
|
readFrameRestart_o : out std_logic;
|
readFrameRestart_o : out std_logic;
|
Line 670... |
Line 690... |
signal timeSentEnable : std_logic;
|
signal timeSentEnable : std_logic;
|
signal timeSentWriteAddress : std_logic_vector(4 downto 0);
|
signal timeSentWriteAddress : std_logic_vector(4 downto 0);
|
signal timeSentReadAddress : std_logic_vector(4 downto 0);
|
signal timeSentReadAddress : std_logic_vector(4 downto 0);
|
signal timeSentReadData : std_logic_vector(TIMEOUT_WIDTH downto 0);
|
signal timeSentReadData : std_logic_vector(TIMEOUT_WIDTH downto 0);
|
|
|
signal operationalCurrent, operationalNext : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal frameLock : std_logic_vector(NUMBER_WORDS downto 0);
|
signal ackIdCurrent, ackIdNext : std_logic_vector(5*NUMBER_WORDS-1 downto 0);
|
|
signal bufferStatusCurrent, bufferStatusNext : std_logic_vector(5*NUMBER_WORDS-1 downto 0);
|
signal internalStateCurrent, internalStateNext : TxInternalType;
|
signal statusReceivedCurrent, statusReceivedNext : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal internalState : TxInternalArrayType(NUMBER_WORDS downto 0);
|
signal numberSentLinkRequestsCurrent, numberSentLinkRequestsNext : std_logic_vector(2*NUMBER_WORDS-1 downto 0);
|
|
signal outputErrorStoppedCurrent, outputErrorStoppedNext : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
|
signal fatalErrorCurrent, fatalErrorNext : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
|
signal recoverActiveCurrent, recoverActiveNext : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
|
signal recoverCounterCurrent, recoverCounterNext : std_logic_vector(5*NUMBER_WORDS-1 downto 0);
|
|
signal ackIdWindowCurrent, ackIdWindowNext : std_logic_vector(5*NUMBER_WORDS-1 downto 0);
|
|
signal frameStateCurrent, frameStateNext : std_logic_vector(4*NUMBER_WORDS-1 downto 0);
|
|
signal frameWordCounterCurrent, frameWordCounterNext : std_logic_vector(2*NUMBER_WORDS-1 downto 0);
|
|
signal frameContentCurrent, frameContentNext : std_logic_vector(64*NUMBER_WORDS-1 downto 0);
|
|
signal counterCurrent, counterNext : std_logic_vector(4*NUMBER_WORDS-1 downto 0);
|
|
signal symbolsTransmittedCurrent, symbolsTransmittedNext : std_logic_vector(8*NUMBER_WORDS-1 downto 0);
|
|
signal maintenanceClassCurrent, maintenanceClassNext : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
|
|
|
signal readFrame : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal readFrame : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal readFrameRestart : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal readFrameRestart : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal readWindowReset : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal readWindowReset : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal readWindowNext : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal readWindowNext : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
Line 752... |
Line 760... |
end process;
|
end process;
|
|
|
timeSentExpired <= timeSentDelta(TIMEOUT_WIDTH);
|
timeSentExpired <= timeSentDelta(TIMEOUT_WIDTH);
|
|
|
timeSentEnable <= (not txFull_i) and (timeSentSet or timeSentReset);
|
timeSentEnable <= (not txFull_i) and (timeSentSet or timeSentReset);
|
timeSentWriteAddress <= ackIdWindowCurrent when timeSentSet = '1' else
|
timeSentWriteAddress <= (others=>'0');
|
ackIdCurrent;
|
timeSentReadAddress <= (others=>'0');
|
timeSentReadAddress <= ackIdCurrent;
|
-- REMARK: Fix this...
|
|
--timeSentWriteAddress <= ackIdWindowCurrent when timeSentSet = '1' else ackIdCurrent;
|
|
--timeSentReadAddress <= ackIdCurrent;
|
|
|
TimeoutMemory: MemorySimpleDualPortAsync
|
TimeoutMemory: MemorySimpleDualPortAsync
|
generic map(ADDRESS_WIDTH=>5, DATA_WIDTH=>TIMEOUT_WIDTH+1, INIT_VALUE=>'0')
|
generic map(ADDRESS_WIDTH=>5, DATA_WIDTH=>TIMEOUT_WIDTH+1, INIT_VALUE=>'0')
|
port map(
|
port map(
|
clkA_i=>clk, enableA_i=>timeSentEnable,
|
clkA_i=>clk, enableA_i=>timeSentEnable,
|
Line 769... |
Line 779... |
-- Protocol core and synchronization.
|
-- Protocol core and synchronization.
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
process(areset_n, clk)
|
process(areset_n, clk)
|
begin
|
begin
|
if (areset_n = '0') then
|
if (areset_n = '0') then
|
operationalCurrent <= (others=>'0');
|
internalStateCurrent <= (operational=>'0',
|
ackIdCurrent <= (others=>'0');
|
ackId=>(others=>'0'),
|
bufferStatusCurrent <= (others=>'0');
|
bufferStatus=>(others=>'0'),
|
statusReceivedCurrent <= (others=>'0');
|
statusReceived=>'0',
|
numberSentLinkRequestsCurrent <= (others=>'0');
|
numberSentLinkRequests=>(others=>'0'),
|
outputErrorStoppedCurrent <= (others=>'0');
|
outputErrorStopped=>'0',
|
fatalErrorCurrent <= (others=>'0');
|
fatalError=>'0',
|
recoverActiveCurrent <= (others=>'0');
|
recoverActive=>'0',
|
recoverCounterCurrent <= (others=>'0');
|
recoverCounter=>(others=>'0'),
|
ackIdWindowCurrent <= (others=>'0');
|
ackIdWindow=>(others=>'0'),
|
frameStateCurrent <= (others=>'0');
|
frameState=>(others=>'0'),
|
frameWordCounterCurrent <= (others=>'0');
|
frameWordCounter=>(others=>'0'),
|
frameContentCurrent <= (others=>'0');
|
frameContent=>(others=>'0'),
|
counterCurrent <= (others=>'0');
|
counter=>(others=>'0'),
|
symbolsTransmittedCurrent <= (others=>'0');
|
symbolsTransmitted=>(others=>'0'),
|
maintenanceClassCurrent <= (others=>'0');
|
maintenanceClass=>'0');
|
elsif (clk'event and clk = '1') then
|
elsif (clk'event and clk = '1') then
|
if (txFull_i = '0') then
|
if (txFull_i = '0') then
|
operationalCurrent <= operationalNext;
|
internalStateCurrent <= internalStateNext;
|
ackIdCurrent <= ackIdNext;
|
|
bufferStatusCurrent <= bufferStatusNext;
|
|
statusReceivedCurrent <= statusReceivedNext;
|
|
numberSentLinkRequestsCurrent <= numberSentLinkRequestsNext;
|
|
outputErrorStoppedCurrent <= outputErrorStoppedNext;
|
|
fatalErrorCurrent <= fatalErrorNext;
|
|
recoverActiveCurrent <= recoverActiveNext;
|
|
recoverCounterCurrent <= recoverCounterNext;
|
|
ackIdWindowCurrent <= ackIdWindowNext;
|
|
frameStateCurrent <= frameStateNext;
|
|
frameWordCounterCurrent <= frameWordCounterNext;
|
|
frameContentCurrent <= frameContentNext;
|
|
counterCurrent <= counterNext;
|
|
symbolsTransmittedCurrent <= symbolsTransmittedNext;
|
|
maintenanceClassCurrent <= maintenanceClassNext;
|
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
|
frameLock(0) <= '0';
|
|
internalState(0) <= internalStateCurrent;
|
|
internalStateNext <= internalState(NUMBER_WORDS);
|
CoreGeneration: for i in 0 to NUMBER_WORDS-1 generate
|
CoreGeneration: for i in 0 to NUMBER_WORDS-1 generate
|
TxCore: RioTransmitterCore
|
TxCore: RioTransmitterCore
|
generic map(NUMBER_WORDS=>NUMBER_WORDS)
|
generic map(NUMBER_WORDS=>NUMBER_WORDS)
|
port map(
|
port map(
|
clk=>clk, areset_n=>areset_n,
|
clk=>clk, areset_n=>areset_n,
|
portEnable_i=>portEnable_i,
|
portEnable_i=>portEnable_i,
|
portInitialized_i=>portInitialized_i,
|
portInitialized_i=>portInitialized_i,
|
txFull_i=>txFull_i,
|
txFull_i=>txFull_i,
|
txWrite_o=>txWrite_o,
|
txWrite_o=>txWrite_o,
|
txType_o=>txType_o,
|
txType_o=>txType_o(2*(i+1)-1 downto 2*i),
|
txData_o=>txData_o,
|
txData_o=>txData_o(32*(i+1)-1 downto 32*i),
|
txControlEmpty_i=>txControlEmpty_i(i),
|
txControlEmpty_i=>txControlEmpty_i(i),
|
txControlSymbol_i=>txControlSymbol_i(13*(i+1)-1 downto 13*i),
|
txControlSymbol_i=>txControlSymbol_i(13*(i+1)-1 downto 13*i),
|
txControlUpdate_o=>txControlUpdate_o(i),
|
txControlUpdate_o=>txControlUpdate_o(i),
|
rxControlEmpty_i=>rxControlEmpty_i(i),
|
rxControlEmpty_i=>rxControlEmpty_i(i),
|
rxControlSymbol_i=>rxControlSymbol_i(13*(i+1)-1 downto 13*i),
|
rxControlSymbol_i=>rxControlSymbol_i(13*(i+1)-1 downto 13*i),
|
Line 830... |
Line 828... |
linkInitialized_i=>linkInitialized_i,
|
linkInitialized_i=>linkInitialized_i,
|
ackIdStatus_i=>ackIdStatus_i,
|
ackIdStatus_i=>ackIdStatus_i,
|
timeSentSet_o=>timeSentSet,
|
timeSentSet_o=>timeSentSet,
|
timeSentReset_o=>timeSentReset,
|
timeSentReset_o=>timeSentReset,
|
timeSentExpired_i=>timeSentExpired,
|
timeSentExpired_i=>timeSentExpired,
|
operational_i=>operationalCurrent(i),
|
frameLock_i=>frameLock(i),
|
operational_o=>operationalNext(i),
|
frameLock_o=>frameLock(i+1),
|
ackId_i=>ackIdCurrent(5*(i+1)-1 downto 5*i),
|
internalState_i=>internalState(i),
|
ackId_o=>ackIdNext(5*(i+1)-1 downto 5*i),
|
internalState_o=>internalState(i+1),
|
bufferStatus_i=>bufferStatusCurrent(5*(i+1)-1 downto 5*i),
|
|
bufferStatus_o=>bufferStatusNext(5*(i+1)-1 downto 5*i),
|
|
statusReceived_i=>statusReceivedCurrent(i),
|
|
statusReceived_o=>statusReceivedNext(i),
|
|
numberSentLinkRequests_i=>numberSentLinkRequestsCurrent(2*(i+1)-1 downto 2*i),
|
|
numberSentLinkRequests_o=>numberSentLinkRequestsNext(2*(i+1)-1 downto 2*i),
|
|
outputErrorStopped_i=>outputErrorStoppedCurrent(i),
|
|
outputErrorStopped_o=>outputErrorStoppedNext(i),
|
|
fatalError_i=>fatalErrorCurrent(i),
|
|
fatalError_o=>fatalErrorNext(i),
|
|
recoverActive_i=>recoverActiveCurrent(i),
|
|
recoverActive_o=>recoverActiveNext(i),
|
|
recoverCounter_i=>recoverCounterCurrent(5*(i+1)-1 downto 5*i),
|
|
recoverCounter_o=>recoverCounterNext(5*(i+1)-1 downto 5*i),
|
|
ackIdWindow_i=>ackIdWindowCurrent(5*(i+1)-1 downto 5*i),
|
|
ackIdWindow_o=>ackIdWindowNext(5*(i+1)-1 downto 5*i),
|
|
frameState_i=>frameStateCurrent(4*(i+1)-1 downto 4*i),
|
|
frameState_o=>frameStateNext(4*(i+1)-1 downto 4*i),
|
|
frameWordCounter_i=>frameWordCounterCurrent(2*(i+1)-1 downto 2*i),
|
|
frameWordCounter_o=>frameWordCounterNext(2*(i+1)-1 downto 2*i),
|
|
frameContent_i=>frameContentCurrent(64*(i+1)-1 downto 64*i),
|
|
frameContent_o=>frameContentNext(64*(i+1)-1 downto 64*i),
|
|
counter_i=>counterCurrent(4*(i+1)-1 downto 4*i),
|
|
counter_o=>counterNext(4*(i+1)-1 downto 4*i),
|
|
symbolsTransmitted_i=>symbolsTransmittedCurrent(8*(i+1)-1 downto 8*i),
|
|
symbolsTransmitted_o=>symbolsTransmittedNext(8*(i+1)-1 downto 8*i),
|
|
maintenanceClass_i=>maintenanceClassCurrent(i),
|
|
maintenanceClass_o=>maintenanceClassNext(i),
|
|
readFrameEmpty_i=>readFrameEmpty_i,
|
readFrameEmpty_i=>readFrameEmpty_i,
|
readFrame_o=>readFrame(i),
|
readFrame_o=>readFrame(i),
|
readFrameRestart_o=>readFrameRestart(i),
|
readFrameRestart_o=>readFrameRestart(i),
|
readFrameAborted_i=>readFrameAborted_i,
|
readFrameAborted_i=>readFrameAborted_i,
|
readWindowEmpty_i=>readWindowEmpty_i,
|
readWindowEmpty_i=>readWindowEmpty_i,
|
Line 887... |
Line 857... |
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
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;
|
use work.rio_common.all;
|
use work.rio_common.all;
|
|
use work.rioserial_common.all;
|
|
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
-- Entity for RioTransmitterCore.
|
-- Entity for RioTransmitterCore.
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
entity RioTransmitterCore is
|
entity RioTransmitterCore is
|
Line 906... |
Line 877... |
|
|
-- Port output interface.
|
-- Port output interface.
|
portInitialized_i : in std_logic;
|
portInitialized_i : in std_logic;
|
txFull_i : in std_logic;
|
txFull_i : in std_logic;
|
txWrite_o : out std_logic;
|
txWrite_o : out std_logic;
|
txType_o : out std_logic_vector(2*NUMBER_WORDS-1 downto 0);
|
txType_o : out std_logic_vector(1 downto 0);
|
txData_o : out std_logic_vector(32*NUMBER_WORDS-1 downto 0);
|
txData_o : out std_logic_vector(31 downto 0);
|
|
|
-- Control symbols aimed to the transmitter.
|
-- Control symbols aimed to the transmitter.
|
txControlEmpty_i : in std_logic;
|
txControlEmpty_i : in std_logic;
|
txControlSymbol_i : in std_logic_vector(13*NUMBER_WORDS-1 downto 0);
|
txControlSymbol_i : in std_logic_vector(12 downto 0);
|
txControlUpdate_o : out std_logic;
|
txControlUpdate_o : out std_logic;
|
|
|
-- Control symbols from the receiver to send.
|
-- Control symbols from the receiver to send.
|
rxControlEmpty_i : in std_logic;
|
rxControlEmpty_i : in std_logic;
|
rxControlSymbol_i : in std_logic_vector(13*NUMBER_WORDS-1 downto 0);
|
rxControlSymbol_i : in std_logic_vector(12 downto 0);
|
rxControlUpdate_o : out std_logic;
|
rxControlUpdate_o : out std_logic;
|
|
|
-- Internal signalling from the receiver part.
|
-- Internal signalling from the receiver part.
|
linkInitialized_o : out std_logic;
|
linkInitialized_o : out std_logic;
|
linkInitialized_i : in std_logic;
|
linkInitialized_i : in std_logic;
|
Line 930... |
Line 901... |
timeSentSet_o : out std_logic;
|
timeSentSet_o : out std_logic;
|
timeSentReset_o : out std_logic;
|
timeSentReset_o : out std_logic;
|
timeSentExpired_i : in std_logic;
|
timeSentExpired_i : in std_logic;
|
|
|
-- Internal core variables for cascading.
|
-- Internal core variables for cascading.
|
operational_i : in std_logic;
|
frameLock_i : in std_logic;
|
operational_o : out std_logic;
|
frameLock_o : out std_logic;
|
ackId_i : in std_logic_vector(4 downto 0);
|
internalState_i : in TxInternalType;
|
ackId_o : out std_logic_vector(4 downto 0);
|
internalState_o : out TxInternalType;
|
bufferStatus_i : in std_logic_vector(4 downto 0);
|
|
bufferStatus_o : out std_logic_vector(4 downto 0);
|
|
statusReceived_i : in std_logic;
|
|
statusReceived_o : out std_logic;
|
|
numberSentLinkRequests_i : in std_logic_vector(1 downto 0);
|
|
numberSentLinkRequests_o : out std_logic_vector(1 downto 0);
|
|
outputErrorStopped_i : in std_logic;
|
|
outputErrorStopped_o : out std_logic;
|
|
fatalError_i : in std_logic;
|
|
fatalError_o : out std_logic;
|
|
recoverActive_i : in std_logic;
|
|
recoverActive_o : out std_logic;
|
|
recoverCounter_i : in std_logic_vector(4 downto 0);
|
|
recoverCounter_o : out std_logic_vector(4 downto 0);
|
|
ackIdWindow_i : in std_logic_vector(4 downto 0);
|
|
ackIdWindow_o : out std_logic_vector(4 downto 0);
|
|
frameState_i : in std_logic_vector(3 downto 0);
|
|
frameState_o : out std_logic_vector(3 downto 0);
|
|
frameWordCounter_i : in std_logic_vector(1 downto 0);
|
|
frameWordCounter_o : out std_logic_vector(1 downto 0);
|
|
frameContent_i : in std_logic_vector(63 downto 0);
|
|
frameContent_o : out std_logic_vector(63 downto 0);
|
|
counter_i : in std_logic_vector(3 downto 0);
|
|
counter_o : out std_logic_vector(3 downto 0);
|
|
symbolsTransmitted_i : in std_logic_vector(7 downto 0);
|
|
symbolsTransmitted_o : out std_logic_vector(7 downto 0);
|
|
maintenanceClass_i : in std_logic;
|
|
maintenanceClass_o : out std_logic;
|
|
|
|
-- Frame buffer interface.
|
-- Frame buffer interface.
|
readFrameEmpty_i : in std_logic;
|
readFrameEmpty_i : in std_logic;
|
readFrame_o : out std_logic;
|
readFrame_o : out std_logic;
|
readFrameRestart_o : out std_logic;
|
readFrameRestart_o : out std_logic;
|
Line 1043... |
Line 986... |
signal rxControlParameter0 : std_logic_vector(4 downto 0);
|
signal rxControlParameter0 : std_logic_vector(4 downto 0);
|
signal rxControlParameter1 : std_logic_vector(4 downto 0);
|
signal rxControlParameter1 : std_logic_vector(4 downto 0);
|
|
|
begin
|
begin
|
|
|
linkInitialized_o <= operational_i;
|
|
|
linkInitialized_o <= internalState_i.operational;
|
|
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
-- Assign control symbol from fifo signals.
|
-- Assign control symbol from fifo signals.
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
|
|
Line 1059... |
Line 1003... |
rxControlParameter0 <= rxControlSymbol_i(9 downto 5);
|
rxControlParameter0 <= rxControlSymbol_i(9 downto 5);
|
rxControlParameter1 <= rxControlSymbol_i(4 downto 0);
|
rxControlParameter1 <= rxControlSymbol_i(4 downto 0);
|
|
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
-- First pipeline stage.
|
-- First pipeline stage.
|
-- Receive stuff from link-partner and timeout supervision.
|
-- Receive control-symbols from link-partner and supervise timeouts.
|
-- Input: ackId, ackIdWindow, timeoutExpired
|
-- Input: ackId, ackIdWindow, timeoutExpired
|
-- Output: sendLinkRequest, sendRestartFromRetry, ackId,
|
-- Output: sendLinkRequest, sendRestartFromRetry, ackId,
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
|
|
txControlUpdate_o <= txControlUpdateOut and (not txFull_i);
|
txControlUpdate_o <= txControlUpdateOut and (not txFull_i);
|
|
|
|
-- REMARK: Use this to be able to use a synchronous memory in the fifo to
|
|
-- enhance the timing... What to do with the rxSymbol???
|
|
--txControlRead_o <= txControlRead;
|
|
--process(clk, areset_n)
|
|
--begin
|
|
-- if (areset_n = '0') then
|
|
-- txControlRead <= '0';
|
|
-- txControlValid <= '0';
|
|
-- elsif (clk'event and clk = '1') then
|
|
-- if (txFull_i = '0') then
|
|
-- txControlRead <= not txControlEmpty_i;
|
|
-- txControlValid <= txControlRead;
|
|
-- end if;
|
|
-- end if;
|
|
--end process;
|
|
|
process(clk, areset_n)
|
process(clk, areset_n)
|
begin
|
begin
|
if (areset_n = '0') then
|
if (areset_n = '0') then
|
readFrame_o <= '0';
|
readFrame_o <= '0';
|
|
|
Line 1085... |
Line 1045... |
sendLinkRequest <= sendLinkRequestOut;
|
sendLinkRequest <= sendLinkRequestOut;
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
process(outputErrorStopped_i, recoverActive_i, recoverCounter_i,
|
process(internalState_i,
|
ackId_i, ackIdWindow_i, bufferStatus_i, statusReceived_i,
|
|
numberSentLinkRequests_i,
|
|
operational_i,
|
|
txControlEmpty_i, txControlStype0,
|
txControlEmpty_i, txControlStype0,
|
txControlParameter0, txControlParameter1,
|
txControlParameter0, txControlParameter1,
|
timeSentExpired_i,
|
timeSentExpired_i)
|
fatalError_i)
|
|
begin
|
begin
|
outputErrorStopped_o <= outputErrorStopped_i;
|
internalState_o.outputErrorStopped <= internalState_i.outputErrorStopped;
|
fatalError_o <= fatalError_i;
|
internalState_o.fatalError <= internalState_i.fatalError;
|
recoverActive_o <= recoverActive_i;
|
internalState_o.recoverActive <= internalState_i.recoverActive;
|
recoverCounter_o <= recoverCounter_i;
|
internalState_o.recoverCounter <= internalState_i.recoverCounter;
|
ackId_o <= ackId_i;
|
internalState_o.ackId <= internalState_i.ackId;
|
bufferStatus_o <= bufferStatus_i;
|
internalState_o.bufferStatus <= internalState_i.bufferStatus;
|
statusReceived_o <= statusReceived_i;
|
internalState_o.statusReceived <= internalState_i.statusReceived;
|
numberSentLinkRequests_o <= numberSentLinkRequests_i;
|
internalState_o.numberSentLinkRequests <= internalState_i.numberSentLinkRequests;
|
|
|
timeSentReset_o <= '0';
|
timeSentReset_o <= '0';
|
txControlUpdateOut <= '0';
|
txControlUpdateOut <= '0';
|
readFrameOut <= '0';
|
readFrameOut <= '0';
|
|
|
sendRestartFromRetryOut <= '0';
|
sendRestartFromRetryOut <= '0';
|
sendLinkRequestOut <= '0';
|
sendLinkRequestOut <= '0';
|
|
|
if (fatalError_i = '1') then
|
if (internalState_i.fatalError = '1') then
|
outputErrorStopped_o <= '0';
|
internalState_o.outputErrorStopped <= '0';
|
fatalError_o <= '0';
|
internalState_o.fatalError <= '0';
|
elsif (recoverActive_i = '1') then
|
elsif (internalState_i.recoverActive = '1') then
|
if (ackId_i /= recoverCounter_i) then
|
if (internalState_i.ackId /= internalState_i.recoverCounter) then
|
ackId_o <= std_logic_vector(unsigned(ackId_i) + 1);
|
internalState_o.ackId <= std_logic_vector(unsigned(internalState_i.ackId) + 1);
|
readFrameOut <= '1';
|
readFrameOut <= '1';
|
else
|
else
|
recoverActive_o <= '0';
|
internalState_o.recoverActive <= '0';
|
outputErrorStopped_o <= '0';
|
internalState_o.outputErrorStopped <= '0';
|
end if;
|
end if;
|
else
|
else
|
if (operational_i = '0') then
|
if (internalState_i.operational = '0') then
|
-- Not operational mode.
|
-- Not operational mode.
|
|
|
-- Check if any new symbol has been received from the link-partner.
|
-- Check if any new symbol has been received from the link-partner.
|
if (txControlEmpty_i = '0') then
|
if (txControlEmpty_i = '0') then
|
-- New symbol from link-partner.
|
-- New symbol from link-partner.
|
|
|
-- Check if the symbol is a status-control-symbol.
|
-- Check if the symbol is a status-control-symbol.
|
if (txControlStype0 = STYPE0_STATUS) then
|
if (txControlStype0 = STYPE0_STATUS) then
|
-- A status-control symbol has been received.
|
-- A status-control symbol has been received.
|
-- Update variables from the input status control symbol.
|
-- Update variables from the input status control symbol.
|
ackId_o <= txControlParameter0;
|
internalState_o.ackId <= txControlParameter0;
|
bufferStatus_o <= txControlParameter1;
|
internalState_o.bufferStatus <= txControlParameter1;
|
outputErrorStopped_o <= '0';
|
internalState_o.outputErrorStopped <= '0';
|
statusReceived_o <= '1';
|
internalState_o.statusReceived <= '1';
|
else
|
else
|
-- Discard all other received symbols in this state.
|
-- Discard all other received symbols in this state.
|
end if;
|
end if;
|
txControlUpdateOut <= '1';
|
txControlUpdateOut <= '1';
|
end if;
|
end if;
|
else
|
else
|
-- Operational mode.
|
-- Operational mode.
|
|
|
-- Make sure to reset the status received flag.
|
-- Make sure to reset the status received flag.
|
statusReceived_o <= '0';
|
internalState_o.statusReceived <= '0';
|
|
|
-- Check if the oldest frame timeout has expired.
|
-- Check if the oldest frame timeout has expired.
|
if ((ackId_i /= ackIdWindow_i) and
|
if ((internalState_i.ackId /= internalState_i.ackIdWindow) and
|
(timeSentExpired_i = '1')) then
|
(timeSentExpired_i = '1')) then
|
-- There has been a timeout on a transmitted frame.
|
-- There has been a timeout on a transmitted frame.
|
|
|
-- Reset the timeout to expire when the transmitted link-request has
|
-- Reset the timeout to expire when the transmitted link-request has
|
-- timed out instead.
|
-- timed out instead.
|
timeSentReset_o <= '1';
|
timeSentReset_o <= '1';
|
|
|
-- Check if we are in the output-error-stopped state.
|
-- Check if we are in the output-error-stopped state.
|
if (outputErrorStopped_i = '1') then
|
if (internalState_i.outputErrorStopped = '1') then
|
-- In the output-error-stopped state.
|
-- In the output-error-stopped state.
|
|
|
-- Count the number of link-requests that has been sent and abort if
|
-- Count the number of link-requests that has been sent and abort if
|
-- there has been no reply for too many times.
|
-- there has been no reply for too many times.
|
if (unsigned(numberSentLinkRequests_i) /= 0) then
|
if (unsigned(internalState_i.numberSentLinkRequests) /= 0) then
|
-- Not sent link-request too many times.
|
-- Not sent link-request too many times.
|
-- Send another link-request.
|
-- Send another link-request.
|
sendLinkRequestOut <= '1';
|
sendLinkRequestOut <= '1';
|
numberSentLinkRequests_o <= std_logic_vector(unsigned(numberSentLinkRequests_i) - 1);
|
internalState_o.numberSentLinkRequests <= std_logic_vector(unsigned(internalState_i.numberSentLinkRequests) - 1);
|
else
|
else
|
-- No response for too many times.
|
-- No response for too many times.
|
-- Indicate that a fatal error has occurred.
|
-- Indicate that a fatal error has occurred.
|
fatalError_o <= '1';
|
internalState_o.fatalError <= '1';
|
end if;
|
end if;
|
else
|
else
|
-- Not in output-error-stopped and there is a timeout.
|
-- Not in output-error-stopped and there is a timeout.
|
-- Enter output-error-stopped state and send a link-request.
|
-- Enter output-error-stopped state and send a link-request.
|
sendLinkRequestOut <= '1';
|
sendLinkRequestOut <= '1';
|
numberSentLinkRequests_o <= NUMBER_LINK_RESPONSE_RETRIES;
|
internalState_o.numberSentLinkRequests <= NUMBER_LINK_RESPONSE_RETRIES;
|
outputErrorStopped_o <= '1';
|
internalState_o.outputErrorStopped <= '1';
|
end if;
|
end if;
|
else
|
else
|
-- There has been no timeout.
|
-- There has been no timeout.
|
|
|
-- Check if any control symbol has been received from the link
|
-- Check if any control symbol has been received from the link
|
Line 1192... |
Line 1148... |
|
|
-- Check the received control symbol.
|
-- Check the received control symbol.
|
case txControlStype0 is
|
case txControlStype0 is
|
|
|
when STYPE0_STATUS =>
|
when STYPE0_STATUS =>
|
if (outputErrorStopped_i = '0') then
|
if (internalState_i.outputErrorStopped = '0') then
|
-- Save the number of buffers in the link partner.
|
-- Save the number of buffers in the link partner.
|
bufferStatus_o <= txControlParameter1;
|
internalState_o.bufferStatus <= txControlParameter1;
|
end if;
|
end if;
|
|
|
when STYPE0_PACKET_ACCEPTED =>
|
when STYPE0_PACKET_ACCEPTED =>
|
-- The link partner is accepting a frame.
|
-- The link partner is accepting a frame.
|
|
|
if (outputErrorStopped_i = '0') then
|
if (internalState_i.outputErrorStopped = '0') then
|
-- Save the number of buffers in the link partner.
|
-- Save the number of buffers in the link partner.
|
bufferStatus_o <= txControlParameter1;
|
internalState_o.bufferStatus <= txControlParameter1;
|
|
|
-- Check if expecting this type of reply and that the ackId is
|
-- Check if expecting this type of reply and that the ackId is
|
-- expected.
|
-- expected.
|
if ((ackId_i /= ackIdWindow_i) and
|
if ((internalState_i.ackId /= internalState_i.ackIdWindow) and
|
(ackId_i = txControlParameter0)) then
|
(internalState_i.ackId = txControlParameter0)) then
|
-- The packet-accepted is expected and the ackId is the expected.
|
-- The packet-accepted is expected and the ackId is the expected.
|
-- The frame has been accepted by the link partner.
|
-- The frame has been accepted by the link partner.
|
|
|
-- Update to a new buffer and increment the ackId.
|
-- Update to a new buffer and increment the ackId.
|
readFrameOut <= '1';
|
readFrameOut <= '1';
|
ackId_o <= std_logic_vector(unsigned(ackId_i) + 1);
|
internalState_o.ackId <= std_logic_vector(unsigned(internalState_i.ackId) + 1);
|
else
|
else
|
-- Unexpected packet-accepted or packet-accepted for
|
-- Unexpected packet-accepted or packet-accepted for
|
-- unexpected ackId.
|
-- unexpected ackId.
|
sendLinkRequestOut <= '1';
|
sendLinkRequestOut <= '1';
|
numberSentLinkRequests_o <= NUMBER_LINK_RESPONSE_RETRIES;
|
internalState_o.numberSentLinkRequests <= NUMBER_LINK_RESPONSE_RETRIES;
|
outputErrorStopped_o <= '1';
|
internalState_o.outputErrorStopped <= '1';
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
when STYPE0_PACKET_RETRY =>
|
when STYPE0_PACKET_RETRY =>
|
-- The link partner has asked for a frame retransmission.
|
-- The link partner has asked for a frame retransmission.
|
|
|
if (outputErrorStopped_i = '0') then
|
if (internalState_i.outputErrorStopped = '0') then
|
-- Save the number of buffers in the link partner.
|
-- Save the number of buffers in the link partner.
|
bufferStatus_o <= txControlParameter1;
|
internalState_o.bufferStatus <= txControlParameter1;
|
|
|
-- Check if the ackId is the one expected.
|
-- Check if the ackId is the one expected.
|
if (ackId_i = txControlParameter0) then
|
if (internalState_i.ackId = txControlParameter0) then
|
-- The ackId to retry is expected.
|
-- The ackId to retry is expected.
|
-- Go to the output-retry-stopped state.
|
-- Go to the output-retry-stopped state.
|
-- Note that the output-retry-stopped state is equivalent
|
-- Note that the output-retry-stopped state is equivalent
|
-- to sending a restart-from-retry.
|
-- to sending a restart-from-retry.
|
sendRestartFromRetryOut <= '1';
|
sendRestartFromRetryOut <= '1';
|
else
|
else
|
-- Unexpected ackId to retry.
|
-- Unexpected ackId to retry.
|
sendLinkRequestOut <= '1';
|
sendLinkRequestOut <= '1';
|
numberSentLinkRequests_o <= NUMBER_LINK_RESPONSE_RETRIES;
|
internalState_o.numberSentLinkRequests <= NUMBER_LINK_RESPONSE_RETRIES;
|
outputErrorStopped_o <= '1';
|
internalState_o.outputErrorStopped <= '1';
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
when STYPE0_PACKET_NOT_ACCEPTED =>
|
when STYPE0_PACKET_NOT_ACCEPTED =>
|
if (outputErrorStopped_i = '0') then
|
if (internalState_i.outputErrorStopped = '0') then
|
-- Packet was rejected by the link-partner.
|
-- Packet was rejected by the link-partner.
|
sendLinkRequestOut <= '1';
|
sendLinkRequestOut <= '1';
|
numberSentLinkRequests_o <= NUMBER_LINK_RESPONSE_RETRIES;
|
internalState_o.numberSentLinkRequests <= NUMBER_LINK_RESPONSE_RETRIES;
|
outputErrorStopped_o <= '1';
|
internalState_o.outputErrorStopped <= '1';
|
end if;
|
end if;
|
|
|
when STYPE0_LINK_RESPONSE =>
|
when STYPE0_LINK_RESPONSE =>
|
if (outputErrorStopped_i = '1') then
|
if (internalState_i.outputErrorStopped = '1') then
|
-- Check if the link partner return value is acceptable.
|
-- Check if the link partner return value is acceptable.
|
if ((unsigned(txControlParameter0) - unsigned(ackId_i)) <=
|
if ((unsigned(txControlParameter0) - unsigned(internalState_i.ackId)) <=
|
(unsigned(ackIdWindow_i) - unsigned(ackId_i))) then
|
(unsigned(internalState_i.ackIdWindow) - unsigned(internalState_i.ackId))) then
|
-- Recoverable error.
|
-- Recoverable error.
|
-- Use the received ackId and recover by removing packets
|
-- Use the received ackId and recover by removing packets
|
-- that has been received by the link-partner.
|
-- that has been received by the link-partner.
|
recoverCounter_o <= txControlParameter0;
|
internalState_o.recoverCounter <= txControlParameter0;
|
recoverActive_o <= '1';
|
internalState_o.recoverActive <= '1';
|
else
|
else
|
-- Totally out of sync.
|
-- Totally out of sync.
|
-- Indicate that a fatal error has occurred.
|
-- Indicate that a fatal error has occurred.
|
fatalError_o <= '1';
|
internalState_o.fatalError <= '1';
|
end if;
|
end if;
|
else
|
else
|
-- Dont expect or need a link-response in this state.
|
-- Dont expect or need a link-response in this state.
|
-- Discard it.
|
-- Discard it.
|
end if;
|
end if;
|
Line 1335... |
Line 1291... |
end if;
|
end if;
|
end process;
|
end process;
|
|
|
-- This process decide which stype1-part of a control symbols to send as well
|
-- This process decide which stype1-part of a control symbols to send as well
|
-- as all data symbols.
|
-- as all data symbols.
|
process(readWindowEmpty_i, bufferStatus_i,
|
process(readWindowEmpty_i,
|
recoverActive_i, ackId_i, operational_i, outputErrorStopped_i, portEnable_i, readContentData_i, readContentWords_i, readContentEnd_i,
|
internalState_i,
|
frameState_i, frameWordCounter_i, frameContent_i, maintenanceClass_i,
|
portEnable_i, readContentData_i, readContentWords_i, readContentEnd_i,
|
ackIdWindow_i,
|
sendRestartFromRetry, sendLinkRequest)
|
sendRestartFromRetry, sendLinkRequest,
|
|
fatalError_i)
|
|
begin
|
begin
|
readFrameRestartOut <= '0';
|
readFrameRestartOut <= '0';
|
readWindowResetOut <= '0';
|
readWindowResetOut <= '0';
|
readWindowNextOut <= '0';
|
readWindowNextOut <= '0';
|
readContentOut <= '0';
|
readContentOut <= '0';
|
|
|
frameState_o <= frameState_i;
|
frameLock_o <= frameLock_i;
|
frameWordCounter_o <= frameWordCounter_i;
|
|
frameContent_o <= frameContent_i;
|
internalState_o.frameState <= internalState_i.frameState;
|
ackIdWindow_o <= ackIdWindow_i;
|
internalState_o.frameWordCounter <= internalState_i.frameWordCounter;
|
maintenanceClass_o <= maintenanceClass_i;
|
internalState_o.frameContent <= internalState_i.frameContent;
|
|
internalState_o.ackIdWindow <= internalState_i.ackIdWindow;
|
|
internalState_o.maintenanceClass <= internalState_i.maintenanceClass;
|
|
|
timeSentSet_o <= '0';
|
timeSentSet_o <= '0';
|
|
|
symbolControlRestartOut <= '0';
|
symbolControlRestartOut <= '0';
|
symbolControlLinkRequestOut <= '0';
|
symbolControlLinkRequestOut <= '0';
|
symbolControlStartOut <= '0';
|
symbolControlStartOut <= '0';
|
symbolControlEndOut <= '0';
|
symbolControlEndOut <= '0';
|
symbolDataOut <= '0';
|
symbolDataOut <= '0';
|
symbolDataContentOut <= (others => '0');
|
symbolDataContentOut <= (others => '0');
|
|
|
if (fatalError_i = '1') then
|
if ((internalState_i.fatalError = '1') or (internalState_i.recoverActive = '1')) then
|
readWindowResetOut <= '1';
|
internalState_o.frameState <= FRAME_IDLE;
|
elsif (recoverActive_i = '1') then
|
internalState_o.ackIdWindow <= internalState_i.ackId;
|
ackIdWindow_o <= ackId_i;
|
|
frameState_o <= FRAME_IDLE;
|
|
readWindowResetOut <= '1';
|
readWindowResetOut <= '1';
|
else
|
else
|
if (operational_i = '0') then
|
if (internalState_i.operational = '0') then
|
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
-- This state is entered at startup. A port that is not initialized
|
-- This state is entered at startup. A port that is not initialized
|
-- should only transmit idle sequences.
|
-- should only transmit idle sequences.
|
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
|
|
-- Initialize framing before entering the operational state.
|
-- Initialize framing before entering the operational state.
|
frameState_o <= FRAME_IDLE;
|
internalState_o.frameState <= FRAME_IDLE;
|
ackIdWindow_o <= ackId_i;
|
internalState_o.ackIdWindow <= internalState_i.ackId;
|
readWindowResetOut <= '1';
|
readWindowResetOut <= '1';
|
else
|
else
|
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
-- This state is the operational state. It relays frames and handle
|
-- This state is the operational state. It relays frames and handle
|
-- flow control.
|
-- flow control.
|
Line 1395... |
Line 1349... |
-- Make sure there wont be any timeout before the frame is
|
-- Make sure there wont be any timeout before the frame is
|
-- starting to be retransmitted.
|
-- starting to be retransmitted.
|
timeSentSet_o <= '1';
|
timeSentSet_o <= '1';
|
|
|
-- Restart the frame transmission.
|
-- Restart the frame transmission.
|
ackIdWindow_o <= ackId_i;
|
internalState_o.ackIdWindow <= internalState_i.ackId;
|
frameState_o <= FRAME_IDLE;
|
internalState_o.frameState <= FRAME_IDLE;
|
readWindowResetOut <= '1';
|
readWindowResetOut <= '1';
|
end if;
|
end if;
|
|
|
if (sendLinkRequest = '1') then
|
if (sendLinkRequest = '1') then
|
-- Dont restart the packet transmission since we do not yet know which
|
-- Dont restart the packet transmission since we do not yet know which
|
Line 1412... |
Line 1366... |
-- Write the current timer value.
|
-- Write the current timer value.
|
timeSentSet_o <= '1';
|
timeSentSet_o <= '1';
|
end if;
|
end if;
|
|
|
if ((sendRestartFromRetry = '0') and (sendLinkRequest = '0') and
|
if ((sendRestartFromRetry = '0') and (sendLinkRequest = '0') and
|
(outputErrorStopped_i = '0')) then
|
(internalState_i.outputErrorStopped = '0')) then
|
-- Check if a frame transfer is in progress.
|
-- Check if a frame transfer is in progress.
|
-- REMARK: Hold any data symbol if there is a pending symbol from the
|
-- REMARK: Hold any data symbol if there is a pending symbol from the
|
-- receiver side...
|
-- receiver side...
|
case frameState_i is
|
case internalState_i.frameState is
|
|
|
when FRAME_IDLE =>
|
when FRAME_IDLE =>
|
---------------------------------------------------------------
|
---------------------------------------------------------------
|
-- No frame has been started.
|
-- No frame has been started.
|
---------------------------------------------------------------
|
---------------------------------------------------------------
|
Line 1428... |
Line 1382... |
-- Wait for a new frame to arrive from the frame buffer.
|
-- Wait for a new frame to arrive from the frame buffer.
|
if (readWindowEmpty_i = '0') then
|
if (readWindowEmpty_i = '0') then
|
-- Update the output from the frame buffer to contain the
|
-- Update the output from the frame buffer to contain the
|
-- data when it is read later.
|
-- data when it is read later.
|
readContentOut <= '1';
|
readContentOut <= '1';
|
frameContent_o <=
|
|
frameContent_i(31 downto 0) & readContentData_i;
|
|
|
|
-- Proceed to start the transmission of the packet.
|
-- Proceed to start the transmission of the packet.
|
frameState_o <= FRAME_BUFFER;
|
internalState_o.frameState <= FRAME_BUFFER;
|
|
frameLock_o <= '1';
|
end if;
|
end if;
|
|
|
when FRAME_BUFFER =>
|
when FRAME_BUFFER =>
|
-----------------------------------------------------------------
|
-----------------------------------------------------------------
|
-- Packet buffer output has been updated. Store the packet
|
-- Packet buffer output has been updated. Store the packet
|
-- content temporarily.
|
-- content temporarily.
|
-----------------------------------------------------------------
|
-----------------------------------------------------------------
|
|
|
|
if (frameLock_i = '0') then
|
|
if (readContentEnd_i = '0') then
|
|
-- REMARK: Need a flag here to know in the next state if the
|
|
-- new content should be added to the number of valid words
|
|
-- in the content...
|
readContentOut <= '1';
|
readContentOut <= '1';
|
frameContent_o <=
|
end if;
|
frameContent_i(31 downto 0) & readContentData_i;
|
|
|
|
|
internalState_o.frameContent <= internalState_i.frameContent(31 downto 0) & readContentData_i;
|
|
internalState_o.frameWordCounter <= readContentWords_i;
|
|
|
|
-- REMARK: Index here will be wrong if the content is larger
|
|
-- than one word...
|
if (readContentData_i(19 downto 16) = FTYPE_MAINTENANCE_CLASS) then
|
if (readContentData_i(19 downto 16) = FTYPE_MAINTENANCE_CLASS) then
|
maintenanceClass_o <= '1';
|
internalState_o.maintenanceClass <= '1';
|
else
|
else
|
maintenanceClass_o <= '0';
|
internalState_o.maintenanceClass <= '0';
|
end if;
|
end if;
|
|
|
frameState_o <= FRAME_START;
|
internalState_o.frameState <= FRAME_START;
|
|
frameLock_o <= '1';
|
|
end if;
|
|
|
when FRAME_START | FRAME_END =>
|
when FRAME_START | FRAME_END =>
|
-------------------------------------------------------
|
-------------------------------------------------------
|
-- Check if we are allowed to transmit this packet.
|
-- Check if we are allowed to transmit this packet.
|
-------------------------------------------------------
|
-------------------------------------------------------
|
-- The packet may be not allowed, i.e. a non-maintenance
|
-- The packet may be not allowed, i.e. a non-maintenance
|
-- sent when only maintenance is allowed. The link-partner can be
|
-- sent when only maintenance is allowed. The link-partner can be
|
-- busy, i.e. not having enough buffers to receive the new packet
|
-- busy, i.e. not having enough buffers to receive the new packet
|
-- in or the number of outstanding packets may be too large.
|
-- in or the number of outstanding packets may be too large.
|
-- REMARK: Only update readContent_o in the last instance
|
|
-- if cascaded...
|
if (frameLock_i = '0') then
|
|
|
-- Check if the packet is allowed.
|
-- Check if the packet is allowed.
|
if ((portEnable_i = '1') or (maintenanceClass_i = '1')) then
|
if ((portEnable_i = '1') or (internalState_i.maintenanceClass = '1')) then
|
-- Packet is allowed.
|
-- Packet is allowed.
|
|
|
-- Check if the link is able to accept the new frame.
|
-- Check if the link is able to accept the new frame.
|
if ((readWindowEmpty_i = '0') and
|
if ((readWindowEmpty_i = '0') and
|
(bufferStatus_i /= "00000") and
|
(internalState_i.bufferStatus /= "00000") and
|
((unsigned(ackIdWindow_i)+1) /= unsigned(ackId_i))) then
|
((unsigned(internalState_i.ackIdWindow)+1) /= unsigned(internalState_i.ackId))) then
|
-- New data is available for transmission and there
|
-- New data is available for transmission and there
|
-- is room to receive it at the other side.
|
-- is room to receive it at the other side.
|
-- The packet may be transmitted.
|
-- The packet may be transmitted.
|
|
|
-- Send a control symbol to start the packet and a status to
|
-- Send a control symbol to start the packet and a status to
|
-- complete the symbol.
|
-- complete the symbol.
|
symbolControlStartOut <= '1';
|
symbolControlStartOut <= '1';
|
|
|
-- Indicate that a control symbol has been sent to start the
|
-- Indicate that a control symbol has been sent to start the
|
-- transmission of the frame.
|
-- transmission of the frame.
|
frameContent_o <=
|
-- REMARK: Fix size of frameContent...
|
frameContent_i(31 downto 0) & readContentData_i;
|
internalState_o.frameContent <= internalState_i.frameContent(31 downto 0) & readContentData_i;
|
|
|
|
if (readContentEnd_i = '0') then
|
|
internalState_o.frameWordCounter <= std_logic_vector(unsigned(internalState_i.frameWordCounter) +
|
|
unsigned(readContentWords_i));
|
readContentOut <= '1';
|
readContentOut <= '1';
|
|
end if;
|
|
|
-- Proceed to send the first packet data symbol containing
|
-- Proceed to send the first packet data symbol containing
|
-- the ackId.
|
-- the ackId.
|
frameState_o <= FRAME_FIRST;
|
internalState_o.frameState <= FRAME_FIRST;
|
else
|
else
|
-- The link cannot accept the packet.
|
-- The link cannot accept the packet.
|
-- Wait in this state and dont do anything.
|
-- Wait in this state and dont do anything.
|
if (frameState_i = FRAME_END) then
|
if (internalState_i.frameState = FRAME_END) then
|
symbolControlEndOut <= '1';
|
symbolControlEndOut <= '1';
|
end if;
|
end if;
|
readFrameRestartOut <= '1';
|
readFrameRestartOut <= '1';
|
frameState_o <= FRAME_IDLE;
|
internalState_o.frameState <= FRAME_IDLE;
|
end if;
|
end if;
|
else
|
else
|
-- The packet is not allowed.
|
-- The packet is not allowed.
|
-- Discard it.
|
-- Discard it.
|
if (frameState_i = FRAME_END) then
|
if (internalState_i.frameState = FRAME_END) then
|
symbolControlEndOut <= '1';
|
symbolControlEndOut <= '1';
|
end if;
|
end if;
|
--readFrameRestartOut <= '1';
|
--readFrameRestartOut <= '1';
|
frameState_o <= FRAME_DISCARD;
|
internalState_o.frameState <= FRAME_DISCARD;
|
|
end if;
|
end if;
|
end if;
|
|
|
when FRAME_FIRST =>
|
when FRAME_FIRST =>
|
---------------------------------------------------------------
|
---------------------------------------------------------------
|
-- Send the first packet content containing our current
|
-- Send the first packet content containing our current
|
Line 1517... |
Line 1487... |
---------------------------------------------------------------
|
---------------------------------------------------------------
|
|
|
-- Write a new data symbol and fill in our ackId on the
|
-- Write a new data symbol and fill in our ackId on the
|
-- packet.
|
-- packet.
|
symbolDataOut <= '1';
|
symbolDataOut <= '1';
|
symbolDataContentOut <= std_logic_vector(ackIdWindow_i) & "0" &
|
symbolDataContentOut <= std_logic_vector(internalState_i.ackIdWindow) & "0" &
|
frameContent_i(57 downto 32);
|
internalState_i.frameContent(57 downto 32);
|
frameContent_o <= frameContent_i(31 downto 0) & readContentData_i;
|
|
|
|
-- Check if the frame is ending.
|
-- Check if the frame is ending.
|
if (readContentEnd_i = '1') then
|
if (readContentEnd_i = '1') then
|
-- The frame is ending.
|
-- The frame is ending.
|
readWindowNextOut <= '1';
|
readWindowNextOut <= '1';
|
frameState_o <= FRAME_LAST_0;
|
internalState_o.frameState <= FRAME_LAST_0;
|
|
frameLock_o <= '1';
|
else
|
else
|
readContentOut <= '1';
|
readContentOut <= '1';
|
frameState_o <= FRAME_MIDDLE;
|
internalState_o.frameState <= FRAME_MIDDLE;
|
|
end if;
|
|
|
|
if (internalState_i.frameWordCounter = "00") then
|
|
internalState_o.frameContent <= internalState_i.frameContent(31 downto 0) & readContentData_i;
|
|
internalState_o.frameWordCounter <= readContentWords_i;
|
|
else
|
|
internalState_o.frameContent <= internalState_i.frameContent(31 downto 0) & readContentData_i;
|
|
internalState_o.frameWordCounter <= std_logic_vector(unsigned(internalState_i.frameWordCounter) - 1);
|
end if;
|
end if;
|
|
|
when FRAME_MIDDLE =>
|
when FRAME_MIDDLE =>
|
---------------------------------------------------------------
|
---------------------------------------------------------------
|
-- The frame has not been fully sent.
|
-- The frame has not been fully sent.
|
Line 1540... |
Line 1518... |
-- detected.
|
-- detected.
|
---------------------------------------------------------------
|
---------------------------------------------------------------
|
|
|
-- Write a new data symbol.
|
-- Write a new data symbol.
|
symbolDataOut <= '1';
|
symbolDataOut <= '1';
|
symbolDataContentOut <= frameContent_i(63 downto 32);
|
symbolDataContentOut <= internalState_i.frameContent(63 downto 32);
|
frameContent_o <= frameContent_i(31 downto 0) & readContentData_i;
|
|
|
|
-- Check if the frame is ending.
|
-- Check if the frame is ending.
|
if (readContentEnd_i = '1') then
|
if (readContentEnd_i = '1') then
|
-- The frame is ending.
|
-- The frame is ending.
|
readWindowNextOut <= '1';
|
readWindowNextOut <= '1';
|
frameState_o <= FRAME_LAST_0;
|
internalState_o.frameState <= FRAME_LAST_0;
|
|
frameLock_o <= '1';
|
else
|
else
|
readContentOut <= '1';
|
readContentOut <= '1';
|
end if;
|
end if;
|
|
|
|
if (internalState_i.frameWordCounter = "00") then
|
|
internalState_o.frameContent <= internalState_i.frameContent(31 downto 0) & readContentData_i;
|
|
internalState_o.frameWordCounter <= readContentWords_i;
|
|
else
|
|
internalState_o.frameContent <= internalState_i.frameContent(31 downto 0) & readContentData_i;
|
|
internalState_o.frameWordCounter <= std_logic_vector(unsigned(internalState_i.frameWordCounter) - 1);
|
|
end if;
|
|
|
when FRAME_LAST_0 =>
|
when FRAME_LAST_0 =>
|
-----------------------------------------------------------------
|
-----------------------------------------------------------------
|
--
|
--
|
-----------------------------------------------------------------
|
-----------------------------------------------------------------
|
|
|
symbolDataOut <= '1';
|
symbolDataOut <= '1';
|
symbolDataContentOut <= frameContent_i(63 downto 32);
|
symbolDataContentOut <= internalState_i.frameContent(63 downto 32);
|
frameContent_o <= frameContent_i(31 downto 0) & readContentData_i;
|
|
|
if (frameLock_i = '0') then
|
if (readWindowEmpty_i = '0') then
|
if (readWindowEmpty_i = '0') then
|
readContentOut <= '1';
|
readContentOut <= '1';
|
|
frameLock_o <= '1';
|
|
end if;
|
|
internalState_o.frameState <= FRAME_LAST_1;
|
|
end if;
|
|
|
|
if (internalState_i.frameWordCounter = "00") then
|
|
internalState_o.frameContent <= internalState_i.frameContent(31 downto 0) & readContentData_i;
|
|
internalState_o.frameWordCounter <= readContentWords_i;
|
|
else
|
|
internalState_o.frameContent <= internalState_i.frameContent(31 downto 0) & readContentData_i;
|
|
internalState_o.frameWordCounter <= std_logic_vector(unsigned(internalState_i.frameWordCounter) - 1);
|
end if;
|
end if;
|
frameState_o <= FRAME_LAST_1;
|
|
|
|
when FRAME_LAST_1 =>
|
when FRAME_LAST_1 =>
|
-----------------------------------------------------------------
|
-----------------------------------------------------------------
|
--
|
--
|
-----------------------------------------------------------------
|
-----------------------------------------------------------------
|
|
|
symbolDataOut <= '1';
|
symbolDataOut <= '1';
|
symbolDataContentOut <= frameContent_i(63 downto 32);
|
symbolDataContentOut <= internalState_i.frameContent(63 downto 32);
|
frameContent_o <= frameContent_i(31 downto 0) & readContentData_i;
|
|
|
if (internalState_i.frameWordCounter = "00") then
|
|
internalState_o.frameContent <= internalState_i.frameContent(31 downto 0) & readContentData_i;
|
|
internalState_o.frameWordCounter <= readContentWords_i;
|
|
else
|
|
internalState_o.frameContent <= internalState_i.frameContent(31 downto 0) & readContentData_i;
|
|
internalState_o.frameWordCounter <= std_logic_vector(unsigned(internalState_i.frameWordCounter) - 1);
|
|
end if;
|
|
|
|
if (frameLock_i = '0') then
|
|
if (internalState_i.frameWordCounter = "00") then
|
if (readWindowEmpty_i = '0') then
|
if (readWindowEmpty_i = '0') then
|
if (readContentData_i(19 downto 16) = FTYPE_MAINTENANCE_CLASS) then
|
if (readContentData_i(19 downto 16) = FTYPE_MAINTENANCE_CLASS) then
|
maintenanceClass_o <= '1';
|
internalState_o.maintenanceClass <= '1';
|
else
|
else
|
maintenanceClass_o <= '0';
|
internalState_o.maintenanceClass <= '0';
|
end if;
|
end if;
|
readContentOut <= '1';
|
readContentOut <= '1';
|
|
frameLock_o <= '1';
|
end if;
|
end if;
|
|
|
-- Update the window ackId.
|
-- Update the window ackId.
|
ackIdWindow_o <= std_logic_vector(unsigned(ackIdWindow_i) + 1);
|
internalState_o.ackIdWindow <= std_logic_vector(unsigned(internalState_i.ackIdWindow) + 1);
|
|
|
-- Start timeout supervision for transmitted frame.
|
-- Start timeout supervision for transmitted frame.
|
timeSentSet_o <= '1';
|
timeSentSet_o <= '1';
|
|
|
-- Proceed to end the frame or start a new one.
|
-- Proceed to end the frame or start a new one.
|
frameState_o <= FRAME_END;
|
internalState_o.frameState <= FRAME_END;
|
|
end if;
|
|
end if;
|
|
|
when FRAME_DISCARD =>
|
when FRAME_DISCARD =>
|
---------------------------------------------------------------
|
---------------------------------------------------------------
|
--
|
--
|
---------------------------------------------------------------
|
---------------------------------------------------------------
|
-- The packet should be discarded.
|
-- The packet should be discarded.
|
-- Send idle-sequence.
|
-- Send idle-sequence.
|
|
|
-- Check that there are no outstanding packets that
|
-- Check that there are no outstanding packets that
|
-- has not been acknowledged.
|
-- has not been acknowledged.
|
if(unsigned(ackIdWindow_i) = unsigned(ackId_i)) then
|
if(unsigned(internalState_i.ackIdWindow) = unsigned(internalState_i.ackId)) then
|
-- No unacknowledged packets.
|
-- No unacknowledged packets.
|
-- It is now safe to remove the unallowed frame.
|
-- It is now safe to remove the unallowed frame.
|
-- REMARK: Discard packet; readFrameOut <= '1';
|
-- REMARK: Discard packet; readFrameOut <= '1';
|
|
|
-- Go back and send a new frame.
|
-- Go back and send a new frame.
|
frameState_o <= FRAME_IDLE;
|
internalState_o.frameState <= FRAME_IDLE;
|
end if;
|
end if;
|
|
|
when others =>
|
when others =>
|
---------------------------------------------------------------
|
---------------------------------------------------------------
|
--
|
--
|
Line 1630... |
Line 1640... |
-- every 255 symbol.
|
-- every 255 symbol.
|
-- At startup it makes sure that at least 16 status symbols are transmitted
|
-- At startup it makes sure that at least 16 status symbols are transmitted
|
-- before the operational-state is entered.
|
-- before the operational-state is entered.
|
-- Input: symbolControlStart, symbolControlEnd, symbolControlRestart,
|
-- Input: symbolControlStart, symbolControlEnd, symbolControlRestart,
|
-- symbolControlLinkRequest, symbolData, symbolDataContent
|
-- symbolControlLinkRequest, symbolData, symbolDataContent
|
-- Output: symbolsTransmitted_o, operational_o,
|
-- Output: symbolsTransmitted, operationalNext,
|
-- symbolControl, stype0, parameter0, parameter1, stype1, cmd,
|
-- symbolControl, stype0, parameter0, parameter1, stype1, cmd,
|
-- symbolData1, symbolData1Content
|
-- symbolData1, symbolData1Content
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
|
|
rxControlUpdate_o <= rxControlUpdateOut and (not txFull_i);
|
rxControlUpdate_o <= rxControlUpdateOut and (not txFull_i);
|
Line 1681... |
Line 1691... |
symbolControlStype1 <=
|
symbolControlStype1 <=
|
symbolControlRestart or symbolControlLinkRequest or
|
symbolControlRestart or symbolControlLinkRequest or
|
symbolControlStart or symbolControlEnd;
|
symbolControlStart or symbolControlEnd;
|
|
|
process(linkInitialized_i, ackIdStatus_i, portInitialized_i,
|
process(linkInitialized_i, ackIdStatus_i, portInitialized_i,
|
operational_i, counter_i, statusReceived_i, symbolsTransmitted_i,
|
internalState_i,
|
rxControlEmpty_i,
|
rxControlEmpty_i,
|
symbolControlStype1, symbolData,
|
symbolControlStype1, symbolData,
|
rxControlStype0, rxControlParameter0, rxControlParameter1,
|
rxControlStype0, rxControlParameter0, rxControlParameter1)
|
fatalError_i)
|
|
begin
|
begin
|
operational_o <= operational_i;
|
internalState_o.operational <= internalState_i.operational;
|
counter_o <= counter_i;
|
internalState_o.counter <= internalState_i.counter;
|
symbolsTransmitted_o <= symbolsTransmitted_i;
|
internalState_o.symbolsTransmitted <= internalState_i.symbolsTransmitted;
|
rxControlUpdateOut <= '0';
|
rxControlUpdateOut <= '0';
|
|
|
controlValidOut <= '0';
|
controlValidOut <= '0';
|
stype0Out <= STYPE0_STATUS;
|
stype0Out <= STYPE0_STATUS;
|
parameter0Out <= ackIdStatus_i;
|
parameter0Out <= ackIdStatus_i;
|
parameter1Out <= "11111";
|
parameter1Out <= "11111";
|
|
|
if (fatalError_i = '1') then
|
if (internalState_i.fatalError = '1') then
|
operational_o <= '0';
|
internalState_o.operational <= '0';
|
counter_o <= NUMBER_STATUS_TRANSMIT;
|
internalState_o.counter <= NUMBER_STATUS_TRANSMIT;
|
symbolsTransmitted_o <= (others=>'0');
|
internalState_o.symbolsTransmitted <= (others=>'0');
|
else
|
else
|
-- Check the operational state.
|
-- Check the operational state.
|
if (operational_i = '0') then
|
if (internalState_i.operational = '0') then
|
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
-- This state is entered at startup. A port that is not initialized
|
-- This state is entered at startup. A port that is not initialized
|
-- should only transmit idle sequences.
|
-- should only transmit idle sequences.
|
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
|
|
Line 1723... |
Line 1732... |
-- has been received.
|
-- has been received.
|
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
|
|
-- Check if we are ready to change state to operational.
|
-- Check if we are ready to change state to operational.
|
if ((linkInitialized_i = '1') and
|
if ((linkInitialized_i = '1') and
|
(unsigned(counter_i) = 0)) then
|
(unsigned(internalState_i.counter) = 0)) then
|
-- Receiver has received enough error free status symbols and we
|
-- Receiver has received enough error free status symbols and we
|
-- have transmitted enough.
|
-- have transmitted enough.
|
|
|
-- Considder ourselfs operational.
|
-- Considder ourselfs operational.
|
operational_o <= '1';
|
internalState_o.operational <= '1';
|
else
|
else
|
-- Not ready to change state to operational.
|
-- Not ready to change state to operational.
|
-- Dont do anything.
|
-- Dont do anything.
|
end if;
|
end if;
|
|
|
-- Check if idle sequence or a status symbol should be transmitted.
|
-- Check if idle sequence or a status symbol should be transmitted.
|
if (((statusReceived_i = '0') and (symbolsTransmitted_i = x"ff")) or
|
if (((internalState_i.statusReceived = '0') and
|
((statusReceived_i = '1') and (symbolsTransmitted_i > x"0f"))) then
|
(internalState_i.symbolsTransmitted = x"ff")) or
|
|
((internalState_i.statusReceived = '1') and
|
|
(internalState_i.symbolsTransmitted > x"0f"))) then
|
-- A status symbol should be transmitted.
|
-- A status symbol should be transmitted.
|
|
|
-- Send a status control symbol to the link partner.
|
-- Send a status control symbol to the link partner.
|
controlValidOut <= '1';
|
controlValidOut <= '1';
|
|
|
-- Reset idle sequence transmission counter.
|
-- Reset idle sequence transmission counter.
|
symbolsTransmitted_o <= (others=>'0');
|
internalState_o.symbolsTransmitted <= (others=>'0');
|
|
|
-- Check if the number of transmitted statuses should be updated.
|
-- Check if the number of transmitted statuses should be updated.
|
if (statusReceived_i = '1') and (unsigned(counter_i) /= 0) then
|
if ((internalState_i.statusReceived = '1') and
|
counter_o <= std_logic_vector(unsigned(counter_i) - 1);
|
(unsigned(internalState_i.counter) /= 0)) then
|
|
internalState_o.counter <=
|
|
std_logic_vector(unsigned(internalState_i.counter) - 1);
|
end if;
|
end if;
|
else
|
else
|
-- Increment the idle sequence transmission counter.
|
-- Increment the idle sequence transmission counter.
|
symbolsTransmitted_o <= std_logic_vector(unsigned(symbolsTransmitted_i) + 1);
|
internalState_o.symbolsTransmitted <=
|
|
std_logic_vector(unsigned(internalState_i.symbolsTransmitted) + 1);
|
end if;
|
end if;
|
else
|
else
|
-- The port is not initialized.
|
-- The port is not initialized.
|
-- Reset initialization variables.
|
-- Reset initialization variables.
|
counter_o <= NUMBER_STATUS_TRANSMIT;
|
internalState_o.counter <= NUMBER_STATUS_TRANSMIT;
|
symbolsTransmitted_o <= (others=>'0');
|
internalState_o.symbolsTransmitted <= (others=>'0');
|
end if;
|
end if;
|
else
|
else
|
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
-- This is the operational state.
|
-- This is the operational state.
|
-- It is entered once the link has been considdered up and running.
|
-- It is entered once the link has been considdered up and running.
|
Line 1776... |
Line 1790... |
-- send or if too many symbols without buffer-status has been sent.
|
-- send or if too many symbols without buffer-status has been sent.
|
-- REMARK: Is there a risk of a race when a generated status-symbol
|
-- REMARK: Is there a risk of a race when a generated status-symbol
|
-- is sent before another symbol stored in the rx-control fifo???
|
-- is sent before another symbol stored in the rx-control fifo???
|
if (((symbolControlStype1 = '1') and (rxControlEmpty_i = '1')) or
|
if (((symbolControlStype1 = '1') and (rxControlEmpty_i = '1')) or
|
((symbolControlStype1 = '0') and (symbolData = '0') and
|
((symbolControlStype1 = '0') and (symbolData = '0') and
|
(symbolsTransmitted_i = x"ff"))) then
|
(internalState_i.symbolsTransmitted = x"ff"))) then
|
-- A control symbol is about to be sent without pending symbol from
|
-- A control symbol is about to be sent without pending symbol from
|
-- receiver or too many idle symbols has been sent.
|
-- receiver or too many idle symbols has been sent.
|
|
|
-- Force the sending of a status containing the bufferStatus.
|
-- Force the sending of a status containing the bufferStatus.
|
controlValidOut <= '1';
|
controlValidOut <= '1';
|
symbolsTransmitted_o <= (others=>'0');
|
internalState_o.symbolsTransmitted <= (others=>'0');
|
elsif ((symbolData = '0') and (rxControlEmpty_i = '0')) then
|
elsif ((symbolData = '0') and (rxControlEmpty_i = '0')) then
|
-- A control symbol is about to be sent and there is a pending
|
-- A control symbol is about to be sent and there is a pending
|
-- symbol from the receiver.
|
-- symbol from the receiver.
|
|
|
-- Remove the symbol from the fifo.
|
-- Remove the symbol from the fifo.
|
Line 1801... |
Line 1815... |
-- Check if the transmitted symbol contains status about
|
-- Check if the transmitted symbol contains status about
|
-- available buffers.
|
-- available buffers.
|
if ((rxControlStype0 = STYPE0_PACKET_ACCEPTED) or
|
if ((rxControlStype0 = STYPE0_PACKET_ACCEPTED) or
|
(rxControlStype0 = STYPE0_PACKET_RETRY)) then
|
(rxControlStype0 = STYPE0_PACKET_RETRY)) then
|
-- A symbol containing the bufferStatus has been sent.
|
-- A symbol containing the bufferStatus has been sent.
|
symbolsTransmitted_o <= (others=>'0');
|
internalState_o.symbolsTransmitted <= (others=>'0');
|
else
|
else
|
-- A symbol not containing the bufferStatus has been sent.
|
-- A symbol not containing the bufferStatus has been sent.
|
symbolsTransmitted_o <= std_logic_vector(unsigned(symbolsTransmitted_i) + 1);
|
internalState_o.symbolsTransmitted <= std_logic_vector(unsigned(internalState_i.symbolsTransmitted) + 1);
|
end if;
|
end if;
|
else
|
else
|
-- A symbol not containing the bufferStatus has been sent.
|
-- A symbol not containing the bufferStatus has been sent.
|
controlValidOut <= '0';
|
controlValidOut <= '0';
|
symbolsTransmitted_o <= std_logic_vector(unsigned(symbolsTransmitted_i) + 1);
|
internalState_o.symbolsTransmitted <= std_logic_vector(unsigned(internalState_i.symbolsTransmitted) + 1);
|
end if;
|
end if;
|
else
|
else
|
-- The port is not initialized anymore.
|
-- The port is not initialized anymore.
|
-- Change the operational state.
|
-- Change the operational state.
|
operational_o <= '0';
|
internalState_o.operational <= '0';
|
counter_o <= NUMBER_STATUS_TRANSMIT;
|
internalState_o.counter <= NUMBER_STATUS_TRANSMIT;
|
symbolsTransmitted_o <= (others=>'0');
|
internalState_o.symbolsTransmitted <= (others=>'0');
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
Line 1896... |
Line 1910... |
rxRead_o : out std_logic;
|
rxRead_o : out std_logic;
|
rxType_i : in std_logic_vector(2*NUMBER_WORDS-1 downto 0);
|
rxType_i : in std_logic_vector(2*NUMBER_WORDS-1 downto 0);
|
rxData_i : in std_logic_vector(32*NUMBER_WORDS-1 downto 0);
|
rxData_i : in std_logic_vector(32*NUMBER_WORDS-1 downto 0);
|
|
|
txControlWrite_o : out std_logic_vector(NUMBER_WORDS-1 downto 0);
|
txControlWrite_o : out std_logic_vector(NUMBER_WORDS-1 downto 0);
|
txControlSymbol_o : out std_logic_vector(12*NUMBER_WORDS downto 0);
|
txControlSymbol_o : out std_logic_vector(13*NUMBER_WORDS-1 downto 0);
|
rxControlWrite_o : out std_logic_vector(NUMBER_WORDS-1 downto 0);
|
rxControlWrite_o : out std_logic_vector(NUMBER_WORDS-1 downto 0);
|
rxControlSymbol_o : out std_logic_vector(12*NUMBER_WORDS downto 0);
|
rxControlSymbol_o : out std_logic_vector(13*NUMBER_WORDS-1 downto 0);
|
|
|
ackIdStatus_o : out std_logic_vector(4 downto 0);
|
ackIdStatus_o : out std_logic_vector(4 downto 0);
|
linkInitialized_o : out std_logic;
|
linkInitialized_o : out std_logic;
|
|
|
writeFrameFull_i : in std_logic;
|
writeFrameFull_i : in std_logic;
|
Line 1993... |
Line 2007... |
signal inputRetryStoppedCurrent, inputRetryStoppedNext : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal inputRetryStoppedCurrent, inputRetryStoppedNext : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal inputErrorStoppedCurrent, inputErrorStoppedNext : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal inputErrorStoppedCurrent, inputErrorStoppedNext : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal ackIdCurrent, ackIdNext : unsigned(5*NUMBER_WORDS-1 downto 0);
|
signal ackIdCurrent, ackIdNext : unsigned(5*NUMBER_WORDS-1 downto 0);
|
signal frameIndexCurrent, frameIndexNext : std_logic_vector(7*NUMBER_WORDS-1 downto 0);
|
signal frameIndexCurrent, frameIndexNext : std_logic_vector(7*NUMBER_WORDS-1 downto 0);
|
signal frameWordCounterCurrent, frameWordCounterNext : std_logic_vector(2*NUMBER_WORDS-1 downto 0);
|
signal frameWordCounterCurrent, frameWordCounterNext : std_logic_vector(2*NUMBER_WORDS-1 downto 0);
|
signal frameContentCurrent, frameContentNext : std_logic_vector(32*NUMBER_WORDS-1 downto 0);
|
signal frameContentCurrent, frameContentNext : std_logic_vector(32*NUMBER_WORDS*NUMBER_WORDS-1 downto 0);
|
signal crcCurrent, crcNext : std_logic_vector(16*NUMBER_WORDS-1 downto 0);
|
signal crcCurrent, crcNext : std_logic_vector(16*NUMBER_WORDS-1 downto 0);
|
|
|
signal txControlWrite : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal txControlWrite : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal rxControlWrite : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal rxControlWrite : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
|
|
|
signal internalStateCurrent, internalStateNext : RxInternalType;
|
|
signal internalState : RxInternalArrayType(NUMBER_WORDS downto 0);
|
|
|
signal writeFrame : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal writeFrame : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal writeFrameAbort : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal writeFrameAbort : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal writeContent : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal writeContent : std_logic_vector(NUMBER_WORDS-1 downto 0);
|
signal writeContentWords : std_logic_vector(2*NUMBER_WORDS-1 downto 0);
|
signal writeContentWords : std_logic_vector(2*NUMBER_WORDS-1 downto 0);
|
signal writeContentData : std_logic_vector(32*NUMBER_WORDS-1 downto 0);
|
signal writeContentData : std_logic_vector(32*NUMBER_WORDS*NUMBER_WORDS-1 downto 0);
|
|
|
begin
|
begin
|
|
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
-- Output generation to packet buffer.
|
-- Output generation to packet buffer.
|
Line 2030... |
Line 2047... |
end if;
|
end if;
|
|
|
if ((writeContent(i) = '1') and (enable(i) = '1')) then
|
if ((writeContent(i) = '1') and (enable(i) = '1')) then
|
writeContent_o <= '1';
|
writeContent_o <= '1';
|
writeContentWords_o <= writeContentWords(2*(i+1)-1 downto 2*i);
|
writeContentWords_o <= writeContentWords(2*(i+1)-1 downto 2*i);
|
writeContentData_o <= writeContentData(32*(i+1)-1 downto 32*i);
|
writeContentData_o <= writeContentData(32*NUMBER_WORDS*(i+1)-1 downto 32*NUMBER_WORDS*i);
|
end if;
|
end if;
|
end loop;
|
end loop;
|
end process;
|
end process;
|
|
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
-- Protocol core and synchronization.
|
-- Protocol core and synchronization.
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
process(clk, areset_n)
|
process(clk, areset_n)
|
begin
|
begin
|
if (areset_n = '0') then
|
if (areset_n = '0') then
|
operationalCurrent <= (others=>'0');
|
internalStateCurrent <= (operational=>'0',
|
inputRetryStoppedCurrent <= (others=>'0');
|
inputRetryStopped=>'0',
|
inputErrorStoppedCurrent <= (others=>'0');
|
inputErrorStopped=>'0',
|
ackIdCurrent <= (others=>'0');
|
ackId=>(others=>'0'),
|
frameIndexCurrent <= (others => '0');
|
frameIndex=>(others=>'0'),
|
frameWordCounterCurrent <= (others=>'0');
|
frameWordCounter=>(others=>'0'),
|
frameContentCurrent <= (others=>'0');
|
frameContent=>(others=>'0'),
|
crcCurrent <= (others=>'0');
|
crc=>(others=>'0'));
|
elsif (clk'event and clk = '1') then
|
elsif (clk'event and clk = '1') then
|
if (enable(0) = '1') then
|
if (enable(0) = '1') then
|
operationalCurrent <= operationalNext;
|
internalStateCurrent <= internalStateNext;
|
inputRetryStoppedCurrent <= inputRetryStoppedNext;
|
|
inputErrorStoppedCurrent <= inputErrorStoppedNext;
|
|
ackIdCurrent <= ackIdNext;
|
|
frameIndexCurrent <= frameIndexNext;
|
|
frameWordCounterCurrent <= frameWordCounterNext;
|
|
frameContentCurrent <= frameContentNext;
|
|
crcCurrent <= crcNext;
|
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
|
internalState(0) <= internalStateCurrent;
|
|
internalStateNext <= internalState(NUMBER_WORDS);
|
CoreGeneration: for i in 0 to NUMBER_WORDS-1 generate
|
CoreGeneration: for i in 0 to NUMBER_WORDS-1 generate
|
txControlWrite_o(i) <= txControlWrite(i) and enable(i);
|
txControlWrite_o(i) <= txControlWrite(i) and enable(i);
|
rxControlWrite_o(i) <= rxControlWrite(i);
|
rxControlWrite_o(i) <= rxControlWrite(i);
|
|
|
ReceiverCore: RioReceiverCore
|
ReceiverCore: RioReceiverCore
|
Line 2079... |
Line 2091... |
inboundAckId_i=>inboundAckId_i,
|
inboundAckId_i=>inboundAckId_i,
|
inboundAckId_o=>inboundAckId_o,
|
inboundAckId_o=>inboundAckId_o,
|
portInitialized_i=>portInitialized_i,
|
portInitialized_i=>portInitialized_i,
|
rxEmpty_i=>rxEmpty_i,
|
rxEmpty_i=>rxEmpty_i,
|
rxRead_o=>rxRead_o,
|
rxRead_o=>rxRead_o,
|
rxType_i=>rxType_i,
|
rxType_i=>rxType_i(2*(i+1)-1 downto 2*i),
|
rxData_i=>rxData_i,
|
rxData_i=>rxData_i(32*(i+1)-1 downto 32*i),
|
txControlWrite_o=>txControlWrite(i),
|
txControlWrite_o=>txControlWrite(i),
|
txControlSymbol_o=>txControlSymbol_o(13*(i+1)-1 downto 13*i),
|
txControlSymbol_o=>txControlSymbol_o(13*(i+1)-1 downto 13*i),
|
rxControlWrite_o=>rxControlWrite(i),
|
rxControlWrite_o=>rxControlWrite(i),
|
rxControlSymbol_o=>rxControlSymbol_o(13*(i+1)-1 downto 13*i),
|
rxControlSymbol_o=>rxControlSymbol_o(13*(i+1)-1 downto 13*i),
|
ackIdStatus_o=>ackIdStatus_o,
|
ackIdStatus_o=>ackIdStatus_o,
|
linkInitialized_o=>linkInitialized_o,
|
linkInitialized_o=>linkInitialized_o,
|
enable_o=>enable(i),
|
enable_o=>enable(i),
|
operational_i=>operationalCurrent(i),
|
internalState_i=>internalState(i),
|
operational_o=>operationalNext(i),
|
internalState_o=>internalState(i+1),
|
inputRetryStopped_i=>inputRetryStoppedCurrent(i),
|
|
inputRetryStopped_o=>inputRetryStoppedNext(i),
|
|
inputErrorStopped_i=>inputErrorStoppedCurrent(i),
|
|
inputErrorStopped_o=>inputErrorStoppedNext(i),
|
|
ackId_i=>ackIdCurrent(5*(i+1)-1 downto 5*i),
|
|
ackId_o=>ackIdNext(5*(i+1)-1 downto 5*i),
|
|
frameIndex_i=>frameIndexCurrent(7*(i+1)-1 downto 7*i),
|
|
frameIndex_o=>frameIndexNext(7*(i+1)-1 downto 7*i),
|
|
frameWordCounter_i=>frameWordCounterCurrent(2*(i+1)-1 downto 2*i),
|
|
frameWordCounter_o=>frameWordCounterNext(2*(i+1)-1 downto 2*i),
|
|
frameContent_i=>frameContentCurrent(32*(i+1)-1 downto 32*i),
|
|
frameContent_o=>frameContentNext(32*(i+1)-1 downto 32*i),
|
|
crc_i=>crcCurrent(16*(i+1)-1 downto 16*i),
|
|
crc_o=>crcNext(16*(i+1)-1 downto 16*i),
|
|
writeFrameFull_i=>writeFrameFull_i,
|
writeFrameFull_i=>writeFrameFull_i,
|
writeFrame_o=>writeFrame(i),
|
writeFrame_o=>writeFrame(i),
|
writeFrameAbort_o=>writeFrameAbort(i),
|
writeFrameAbort_o=>writeFrameAbort(i),
|
writeContent_o=>writeContent(i),
|
writeContent_o=>writeContent(i),
|
writeContentWords_o=>writeContentWords(2*(i+1)-1 downto 2*i),
|
writeContentData_o=>writeContentData(32*NUMBER_WORDS*(i+1)-1 downto 32*NUMBER_WORDS*i),
|
writeContentData_o=>writeContentData(32*(i+1)-1 downto 32*i));
|
writeContentWords_o=>writeContentWords(2*(i+1)-1 downto 2*i));
|
end generate;
|
end generate;
|
|
|
end architecture;
|
end architecture;
|
|
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
Line 2170... |
Line 2168... |
ackIdStatus_o : out std_logic_vector(4 downto 0);
|
ackIdStatus_o : out std_logic_vector(4 downto 0);
|
linkInitialized_o : out std_logic;
|
linkInitialized_o : out std_logic;
|
|
|
-- Core->Core cascading signals.
|
-- Core->Core cascading signals.
|
enable_o : out std_logic;
|
enable_o : out std_logic;
|
operational_i : in std_logic;
|
internalState_i : in RxInternalType;
|
operational_o : out std_logic;
|
internalState_o : in RxInternalType;
|
inputRetryStopped_i : in std_logic;
|
|
inputRetryStopped_o : out std_logic;
|
|
inputErrorStopped_i : in std_logic;
|
|
inputErrorStopped_o : out std_logic;
|
|
ackId_i : in unsigned(4 downto 0);
|
|
ackId_o : out unsigned(4 downto 0);
|
|
frameIndex_i : in std_logic_vector(6 downto 0);
|
|
frameIndex_o : out std_logic_vector(6 downto 0);
|
|
frameWordCounter_i : in std_logic_vector(1 downto 0);
|
|
frameWordCounter_o : out std_logic_vector(1 downto 0);
|
|
frameContent_i : in std_logic_vector(32*NUMBER_WORDS-1 downto 0);
|
|
frameContent_o : out std_logic_vector(32*NUMBER_WORDS-1 downto 0);
|
|
crc_i : in std_logic_vector(15 downto 0);
|
|
crc_o : out std_logic_vector(15 downto 0);
|
|
|
|
-- Frame buffering interface.
|
-- Frame buffering interface.
|
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;
|
Line 2243... |
Line 2227... |
signal rxControlWrite : std_logic;
|
signal rxControlWrite : std_logic;
|
signal rxControlSymbol : std_logic_vector(12 downto 0);
|
signal rxControlSymbol : std_logic_vector(12 downto 0);
|
|
|
begin
|
begin
|
|
|
linkInitialized_o <= operational_i;
|
linkInitialized_o <= internalState_i.operational;
|
ackIdStatus_o <= std_logic_vector(ackId_i);
|
ackIdStatus_o <= std_logic_vector(internalState_i.ackId);
|
inboundAckId_o <= std_logic_vector(ackId_i);
|
inboundAckId_o <= std_logic_vector(internalState_i.ackId);
|
|
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
-- First pipeline stage.
|
-- First pipeline stage.
|
-- Check the validity of the symbol, CRC5 on control symbols, and save the
|
-- Check the validity of the symbol, CRC5 on control symbols, and save the
|
-- symbol content for the next stage.
|
-- symbol content for the next stage.
|
Line 2305... |
Line 2289... |
stype1LinkRequest <= '0';
|
stype1LinkRequest <= '0';
|
symbolData <= '0';
|
symbolData <= '0';
|
|
|
symbolContent1 <= (others => '0');
|
symbolContent1 <= (others => '0');
|
elsif (clk'event and clk = '1') then
|
elsif (clk'event and clk = '1') then
|
|
txControlWrite_o <= '0';
|
|
|
if (symbolEnable0 = '1') then
|
if (symbolEnable0 = '1') then
|
symbolEnable1 <= '1';
|
symbolEnable1 <= '1';
|
symbolContent1 <= symbolContent0;
|
symbolContent1 <= symbolContent0;
|
|
|
if (symbolType0 = SYMBOL_CONTROL) then
|
if (symbolType0 = SYMBOL_CONTROL) then
|
Line 2390... |
Line 2376... |
-- first data-symbol in packet->crc_o is product of 11111 and the
|
-- first data-symbol in packet->crc_o is product of 11111 and the
|
-- symbolContent1 without ackid.
|
-- symbolContent1 without ackid.
|
-- not first data-symbol->crc_o is product of crc_i and symbolContent1.
|
-- not first data-symbol->crc_o is product of crc_i and symbolContent1.
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
|
|
crc16Data(31 downto 26) <= "000000" when (unsigned(frameIndex_i) = 1) else
|
crc16Data(31 downto 26) <=
|
|
"000000" when (unsigned(internalState_i.frameIndex) = 1) else
|
symbolContent1(31 downto 26);
|
symbolContent1(31 downto 26);
|
crc16Data(25 downto 0) <= symbolContent1(25 downto 0);
|
crc16Data(25 downto 0) <= symbolContent1(25 downto 0);
|
|
|
crc16Current <= crc_i when (unsigned(frameIndex_i) /= 1) else
|
crc16Current <=
|
|
internalState_i.crc when (unsigned(internalState_i.frameIndex) /= 1) else
|
(others => '1');
|
(others => '1');
|
|
|
Crc16Msb: Crc16CITT
|
Crc16Msb: Crc16CITT
|
port map(
|
port map(
|
d_i=>crc16Data(31 downto 16), crc_i=>crc16Current, crc_o=>crc16Temp);
|
d_i=>crc16Data(31 downto 16), crc_i=>crc16Current, crc_o=>crc16Temp);
|
Crc16Lsb: Crc16CITT
|
Crc16Lsb: Crc16CITT
|
port map(
|
port map(
|
d_i=>crc16Data(15 downto 0), crc_i=>crc16Temp, crc_o=>crc16Next);
|
d_i=>crc16Data(15 downto 0), crc_i=>crc16Temp, crc_o=>crc16Next);
|
|
|
crc_o <= crc_i when (symbolData = '0') else
|
internalState_o.crc <=
|
|
internalState_i.crc when (symbolData = '0') else
|
crc16Next;
|
crc16Next;
|
|
|
crc16Valid <= '1' when (crc_i = x"0000") else '0';
|
crc16Valid <= '1' when (internalState_i.crc = x"0000") else '0';
|
|
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
-- Update buffered data.
|
-- Update buffered data.
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
|
|
-- Append the new symbol content to the end of the
|
-- Append the new symbol content to the end of the
|
-- current frame content if the symbol is a data symbol.
|
-- current frame content if the symbol is a data symbol.
|
frameContentSingle:
|
frameContent:
|
if (NUMBER_WORDS = 1) generate
|
if (NUMBER_WORDS = 1) generate
|
frameContent <= symbolContent1;
|
frameContent <= symbolContent1;
|
end generate;
|
end generate;
|
frameContentMulti:
|
frameContentMulti:
|
if (NUMBER_WORDS > 1) generate
|
if (NUMBER_WORDS > 1) generate
|
frameContent <=
|
frameContent <=
|
(frameContent_i((32*(NUMBER_WORDS-1))-1 downto 0) & symbolContent1) when (symbolData = '1') else
|
(internalState_i.frameContent((32*(NUMBER_WORDS-1))-1 downto 0) & symbolContent1) when (symbolData = '1') else
|
frameContent_i;
|
internalState_i.frameContent;
|
end generate;
|
end generate;
|
|
|
-- Update outputs.
|
-- Update outputs.
|
enable_o <= symbolEnable1;
|
enable_o <= symbolEnable1;
|
frameContent_o <= frameContent;
|
internalState_o.frameContent <= frameContent;
|
writeContentData_o <= frameContent;
|
writeContentData_o <= frameContent;
|
|
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
-- Main inbound symbol handler.
|
-- Main inbound symbol handler.
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
process(portInitialized_i, portEnable_i, writeFrameFull_i,
|
process(portInitialized_i, portEnable_i, writeFrameFull_i,
|
operational_i, ackId_i, frameIndex_i, frameWordCounter_i,
|
internalState_i,
|
inputRetryStopped_i, inputErrorStopped_i,
|
|
symbolValid,
|
symbolValid,
|
stype0Status,
|
stype0Status,
|
stype1Start, stype1End, stype1Stomp, stype1Restart, stype1LinkRequest,
|
stype1Start, stype1End, stype1Stomp, stype1Restart, stype1LinkRequest,
|
symbolData,
|
symbolData,
|
symbolContent1,
|
symbolContent1,
|
frameContent,
|
|
crc16Valid)
|
crc16Valid)
|
begin
|
begin
|
operational_o <= operational_i;
|
internalState_o.operational <= internalState_i.operational;
|
ackId_o <= ackId_i;
|
internalState_o.ackId <= internalState_i.ackId;
|
frameIndex_o <= frameIndex_i;
|
internalState_o.frameIndex <= internalState_i.frameIndex;
|
frameWordCounter_o <= frameWordCounter_i;
|
internalState_o.frameWordCounter <= internalState_i.frameWordCounter;
|
inputRetryStopped_o <= inputRetryStopped_i;
|
internalState_o.inputRetryStopped <= internalState_i.inputRetryStopped;
|
inputErrorStopped_o <= inputErrorStopped_i;
|
internalState_o.inputErrorStopped <= internalState_i.inputErrorStopped;
|
|
|
rxControlWrite <= '0';
|
rxControlWrite <= '0';
|
rxControlSymbol <= (others => '0');
|
rxControlSymbol <= (others => '0');
|
|
|
writeFrame_o <= '0';
|
writeFrame_o <= '0';
|
writeFrameAbort_o <= '0';
|
writeFrameAbort_o <= '0';
|
writeContent_o <= '0';
|
writeContent_o <= '0';
|
writeContentWords_o <= (others => '0');
|
writeContentWords_o <= (others => '0');
|
|
|
-- Act on the current state.
|
-- Act on the current state.
|
if (operational_i = '0') then
|
if (internalState_i.operational = '0') then
|
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
-- The port is not operational and is waiting for status control
|
-- The port is not operational and is waiting for status control
|
-- symbols to be received on the link. Count the number
|
-- symbols to be received on the link. Count the number
|
-- of error-free status symbols and considder the link operational
|
-- of error-free status symbols and considder the link operational
|
-- when enough of them has been received. Frames are not allowed
|
-- when enough of them has been received. Frames are not allowed
|
Line 2484... |
Line 2471... |
-- error-free status symbols.
|
-- error-free status symbols.
|
if (stype0Status = '1') then
|
if (stype0Status = '1') then
|
-- The symbol is a status.
|
-- The symbol is a status.
|
|
|
-- Check if enough status symbols have been received.
|
-- Check if enough status symbols have been received.
|
if (unsigned(frameIndex_i) = 7) then
|
if (unsigned(internalState_i.frameIndex) = 7) then
|
-- Enough status symbols have been received.
|
-- Enough status symbols have been received.
|
|
|
-- Reset all packets.
|
-- Reset all packets.
|
frameIndex_o <= (others => '0');
|
internalState_o.frameIndex <= (others => '0');
|
writeFrameAbort_o <= '1';
|
writeFrameAbort_o <= '1';
|
|
|
-- Set the link as initialized.
|
-- Set the link as initialized.
|
operational_o <= '1';
|
internalState_o.operational <= '1';
|
else
|
else
|
-- Increase the number of error-free status symbols that
|
-- Increase the number of error-free status symbols that
|
-- has been received.
|
-- has been received.
|
frameIndex_o <= std_logic_vector(unsigned(frameIndex_i) + 1);
|
internalState_o.frameIndex <=
|
|
std_logic_vector(unsigned(internalState_i.frameIndex) + 1);
|
end if;
|
end if;
|
else
|
else
|
-- The symbol is not a status.
|
-- The symbol is not a status.
|
-- Dont do anything.
|
-- Dont do anything.
|
end if;
|
end if;
|
else
|
else
|
-- A control symbol with CRC5 error was recevied.
|
-- A control symbol with CRC5 error was recevied.
|
frameIndex_o <= (others => '0');
|
internalState_o.frameIndex <= (others => '0');
|
end if;
|
end if;
|
else
|
else
|
-- The port has become uninitialized.
|
-- The port has become uninitialized.
|
frameIndex_o <= (others => '0');
|
internalState_o.frameIndex <= (others => '0');
|
end if;
|
end if;
|
else
|
else
|
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
-- The port has been initialized and enough error free status symbols
|
-- The port has been initialized and enough error free status symbols
|
-- have been received. Forward data frames to the frame buffer
|
-- have been received. Forward data frames to the frame buffer
|
Line 2526... |
Line 2514... |
-- Check if the control symbol has a valid CRC-5.
|
-- Check if the control symbol has a valid CRC-5.
|
if (symbolValid = '1') then
|
if (symbolValid = '1') then
|
-- The symbol is correct.
|
-- The symbol is correct.
|
|
|
if ((stype1Start = '1') and
|
if ((stype1Start = '1') and
|
(inputRetryStopped_i = '0') and (inputErrorStopped_i = '0')) then
|
(internalState_i.inputRetryStopped = '0') and
|
|
(internalState_i.inputErrorStopped = '0')) then
|
-------------------------------------------------------------
|
-------------------------------------------------------------
|
-- Start the reception of a new frame or end a currently
|
-- Start the reception of a new frame or end a currently
|
-- ongoing frame and start a new one.
|
-- ongoing frame and start a new one.
|
-------------------------------------------------------------
|
-------------------------------------------------------------
|
|
|
-- Check if a frame has already been started.
|
-- Check if a frame has already been started.
|
if (unsigned(frameIndex_i) /= 0) then
|
if (unsigned(internalState_i.frameIndex) /= 0) then
|
-- A frame is already started.
|
-- A frame is already started.
|
-- Complete the last frame and start to ackumulate a new one
|
-- Complete the last frame and start to ackumulate a new one
|
-- and update the ackId.
|
-- and update the ackId.
|
|
|
if (unsigned(frameIndex_i) > 3) then
|
if (unsigned(internalState_i.frameIndex) > 3) then
|
|
|
-- Reset the frame index to indicate the frame is started.
|
-- Reset the frame index to indicate the frame is started.
|
frameIndex_o <= "0000001";
|
internalState_o.frameIndex <= "0000001";
|
frameWordCounter_o <= (others=>'0');
|
internalState_o.frameWordCounter <= (others=>'0');
|
|
|
-- Check the CRC-16 and the length of the received frame.
|
-- Check the CRC-16 and the length of the received frame.
|
if (crc16Valid = '1') then
|
if (crc16Valid = '1') then
|
-- The CRC-16 is ok.
|
-- The CRC-16 is ok.
|
|
|
-- Check if there are any unwritten buffered packet content
|
-- Check if there are any unwritten buffered packet content
|
-- and write it if there is.
|
-- and write it if there is.
|
-- REMARK: Multi-symbol support...
|
-- REMARK: Multi-symbol support...
|
if (unsigned(frameWordCounter_i) /= 0) then
|
if (unsigned(internalState_i.frameWordCounter) /= 0) then
|
writeContent_o <= '1';
|
writeContent_o <= '1';
|
end if;
|
end if;
|
|
|
-- Update the frame buffer to indicate that the frame has
|
-- Update the frame buffer to indicate that the frame has
|
-- been completly received.
|
-- been completly received.
|
writeFrame_o <= '1';
|
writeFrame_o <= '1';
|
|
|
-- Update ackId.
|
-- Update ackId.
|
ackId_o <= ackId_i + 1;
|
internalState_o.ackId <= internalState_i.ackId + 1;
|
|
|
-- Send packet-accepted.
|
-- Send packet-accepted.
|
-- The buffer status is appended by the transmitter
|
-- The buffer status is appended by the transmitter
|
-- when sent to get the latest number.
|
-- when sent to get the latest number.
|
rxControlWrite <= '1';
|
rxControlWrite <= '1';
|
rxControlSymbol <= STYPE0_PACKET_ACCEPTED &
|
rxControlSymbol <= STYPE0_PACKET_ACCEPTED &
|
std_logic_vector(ackId_i) &
|
std_logic_vector(internalState_i.ackId) &
|
"11111";
|
"11111";
|
else
|
else
|
-- The CRC-16 is not ok.
|
-- The CRC-16 is not ok.
|
|
|
-- Make the transmitter send a packet-not-accepted to indicate
|
-- Make the transmitter send a packet-not-accepted to indicate
|
-- that the received packet contained a CRC error.
|
-- that the received packet contained a CRC error.
|
rxControlWrite <= '1';
|
rxControlWrite <= '1';
|
rxControlSymbol <= STYPE0_PACKET_NOT_ACCEPTED &
|
rxControlSymbol <= STYPE0_PACKET_NOT_ACCEPTED &
|
"00000" &
|
"00000" &
|
PACKET_NOT_ACCEPTED_CAUSE_PACKET_CRC;
|
PACKET_NOT_ACCEPTED_CAUSE_PACKET_CRC;
|
inputErrorStopped_o <= '1';
|
internalState_o.inputErrorStopped <= '1';
|
end if;
|
end if;
|
else
|
else
|
-- This packet is too small.
|
-- This packet is too small.
|
-- Make the transmitter send a packet-not-accepted to indicated
|
-- Make the transmitter send a packet-not-accepted to indicated
|
-- that the received packet was too small.
|
-- that the received packet was too small.
|
rxControlWrite <= '1';
|
rxControlWrite <= '1';
|
rxControlSymbol <= STYPE0_PACKET_NOT_ACCEPTED &
|
rxControlSymbol <= STYPE0_PACKET_NOT_ACCEPTED &
|
"00000" &
|
"00000" &
|
PACKET_NOT_ACCEPTED_CAUSE_GENERAL_ERROR;
|
PACKET_NOT_ACCEPTED_CAUSE_GENERAL_ERROR;
|
inputErrorStopped_o <= '1';
|
internalState_o.inputErrorStopped <= '1';
|
end if;
|
end if;
|
else
|
else
|
-- No frame has been started.
|
-- No frame has been started.
|
|
|
-- Reset the frame index to indicate the frame is started.
|
-- Reset the frame index to indicate the frame is started.
|
frameIndex_o <= "0000001";
|
internalState_o.frameIndex <= "0000001";
|
frameWordCounter_o <= (others=>'0');
|
internalState_o.frameWordCounter <= (others=>'0');
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
if ((stype1End = '1') and
|
if ((stype1End = '1') and
|
(inputRetryStopped_i = '0') and (inputErrorStopped_i = '0')) then
|
(internalState_i.inputRetryStopped = '0') and
|
|
(internalState_i.inputErrorStopped = '0')) then
|
-------------------------------------------------------------
|
-------------------------------------------------------------
|
-- End the reception of an old frame.
|
-- End the reception of an old frame.
|
-------------------------------------------------------------
|
-------------------------------------------------------------
|
|
|
-- Check if a frame has already been started.
|
-- Check if a frame has already been started.
|
if (unsigned(frameIndex_i) > 3) then
|
if (unsigned(internalState_i.frameIndex) > 3) then
|
-- A frame has been started and it is large enough.
|
-- A frame has been started and it is large enough.
|
|
|
-- Reset frame reception to indicate that no frame is ongoing.
|
-- Reset frame reception to indicate that no frame is ongoing.
|
frameIndex_o <= (others => '0');
|
internalState_o.frameIndex <= (others => '0');
|
|
|
-- Check the CRC-16 and the length of the received frame.
|
-- Check the CRC-16 and the length of the received frame.
|
if (crc16Valid = '1') then
|
if (crc16Valid = '1') then
|
-- The CRC-16 is ok.
|
-- The CRC-16 is ok.
|
|
|
-- Check if there are any unwritten buffered packet content
|
-- Check if there are any unwritten buffered packet content
|
-- and write it if there is.
|
-- and write it if there is.
|
-- REMARK: Multi-symbol support...
|
-- REMARK: Multi-symbol support...
|
if (unsigned(frameWordCounter_i) /= 0) then
|
if (unsigned(internalState_i.frameWordCounter) /= 0) then
|
writeContent_o <= '1';
|
writeContent_o <= '1';
|
end if;
|
end if;
|
|
|
-- Update the frame buffer to indicate that the frame has
|
-- Update the frame buffer to indicate that the frame has
|
-- been completly received.
|
-- been completly received.
|
writeFrame_o <= '1';
|
writeFrame_o <= '1';
|
|
|
-- Update ackId.
|
-- Update ackId.
|
ackId_o <= ackId_i + 1;
|
internalState_o.ackId <= internalState_i.ackId + 1;
|
|
|
-- Send packet-accepted.
|
-- Send packet-accepted.
|
-- The buffer status is appended by the transmitter
|
-- The buffer status is appended by the transmitter
|
-- when sent to get the latest number.
|
-- when sent to get the latest number.
|
rxControlWrite <= '1';
|
rxControlWrite <= '1';
|
rxControlSymbol <= STYPE0_PACKET_ACCEPTED &
|
rxControlSymbol <= STYPE0_PACKET_ACCEPTED &
|
std_logic_vector(ackId_i) &
|
std_logic_vector(internalState_i.ackId) &
|
"11111";
|
"11111";
|
else
|
else
|
-- The CRC-16 is not ok.
|
-- The CRC-16 is not ok.
|
|
|
-- Make the transmitter send a packet-not-accepted to indicate
|
-- Make the transmitter send a packet-not-accepted to indicate
|
-- that the received packet contained a CRC error.
|
-- that the received packet contained a CRC error.
|
rxControlWrite <= '1';
|
rxControlWrite <= '1';
|
rxControlSymbol <= STYPE0_PACKET_NOT_ACCEPTED &
|
rxControlSymbol <= STYPE0_PACKET_NOT_ACCEPTED &
|
"00000" &
|
"00000" &
|
PACKET_NOT_ACCEPTED_CAUSE_PACKET_CRC;
|
PACKET_NOT_ACCEPTED_CAUSE_PACKET_CRC;
|
inputErrorStopped_o <= '1';
|
internalState_o.inputErrorStopped <= '1';
|
end if;
|
end if;
|
else
|
else
|
-- This packet is too small.
|
-- This packet is too small.
|
-- Make the transmitter send a packet-not-accepted to indicate
|
-- Make the transmitter send a packet-not-accepted to indicate
|
-- that the received packet was too small.
|
-- that the received packet was too small.
|
rxControlWrite <= '1';
|
rxControlWrite <= '1';
|
rxControlSymbol <= STYPE0_PACKET_NOT_ACCEPTED &
|
rxControlSymbol <= STYPE0_PACKET_NOT_ACCEPTED &
|
"00000" &
|
"00000" &
|
PACKET_NOT_ACCEPTED_CAUSE_GENERAL_ERROR;
|
PACKET_NOT_ACCEPTED_CAUSE_GENERAL_ERROR;
|
inputErrorStopped_o <= '1';
|
internalState_o.inputErrorStopped <= '1';
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
if ((stype1Stomp = '1') and
|
if ((stype1Stomp = '1') and
|
(inputRetryStopped_i = '0') and (inputErrorStopped_i = '0')) then
|
(internalState_i.inputRetryStopped = '0') and
|
|
(internalState_i.inputErrorStopped = '0')) then
|
-------------------------------------------------------------
|
-------------------------------------------------------------
|
-- Restart the reception of an old frame.
|
-- Restart the reception of an old frame.
|
-------------------------------------------------------------
|
-------------------------------------------------------------
|
-- See 5.10 in the standard.
|
-- See 5.10 in the standard.
|
|
|
-- Make the transmitter send a packet-retry to indicate
|
-- Make the transmitter send a packet-retry to indicate
|
-- that the packet cannot be accepted.
|
-- that the packet cannot be accepted.
|
rxControlWrite <= '1';
|
rxControlWrite <= '1';
|
rxControlSymbol <= STYPE0_PACKET_RETRY &
|
rxControlSymbol <= STYPE0_PACKET_RETRY &
|
std_logic_vector(ackId_i) &
|
std_logic_vector(internalState_i.ackId) &
|
"11111";
|
"11111";
|
|
|
-- Enter the input retry-stopped state.
|
-- Enter the input retry-stopped state.
|
inputRetryStopped_o <= '1';
|
internalState_o.inputRetryStopped <= '1';
|
end if;
|
end if;
|
|
|
if (stype1Restart = '1') then
|
if (stype1Restart = '1') then
|
if (inputRetryStopped_i = '1') then
|
if (internalState_i.inputRetryStopped = '1') then
|
-------------------------------------------------------------
|
-------------------------------------------------------------
|
-- The receiver indicates a restart from a retry sent
|
-- The receiver indicates a restart from a retry sent
|
-- from us.
|
-- from us.
|
-------------------------------------------------------------
|
-------------------------------------------------------------
|
|
|
-- Abort the frame and reset frame reception.
|
-- Abort the frame and reset frame reception.
|
frameIndex_o <= (others => '0');
|
internalState_o.frameIndex <= (others => '0');
|
writeFrameAbort_o <= '1';
|
writeFrameAbort_o <= '1';
|
|
|
-- Go back to the normal operational state.
|
-- Go back to the normal operational state.
|
inputRetryStopped_o <= '0';
|
internalState_o.inputRetryStopped <= '0';
|
else
|
else
|
-------------------------------------------------------------
|
-------------------------------------------------------------
|
-- The receiver indicates a restart from a retry sent
|
-- The receiver indicates a restart from a retry sent
|
-- from us.
|
-- from us.
|
-------------------------------------------------------------
|
-------------------------------------------------------------
|
Line 2706... |
Line 2697... |
-- error has occurred.
|
-- error has occurred.
|
rxControlWrite <= '1';
|
rxControlWrite <= '1';
|
rxControlSymbol <= STYPE0_PACKET_NOT_ACCEPTED &
|
rxControlSymbol <= STYPE0_PACKET_NOT_ACCEPTED &
|
"00000" &
|
"00000" &
|
PACKET_NOT_ACCEPTED_CAUSE_GENERAL_ERROR;
|
PACKET_NOT_ACCEPTED_CAUSE_GENERAL_ERROR;
|
inputErrorStopped_o <= '1';
|
internalState_o.inputErrorStopped <= '1';
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
if (stype1LinkRequest = '1') then
|
if (stype1LinkRequest = '1') then
|
-------------------------------------------------------------
|
-------------------------------------------------------------
|
Line 2721... |
Line 2712... |
if (symbolContent1(15 downto 13) = "100") then
|
if (symbolContent1(15 downto 13) = "100") then
|
-- Return input port status command.
|
-- Return input port status command.
|
-- This functions as a link-request(restart-from-error)
|
-- This functions as a link-request(restart-from-error)
|
-- control symbol under error situations.
|
-- control symbol under error situations.
|
|
|
if (inputErrorStopped_i = '1') then
|
if (internalState_i.inputErrorStopped = '1') then
|
rxControlWrite <= '1';
|
rxControlWrite <= '1';
|
rxControlSymbol <= STYPE0_LINK_RESPONSE &
|
rxControlSymbol <= STYPE0_LINK_RESPONSE &
|
std_logic_vector(ackId_i) &
|
std_logic_vector(internalState_i.ackId) &
|
"00101";
|
"00101";
|
elsif (inputRetryStopped_i = '1') then
|
elsif (internalState_i.inputRetryStopped = '1') then
|
rxControlWrite <= '1';
|
rxControlWrite <= '1';
|
rxControlSymbol <= STYPE0_LINK_RESPONSE &
|
rxControlSymbol <= STYPE0_LINK_RESPONSE &
|
std_logic_vector(ackId_i) &
|
std_logic_vector(internalState_i.ackId) &
|
"00100";
|
"00100";
|
else
|
else
|
-- Send a link response containing an ok reply.
|
-- Send a link response containing an ok reply.
|
rxControlWrite <= '1';
|
rxControlWrite <= '1';
|
rxControlSymbol <= STYPE0_LINK_RESPONSE &
|
rxControlSymbol <= STYPE0_LINK_RESPONSE &
|
std_logic_vector(ackId_i) &
|
std_logic_vector(internalState_i.ackId) &
|
"10000";
|
"10000";
|
end if;
|
end if;
|
else
|
else
|
-- Reset device command or other unsupported command.
|
-- Reset device command or other unsupported command.
|
-- Discard this.
|
-- Discard this.
|
end if;
|
end if;
|
|
|
-- Abort the frame and reset frame reception.
|
-- Abort the frame and reset frame reception.
|
inputRetryStopped_o <= '0';
|
internalState_o.inputRetryStopped <= '0';
|
inputErrorStopped_o <= '0';
|
internalState_o.inputErrorStopped <= '0';
|
frameIndex_o <= (others=>'0');
|
internalState_o.frameIndex <= (others=>'0');
|
writeFrameAbort_o <= '1';
|
writeFrameAbort_o <= '1';
|
end if;
|
end if;
|
|
|
if ((symbolData = '1') and
|
if ((symbolData = '1') and
|
(inputRetryStopped_i = '0') and (inputErrorStopped_i = '0')) then
|
(internalState_i.inputRetryStopped = '0') and
|
|
(internalState_i.inputErrorStopped = '0')) then
|
-------------------------------------------------------------
|
-------------------------------------------------------------
|
-- This is a data symbol.
|
-- This is a data symbol.
|
-------------------------------------------------------------
|
-------------------------------------------------------------
|
-- REMARK: Add check for in-the-middle-crc here...
|
-- REMARK: Add check for in-the-middle-crc here...
|
|
|
case frameIndex_i is
|
case internalState_i.frameIndex is
|
when "0000000" | "1000110" =>
|
when "0000000" | "1000110" =>
|
-- A frame has not been started or is too long.
|
-- A frame has not been started or is too long.
|
-- Send packet-not-accepted.
|
-- Send packet-not-accepted.
|
rxControlWrite <= '1';
|
rxControlWrite <= '1';
|
rxControlSymbol <= STYPE0_PACKET_NOT_ACCEPTED &
|
rxControlSymbol <= STYPE0_PACKET_NOT_ACCEPTED &
|
"00000" &
|
"00000" &
|
PACKET_NOT_ACCEPTED_CAUSE_GENERAL_ERROR;
|
PACKET_NOT_ACCEPTED_CAUSE_GENERAL_ERROR;
|
inputErrorStopped_o <= '1';
|
internalState_o.inputErrorStopped <= '1';
|
when "0000001" =>
|
when "0000001" =>
|
if (unsigned(symbolContent1(31 downto 27)) = ackId_i) then
|
if (unsigned(symbolContent1(31 downto 27)) = internalState_i.ackId) then
|
if ((portEnable_i = '1') or
|
if ((portEnable_i = '1') or
|
(symbolContent1(19 downto 16) = FTYPE_MAINTENANCE_CLASS)) then
|
(symbolContent1(19 downto 16) = FTYPE_MAINTENANCE_CLASS)) then
|
|
|
-- Check if there are buffers available to store the new
|
-- Check if there are buffers available to store the new
|
-- packet.
|
-- packet.
|
Line 2780... |
Line 2772... |
-- data.
|
-- data.
|
|
|
-- Check if the buffer entry is ready to be written
|
-- Check if the buffer entry is ready to be written
|
-- into the packet buffer.
|
-- into the packet buffer.
|
-- REMARK: Multi-symbol support...
|
-- REMARK: Multi-symbol support...
|
if (unsigned(frameWordCounter_i) = (NUMBER_WORDS-1)) then
|
if (unsigned(internalState_i.frameWordCounter) = (NUMBER_WORDS-1)) then
|
-- Write the data to the frame FIFO.
|
-- Write the data to the frame FIFO.
|
frameWordCounter_o <= (others=>'0');
|
internalState_o.frameWordCounter <= (others=>'0');
|
writeContent_o <= '1';
|
writeContent_o <= '1';
|
writeContentWords_o <= frameWordCounter_i;
|
writeContentWords_o <= internalState_i.frameWordCounter;
|
else
|
else
|
frameWordCounter_o <= std_logic_vector(unsigned(frameWordCounter_i) + 1);
|
internalState_o.frameWordCounter <=
|
|
std_logic_vector(unsigned(internalState_i.frameWordCounter) + 1);
|
end if;
|
end if;
|
|
|
-- Increment the number of received data symbols.
|
-- Increment the number of received data symbols.
|
frameIndex_o <= std_logic_vector(unsigned(frameIndex_i) + 1);
|
internalState_o.frameIndex <=
|
|
std_logic_vector(unsigned(internalState_i.frameIndex) + 1);
|
else
|
else
|
-- The packet buffer is full.
|
-- The packet buffer is full.
|
-- Let the link-partner resend the packet.
|
-- Let the link-partner resend the packet.
|
rxControlWrite <= '1';
|
rxControlWrite <= '1';
|
rxControlSymbol <= STYPE0_PACKET_RETRY &
|
rxControlSymbol <= STYPE0_PACKET_RETRY &
|
std_logic_vector(ackId_i) &
|
std_logic_vector(internalState_i.ackId) &
|
"11111";
|
"11111";
|
inputRetryStopped_o <= '1';
|
internalState_o.inputRetryStopped <= '1';
|
end if;
|
end if;
|
else
|
else
|
-- A non-maintenance packets are not allowed.
|
-- A non-maintenance packets are not allowed.
|
-- Send packet-not-accepted.
|
-- Send packet-not-accepted.
|
rxControlWrite <= '1';
|
rxControlWrite <= '1';
|
rxControlSymbol <= STYPE0_PACKET_NOT_ACCEPTED &
|
rxControlSymbol <= STYPE0_PACKET_NOT_ACCEPTED &
|
"00000" &
|
"00000" &
|
PACKET_NOT_ACCEPTED_CAUSE_NON_MAINTENANCE_STOPPED;
|
PACKET_NOT_ACCEPTED_CAUSE_NON_MAINTENANCE_STOPPED;
|
inputErrorStopped_o <= '1';
|
internalState_o.inputErrorStopped <= '1';
|
end if;
|
end if;
|
else
|
else
|
-- The ackId is unexpected.
|
-- The ackId is unexpected.
|
-- Send packet-not-accepted.
|
-- Send packet-not-accepted.
|
rxControlWrite <= '1';
|
rxControlWrite <= '1';
|
rxControlSymbol <= STYPE0_PACKET_NOT_ACCEPTED &
|
rxControlSymbol <= STYPE0_PACKET_NOT_ACCEPTED &
|
"00000" &
|
"00000" &
|
PACKET_NOT_ACCEPTED_CAUSE_UNEXPECTED_ACKID;
|
PACKET_NOT_ACCEPTED_CAUSE_UNEXPECTED_ACKID;
|
inputErrorStopped_o <= '1';
|
internalState_o.inputErrorStopped <= '1';
|
end if;
|
end if;
|
when others =>
|
when others =>
|
-- A frame has been started and is not too long.
|
-- A frame has been started and is not too long.
|
-- Check if the buffer entry is ready to be written
|
-- Check if the buffer entry is ready to be written
|
-- into the packet buffer.
|
-- into the packet buffer.
|
-- REMARK: Multi-symbol support...
|
-- REMARK: Multi-symbol support...
|
if (unsigned(frameWordCounter_i) = (NUMBER_WORDS-1)) then
|
if (unsigned(internalState_i.frameWordCounter) = (NUMBER_WORDS-1)) then
|
-- Write the data to the frame FIFO.
|
-- Write the data to the frame FIFO.
|
frameWordCounter_o <= (others=>'0');
|
internalState_o.frameWordCounter <= (others=>'0');
|
writeContent_o <= '1';
|
writeContent_o <= '1';
|
writeContentWords_o <= frameWordCounter_i;
|
writeContentWords_o <= internalState_i.frameWordCounter;
|
else
|
else
|
frameWordCounter_o <= std_logic_vector(unsigned(frameWordCounter_i) + 1);
|
internalState_o.frameWordCounter <=
|
|
std_logic_vector(unsigned(internalState_i.frameWordCounter) + 1);
|
end if;
|
end if;
|
|
|
-- Increment the number of received data symbols.
|
-- Increment the number of received data symbols.
|
frameIndex_o <= std_logic_vector(unsigned(frameIndex_i) + 1);
|
internalState_o.frameIndex <=
|
|
std_logic_vector(unsigned(internalState_i.frameIndex) + 1);
|
end case;
|
end case;
|
end if;
|
end if;
|
else
|
else
|
-- A control symbol contains a crc error.
|
-- A control symbol contains a crc error.
|
|
|
Line 2845... |
Line 2841... |
-- control-symbol has been received and change state.
|
-- control-symbol has been received and change state.
|
rxControlWrite <= '1';
|
rxControlWrite <= '1';
|
rxControlSymbol <= STYPE0_PACKET_NOT_ACCEPTED &
|
rxControlSymbol <= STYPE0_PACKET_NOT_ACCEPTED &
|
"00000" &
|
"00000" &
|
PACKET_NOT_ACCEPTED_CAUSE_CONTROL_CRC;
|
PACKET_NOT_ACCEPTED_CAUSE_CONTROL_CRC;
|
inputErrorStopped_o <= '1';
|
internalState_o.inputErrorStopped <= '1';
|
end if;
|
end if;
|
else
|
else
|
-- The port has become uninitialized.
|
-- The port has become uninitialized.
|
-- Go back to the uninitialized state.
|
-- Go back to the uninitialized state.
|
operational_o <= '0';
|
internalState_o.operational <= '0';
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|