1 ------------------------------------------------------------------------------- 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2015-04-07 5 -- Last update: 2016-10-06 6 ------------------------------------------------------------------------------- 7 -- Description: AXI-Lite XAUI 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_XauiCore_core 35 -- Local Configurations 36 localMac :
in slv(
47 downto 0) := MAC_ADDR_INIT_C;
37 -- AXI-Lite Register Interface 44 -- Configuration and Status Interface 47 config :
out XauiConfig;
53 constant STATUS_SIZE_C : positive := 32;
55 type RegType is record 58 rollOverEn : slv(STATUS_SIZE_C-1 downto 0);
64 constant REG_INIT_C : RegType := ( 67 rollOverEn => (others => '0'), 68 config => XAUI_CONFIG_INIT_C,
72 signal r : RegType := REG_INIT_C;
75 signal statusOut : slv(STATUS_SIZE_C-1 downto 0);
76 signal cntOut : SlVectorArray(STATUS_SIZE_C-1 downto 0, 31 downto 0);
77 signal localMacSync : slv(47 downto 0);
104 process (localMacSync)
is 108 retVar.macConfig.macAddress := localMacSync;
125 -- Input Status bit Signals (wrClk domain) 126 statusIn
(0) => status.phyReady,
127 statusIn
(1) => status.macStatus.rxPauseCnt,
128 statusIn
(2) => status.macStatus.txPauseCnt,
129 statusIn
(3) => status.macStatus.rxCountEn,
130 statusIn
(4) => status.macStatus.rxOverFlow,
131 statusIn
(5) => status.macStatus.rxCrcErrorCnt,
132 statusIn
(6) => status.macStatus.txCountEn,
133 statusIn
(7) => status.macStatus.txUnderRunCnt,
134 statusIn
(8) => status.macStatus.txNotReadyCnt,
135 statusIn
(9) => status.areset,
136 statusIn
(10) => status.clkLock,
137 statusIn
(18 downto 11) => status.statusVector,
138 statusIn
(24 downto 19) => status.debugVector,
139 statusIn
(31 downto 25) =>
(others => '0'
),
140 -- Output Status bit Signals (rdClk domain) 142 -- Status Bit Counters Signals (rdClk domain) 146 -- Clocks and Reset Ports 150 ------------------------------- 151 -- Configuration Register 152 ------------------------------- 154 variable v : RegType;
155 variable regCon : AxiLiteEndPointType;
158 -- Latch the current value 161 -- Determine the transaction type 164 -- Reset strobe signals 169 -- Calculate the read pointer 173 axiSlaveRegisterR(regCon, "0000--------", 0, muxSlVectorArray(cntOut, rdPntr));
174 axiSlaveRegisterR(regCon, x"100", 0, statusOut);
175 --axiSlaveRegisterR(regCon, x"104", 0, status.macStatus.rxPauseValue); 177 axiSlaveRegister(regCon, x"200", 0, v.config.macConfig.macAddress(31 downto 0));
178 axiSlaveRegister(regCon, x"204", 0, v.config.macConfig.macAddress(47 downto 32));
179 --axiSlaveRegister(regCon, x"208", 0, v.config.macConfig.byteSwap); 181 --axiSlaveRegister(regCon, x"210", 0, v.config.macConfig.txShift); 182 --axiSlaveRegister(regCon, x"214", 0, v.config.macConfig.txShiftEn); 183 --axiSlaveRegister(regCon, x"218", 0, v.config.macConfig.interFrameGap); 186 --axiSlaveRegister(regCon, x"220", 0, v.config.macConfig.rxShift); 187 --axiSlaveRegister(regCon, x"224", 0, v.config.macConfig.rxShiftEn); 193 axiSlaveRegister(regCon, x"F00", 0, v.rollOverEn);
194 axiSlaveRegister(regCon, x"FF4", 0, v.cntRst);
196 axiSlaveRegister(regCon, x"FFC", 0, v.hardRst);
198 -- Closeout the transaction 202 if (axiRst = '1') or (v.hardRst = '1') then 204 v.rollOverEn := (others => '0');
212 -- Update the MAC address 215 -- Register the variable for next clock cycle 226 if rising_edge(axiClk) then 227 r <= rin after TPD_G;
231 -- There is a Synchronizer one layer up for software reset 232 config.softRst <= r.config.softRst;
240 din => r.config.macConfig.macAddress,
242 dout => config.macConfig.macAddress
);
250 din => r.config.macConfig.pauseTime,
252 dout => config.macConfig.pauseTime
);
262 dataIn
(0) => r.config.macConfig.filtEnable,
263 dataIn
(1) => r.config.macConfig.pauseEnable,
264 dataIn
(2) => r.config.macConfig.ipCsumEn,
265 dataIn
(3) => r.config.macConfig.tcpCsumEn,
266 dataIn
(4) => r.config.macConfig.udpCsumEn,
268 dataOut
(0) => config.macConfig.filtEnable,
269 dataOut
(1) => config.macConfig.pauseEnable,
270 dataOut
(2) => config.macConfig.ipCsumEn,
271 dataOut
(3) => config.macConfig.tcpCsumEn,
272 dataOut
(4) => config.macConfig.udpCsumEn
);
280 din => r.config.configVector,
282 dout => config.configVector
);
EthMacConfigType macConfig
in localMacslv( 47 downto 0) := MAC_ADDR_INIT_C
in dinslv( DATA_WIDTH_G- 1 downto 0)
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_SLVERR_C
out axiWriteSlaveAxiLiteWriteSlaveType
array(natural range <> ,natural range <> ) of sl SlVectorArray
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_OK_C
COMMON_CLK_Gboolean := false
in dataInslv( WIDTH_G- 1 downto 0)
out cntOutSlVectorArray ( WIDTH_G- 1 downto 0, CNT_WIDTH_G- 1 downto 0)
in axiReadMasterAxiLiteReadMasterType
out doutslv( DATA_WIDTH_G- 1 downto 0)
out axiReadSlaveAxiLiteReadSlaveType
slv( 6 downto 0) configVector
CNT_WIDTH_Gpositive := 32
slv( 1 downto 0) := "10" AXI_RESP_SLVERR_C
XauiConfig :=(softRst => '0',macConfig => ETH_MAC_CONFIG_INIT_C,configVector =>( others => '0')) XAUI_CONFIG_INIT_C
out axiReadSlaveAxiLiteReadSlaveType
in rollOverEnInslv( WIDTH_G- 1 downto 0) :=( others => '0')
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)
CNT_RST_EDGE_Gboolean := true
EN_AXI_REG_Gboolean := false
in axiWriteMasterAxiLiteWriteMasterType
in axiWriteMasterAxiLiteWriteMasterType
out statusOutslv( WIDTH_G- 1 downto 0)
AxiLiteWriteSlaveType :=(awready => '0',wready => '0',bresp =>( others => '0'),bvalid => '0') AXI_LITE_WRITE_SLAVE_INIT_C
DATA_WIDTH_Ginteger range 1 to ( 2** 24):= 16
out axiWriteSlaveAxiLiteWriteSlaveType