1 ------------------------------------------------------------------------------- 2 -- File : TenGigEthReg.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2015-02-20 5 -- Last update: 2016-10-06 6 ------------------------------------------------------------------------------- 7 -- Description: AXI-Lite 10GbE Register Interface 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 ethernet_TenGigEthCore_core 35 -- Local Configurations 36 localMac :
in slv(
47 downto 0) := MAC_ADDR_INIT_C;
40 -- AXI-Lite Register Interface 45 -- Configuration and Status Interface 46 config :
out TenGigEthConfig;
52 constant STATUS_SIZE_C : positive := 32;
54 type RegType is record 57 rollOverEn : slv(STATUS_SIZE_C-1 downto 0);
58 config : TenGigEthConfig;
63 constant REG_INIT_C : RegType := ( 66 rollOverEn => (others => '0'), 67 config => TEN_GIG_ETH_CONFIG_INIT_C,
71 signal r : RegType := REG_INIT_C;
74 signal statusOut : slv(STATUS_SIZE_C-1 downto 0);
75 signal cntOut : SlVectorArray(STATUS_SIZE_C-1 downto 0, 31 downto 0);
76 signal localMacSync : slv(47 downto 0);
103 process (localMacSync)
is 107 retVar.macConfig.macAddress := localMacSync;
124 -- Input Status bit Signals (wrClk domain) 125 statusIn
(0) => status.phyReady,
126 statusIn
(1) => status.macStatus.rxPauseCnt,
127 statusIn
(2) => status.macStatus.txPauseCnt,
128 statusIn
(3) => status.macStatus.rxCountEn,
129 statusIn
(4) => status.macStatus.rxOverFlow,
130 statusIn
(5) => status.macStatus.rxCrcErrorCnt,
131 statusIn
(6) => status.macStatus.txCountEn,
132 statusIn
(7) => status.macStatus.txUnderRunCnt,
133 statusIn
(8) => status.macStatus.txNotReadyCnt,
134 statusIn
(9) => status.txDisable,
135 statusIn
(10) => status.sigDet,
136 statusIn
(11) => status.txFault,
137 statusIn
(12) => status.gtTxRst,
138 statusIn
(13) => status.gtRxRst,
139 statusIn
(14) => status.rstCntDone,
140 statusIn
(15) => status.qplllock,
141 statusIn
(16) => status.txRstdone,
142 statusIn
(17) => status.rxRstdone,
143 statusIn
(18) => status.txUsrRdy,
144 statusIn
(31 downto 19) =>
(others => '0'
),
145 -- Output Status bit Signals (rdClk domain) 147 -- Status Bit Counters Signals (rdClk domain) 151 -- Clocks and Reset Ports 155 ------------------------------- 156 -- Configuration Register 157 ------------------------------- 159 variable v : RegType;
160 variable regCon : AxiLiteEndPointType;
163 -- Latch the current value 166 -- Determine the transaction type 169 -- Reset strobe signals 174 -- Calculate the read pointer 178 axiSlaveRegisterR(regCon, "0000--------", 0, muxSlVectorArray(cntOut, rdPntr));
179 axiSlaveRegisterR(regCon, x"100", 0, statusOut);
180 --axiSlaveRegisterR(regCon, x"104", 0, status.macStatus.rxPauseValue); 183 axiSlaveRegister(regCon, x"200", 0, v.config.macConfig.macAddress(31 downto 0));
184 axiSlaveRegister(regCon, x"204", 0, v.config.macConfig.macAddress(47 downto 32));
185 --axiSlaveRegister(regCon, x"208", 0, v.config.macConfig.byteSwap); 187 --axiSlaveRegister(regCon, x"210", 0, v.config.macConfig.txShift); 188 --axiSlaveRegister(regCon, x"214", 0, v.config.macConfig.txShiftEn); 189 --axiSlaveRegister(regCon, x"218", 0, v.config.macConfig.interFrameGap); 192 --axiSlaveRegister(regCon, x"220", 0, v.config.macConfig.rxShift); 193 --axiSlaveRegister(regCon, x"224", 0, v.config.macConfig.rxShiftEn); 203 axiSlaveRegister(regCon, x"F00", 0, v.rollOverEn);
204 axiSlaveRegister(regCon, x"FF4", 0, v.cntRst);
206 axiSlaveRegister(regCon, x"FFC", 0, v.hardRst);
208 -- Closeout the transaction 212 if (rst = '1') or (v.hardRst = '1') then 214 v.rollOverEn := (others => '0');
222 -- Update the MAC address 225 -- Register the variable for next clock cycle 235 seq :
process (
clk)
is 237 if rising_edge(clk) then 238 r <= rin after TPD_G;
in axiReadMasterAxiLiteReadMasterType
EN_AXI_REG_Gboolean := false
out axiWriteSlaveAxiLiteWriteSlaveType
array(natural range <> ,natural range <> ) of sl SlVectorArray
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_OK_C
out axiReadSlaveAxiLiteReadSlaveType
slv( 7 downto 0) core_status
EthMacConfigType macConfig
COMMON_CLK_Gboolean := false
in dataInslv( WIDTH_G- 1 downto 0)
out cntOutSlVectorArray ( WIDTH_G- 1 downto 0, CNT_WIDTH_G- 1 downto 0)
CNT_WIDTH_Gpositive := 32
slv( 1 downto 0) := "10" AXI_RESP_SLVERR_C
slv( 2 downto 0) pma_pmd_type
out axiReadSlaveAxiLiteReadSlaveType
in rollOverEnInslv( WIDTH_G- 1 downto 0) :=( others => '0')
out axiWriteSlaveAxiLiteWriteSlaveType
in axiReadMasterAxiLiteReadMasterType
AxiLiteReadSlaveType :=(arready => '0',rdata =>( others => '0'),rresp =>( others => '0'),rvalid => '0') AXI_LITE_READ_SLAVE_INIT_C
out dataOutslv( WIDTH_G- 1 downto 0)
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_SLVERR_C
in axiWriteMasterAxiLiteWriteMasterType
CNT_RST_EDGE_Gboolean := true
out configTenGigEthConfig
in axiWriteMasterAxiLiteWriteMasterType
in localMacslv( 47 downto 0) := MAC_ADDR_INIT_C
out statusOutslv( WIDTH_G- 1 downto 0)
AxiLiteWriteSlaveType :=(awready => '0',wready => '0',bresp =>( others => '0'),bvalid => '0') AXI_LITE_WRITE_SLAVE_INIT_C
TenGigEthConfig :=(softRst => '0',macConfig => ETH_MAC_CONFIG_INIT_C,pma_pmd_type => "111",pma_loopback => '0',pma_reset => '0',pcs_loopback => '0',pcs_reset => '0') TEN_GIG_ETH_CONFIG_INIT_C