1 ------------------------------------------------------------------------------- 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2015-09-01 5 -- Last update: 2015-09-04 6 ------------------------------------------------------------------------------- 7 -- Description: SALT RX Engine Module 8 ------------------------------------------------------------------------------- 9 -- This file is part of 'SLAC Firmware Standard Library'. 10 -- It is subject to the license terms in the LICENSE.txt file found in the 11 -- top-level directory of this distribution and at: 12 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. 13 -- No part of 'SLAC Firmware Standard Library', including this file, 14 -- may be copied, modified, propagated, or distributed except according to 15 -- the terms contained in the LICENSE.txt file. 16 ------------------------------------------------------------------------------- 19 use ieee.std_logic_1164.
all;
20 use ieee.std_logic_unsigned.
all;
21 use ieee.std_logic_arith.
all;
29 --! @ingroup protocols_salt_core 49 architecture rtl
of SaltRx is
58 type RegType is record 62 seqCnt : slv(7 downto 0);
64 length : slv(15 downto 0);
65 cnt : slv(15 downto 0);
66 checksum : slv(31 downto 0);
67 alignCnt : range 0 to 3;
73 constant REG_INIT_C : RegType := ( 77 seqCnt => (others => '0'), 78 tDest => (others => '0'), 79 length => (others => '0'), 80 cnt => (others => '0'), 81 checksum => (others => '0'), 88 signal r : RegType := REG_INIT_C;
99 -- Latch the current value 104 if txSlave.tReady = '1' then 106 v.txMaster.tLast := '0';
107 v.txMaster.tUser := (others => '0');
110 -- Set the error flag 113 -- Check for valid inbound 117 v.rxMaster.tData(23 downto 0) := r.rxMaster.tData(31 downto 8);
118 -- Check if we are phase aligning 119 if (r.align = '1') then 120 -- Check for preamble and SFD 129 if r.alignCnt = 3 then 135 -- Increment the counter 136 v.alignCnt := r.alignCnt + 1;
142 v.rxMaster.tData := (others => '0');
147 ---------------------------------------------------------------------- 149 -- Check for valid data 150 if r.rxMaster.tValid = '1' then 154 -- Check for SOF header 163 elsif (r.rxMaster.tData(31 downto 0) = SOC_C) and (r.eofe = '0') then 164 -- Increment the counter 165 v.seqCnt := r.seqCnt + 1;
170 ---------------------------------------------------------------------- 172 -- Check for valid data 173 if r.rxMaster.tValid = '1' then 174 -- Latch the length and tDest 175 v.length := r.rxMaster.tData(15 downto 0);
178 v.checksum := r.rxMaster.tData(31 downto 0);
179 -- Check for invalid lengths or invalid sequence counter 180 if (v.length = 0) or (v.length > SALT_MAX_WORDS_C) or (r.rxMaster.tData(31 downto 24) /= r.seqCnt) then 181 -- Set the error flag 190 ---------------------------------------------------------------------- 192 -- Check for valid data 193 if (r.rxMaster.tValid = '1') and (v.txMaster.tValid = '0') then 194 -- Move the delay data 199 -- Create the delayed data 201 v.dly(0).tData(31 downto 0) := r.rxMaster.tData(31 downto 0);
210 if r.cnt = r.length then 212 v.cnt := (others => '0');
214 v.state := CHECKSUM_S;
216 -- Increment the counter 219 v.checksum := r.checksum + r.rxMaster.tData(31 downto 0);
222 ---------------------------------------------------------------------- 224 -- Check for valid checksum 225 if r.dly(0).tData(31 downto 0) = not(r.checksum) then 229 -- Set the error flag 234 ---------------------------------------------------------------------- 236 -- Check for valid data 237 if (r.rxMaster.tValid = '1') and (v.txMaster.tValid = '0') then 238 -- Move the delay data 241 -- Check for EOC footer 245 elsif r.rxMaster.tData(31 downto 0) = EOF_C then 247 v.txMaster.tLast := '1';
252 v.txMaster.tLast := '1';
256 -- Set the error flag 262 ---------------------------------------------------------------------- 265 -- Check for GMII frame error 267 -- Set the error flag 271 -- Overwrite the destination field 279 -- Register the variable for next clock cycle 283 txMaster <= r.txMaster;
287 seq :
process (
clk)
is 289 if rising_edge(clk) then 290 r <= rin after TPD_G;
296 -- General Configurations 301 -- FIFO configurations 307 -- AXI Stream Port Configurations
in mAxisSlaveAxiStreamSlaveType
out mAxisMasterAxiStreamMasterType
slv( 31 downto 0) := x"CCCCCCCC" SOC_C
slv( 31 downto 0) := x"D5555555" SFD_C
out mAxisMasterAxiStreamMasterType
AxiStreamMasterType :=(tValid => '0',tData =>( others => '0'),tStrb =>( others => '1'),tKeep =>( others => '1'),tLast => '0',tDest =>( others => '0'),tId =>( others => '0'),tUser =>( others => '0')) AXI_STREAM_MASTER_INIT_C
AxiStreamConfigType := ssiAxiStreamConfig( 4, TKEEP_COMP_C, TUSER_FIRST_LAST_C, 8) SSI_SALT_CONFIG_C
FIFO_ADDR_WIDTH_Ginteger range 4 to 48:= 9
MASTER_AXI_CONFIG_GAxiStreamConfigType := ssiAxiStreamConfig( 4)
GEN_SYNC_FIFO_Gboolean := false
VALID_THOLD_Gnatural := 1
slv( 31 downto 0) := x"DDDDDDDD" EOC_C
in rxDataslv( 7 downto 0)
USE_BUILT_IN_Gboolean := false
slv( 31 downto 0) := x"FFFFFFFF" EOFE_C
array(natural range <> ) of AxiStreamMasterType AxiStreamMasterArray
in mAxisSlaveAxiStreamSlaveType
EN_FRAME_FILTER_Gboolean := true
slv( 31 downto 0) := x"BBBBBBBB" SOF_C
SLAVE_AXI_CONFIG_GAxiStreamConfigType := SSI_CONFIG_INIT_C
COMMON_RX_CLK_Gboolean := false
CASCADE_SIZE_Gpositive := 1
PIPE_STAGES_Gnatural := 1
MASTER_AXI_CONFIG_GAxiStreamConfigType := SSI_CONFIG_INIT_C
slv( 31 downto 0) := x"EEEEEEEE" EOF_C
out sAxisSlaveAxiStreamSlaveType
natural :=( 1500/ 4) SALT_MAX_WORDS_C
in sAxisMasterAxiStreamMasterType