1 ------------------------------------------------------------------------------- 2 -- File : JesdRxReg.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2015-04-15 5 -- Last update: 2016-09-23 6 ------------------------------------------------------------------------------- 7 -- Description: AXI-Lite interface for register access 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;
28 --! @ingroup protocols_jesd204b 31 -- General Configurations 36 -- Number of RX lanes (1 to 32) 37 L_G : positive range 1 to 32 := 2);
43 -- Axi-Lite Register Interface (locClk domain) 60 enableRx_o :
out slv(L_G-1
downto 0);
78 type RegType is record 80 enableRx : slv(L_G-1
downto 0);
81 invertData : slv(L_G-1 downto 0);
82 commonCtrl : slv(5 downto 0);
83 linkErrMask : slv(5 downto 0);
95 constant REG_INIT_C : RegType := ( 96 enableRx => (
others => '0'),
97 invertData => (others => '0'), 98 commonCtrl => "010111", 99 linkErrMask => "111111", 100 sysrefDlyRx => (others => '0'), 101 testTXItf => (others => x"0000"), 102 testSigThr => (others => x"A000_5000"), 109 signal r : RegType := REG_INIT_C;
110 signal rin : RegType;
113 signal s_RdAddr : := 0;
114 signal s_WrAddr : := 0;
116 -- Synced status signals 118 signal s_rawData : slv32Array(L_G-1 downto 0);
120 signal s_adcValids : slv(L_G-1 downto 0);
125 ---------------------------------------------------------------------------------------------- 126 -- Data Valid Status Counter 127 ---------------------------------------------------------------------------------------------- 128 GEN_LANES : for I in L_G-1 downto 0 generate 130 end generate GEN_LANES;
141 -- Input Status bit Signals (wrClk domain) 143 -- Output Status bit Signals (rdClk domain) 145 -- Status Bit Counters Signals (rdClk domain) 148 -- Clocks and Reset Ports 152 -- Convert address to integer (lower two bits of address are always '0') 157 s_WrAddr, s_statusRxArr, s_statusCnt, s_rawData)
is 158 variable v : RegType;
160 variable axilWriteResp : slv(1 downto 0);
161 variable axilReadResp : slv(1 downto 0);
163 -- Latch the current value 166 ---------------------------------------------------------------------------------------------- 167 -- Axi-Lite interface 168 ---------------------------------------------------------------------------------------------- 174 when 16#00# => -- ADDR (0x00) 176 when 16#01# => -- ADDR (0x04) 178 when 16#02# => -- ADDR (0x08) 180 when 16#04# => -- ADDR (0x10) 182 when 16#05# => -- ADDR (0x14) 184 when 16#06# => -- ADDR (0x18) 186 when 16#20# to 16#2F# => 187 for I in (L_G-1) downto 0 loop 192 when 16#30# to 16#3F# => 193 for I in (L_G-1) downto 0 loop 208 when 16#00# => -- ADDR (0x0) 210 when 16#01# => -- ADDR (0x04) 212 when 16#02# => -- ADDR (0x08) 214 when 16#04# => -- ADDR (0x10) 216 when 16#05# => -- ADDR (0x14) 218 when 16#06# => -- ADDR (0x18) 220 when 16#10# to 16#1F# => 221 for I in (L_G-1) downto 0 loop 226 when 16#20# to 16#2F# => 227 for I in (L_G-1) downto 0 loop 232 when 16#30# to 16#3F# => 233 for I in (L_G-1) downto 0 loop 238 when 16#40# to 16#4F# => 239 for I in (L_G-1) downto 0 loop 241 for J in 31 downto 0 loop 246 when 16#50# to 16#5F# => 247 for I in (L_G-1) downto 0 loop 263 -- Register the variable for next clock cycle 276 r <= rin after TPD_G;
280 -- Input assignment and synchronization 281 GEN_0 : for I in L_G-1 downto 0 generate 291 dout => s_statusRxArr
(I
) 307 -- Output assignment and synchronization 316 din => r.sysrefDlyRx,
341 dataIn => r.commonCtrl
(0),
352 dataIn => r.commonCtrl
(1),
363 dataIn => r.commonCtrl
(2),
374 dataIn => r.commonCtrl
(3),
385 dataIn => r.commonCtrl
(4),
396 dataIn => r.commonCtrl
(5),
425 GEN_1 : for I in L_G-1 downto 0 generate 434 din => r.testTXItf
(I
) (11 downto 8),
460 din => r.testSigThr
(I
) (31 downto 16),
473 din => r.testSigThr
(I
) (15 downto 0),
478 ---------------------------------------------------------------------
AXI_ADDR_WIDTH_Gpositive := 10
out alignTxArr_oalignTxArray( L_G- 1 downto 0)
array(natural range <> ) of slv( 31 downto 0) Slv32Array
out thresoldLowArr_oSlv16Array( L_G- 1 downto 0)
out enableRx_oslv( L_G- 1 downto 0)
in rstsl :=not RST_POLARITY_G
in dinslv( DATA_WIDTH_G- 1 downto 0)
out axilWriteSlaveAxiLiteWriteSlaveType
array(natural range <> ,natural range <> ) of sl SlVectorArray
array(natural range <> ) of slv(( RX_STAT_WIDTH_C)- 1 downto 0) rxStatuRegisterArray
positive := 19+ 2* GT_WORD_SIZE_C RX_STAT_WIDTH_C
PIPE_STAGES_Gnatural range 0 to 16:= 0
out linkErrMask_oslv( 5 downto 0)
in rawData_islv32Array( L_G- 1 downto 0)
in dataInslv( WIDTH_G- 1 downto 0)
out cntOutSlVectorArray ( WIDTH_G- 1 downto 0, CNT_WIDTH_G- 1 downto 0)
out doutslv( DATA_WIDTH_G- 1 downto 0)
CNT_WIDTH_Gpositive := 32
slv( 1 downto 0) := "10" AXI_RESP_SLVERR_C
in axilWriteMasterAxiLiteWriteMasterType := AXI_LITE_WRITE_MASTER_INIT_C
array(natural range <> ) of slv(( GT_WORD_SIZE_C)- 1 downto 0) alignTxArray
positive := 4 GT_WORD_SIZE_C
out sysrefDlyRx_oslv( SYSRF_DLY_WIDTH_C- 1 downto 0)
out thresoldHighArr_oSlv16Array( L_G- 1 downto 0)
AxiLiteReadSlaveType :=(arready => '0',rdata =>( others => '0'),rresp =>( others => '0'),rvalid => '0') AXI_LITE_READ_SLAVE_INIT_C
out dataOutslv( WIDTH_G- 1 downto 0)
in axilReadMasterAxiLiteReadMasterType := AXI_LITE_READ_MASTER_INIT_C
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_SLVERR_C
out invertData_oslv( L_G- 1 downto 0)
array(natural range <> ) of slv( 15 downto 0) Slv16Array
CNT_RST_EDGE_Gboolean := true
positive := 5 SYSRF_DLY_WIDTH_C
AxiLiteReadMasterType :=(araddr =>( others => '0'),arprot =>( others => '0'),arvalid => '0',rready => '1') AXI_LITE_READ_MASTER_INIT_C
AxiLiteWriteMasterType :=(awaddr =>( others => '0'),awprot =>( others => '0'),awvalid => '0',wdata =>( others => '0'),wstrb =>( others => '1'),wvalid => '0',bready => '1') AXI_LITE_WRITE_MASTER_INIT_C
slv( 1 downto 0) := "00" AXI_RESP_OK_C
in rstsl :=not RST_POLARITY_G
out dlyTxArr_oSlv4Array( L_G- 1 downto 0)
out statusOutslv( WIDTH_G- 1 downto 0)
out rxPolarityslv( L_G- 1 downto 0)
AxiLiteWriteSlaveType :=(awready => '0',wready => '0',bresp =>( others => '0'),bvalid => '0') AXI_LITE_WRITE_SLAVE_INIT_C
in statusRxArr_irxStatuRegisterArray( L_G- 1 downto 0)
L_Gpositive range 1 to 32:= 2
array(natural range <> ) of slv( 3 downto 0) Slv4Array
out axilReadSlaveAxiLiteReadSlaveType
DATA_WIDTH_Ginteger range 1 to ( 2** 24):= 16
in statusInslv( WIDTH_G- 1 downto 0)