1 -------------------------------------------------------------------------------     2 -- File       : GigEthReg.vhd     3 -- Company    : SLAC National Accelerator Laboratory     4 -- Created    : 2015-02-20     5 -- Last update: 2017-05-12     6 -------------------------------------------------------------------------------     7 -- Description: AXI-Lite 1GbE 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_GigEthCore_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 GigEthConfigType;
    52    constant STATUS_SIZE_C  : positive := 32;
    54    type RegType is record    57       rollOverEn    : slv(STATUS_SIZE_C-1 downto 0);
    58       config        : GigEthConfigType;
    63    constant REG_INIT_C : RegType := (    66       rollOverEn    => (others => '0'),    67       config        => 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);
    87          monIn  => status.phyReady,
   113       process (localMacSync, wdtRst) 
is   117          retVar.macConfig.macAddress := localMacSync;
   135             -- Input Status bit Signals (wrClk domain)   136             statusIn
(0)           => status.phyReady,
   137             statusIn
(1)           => status.macStatus.rxPauseCnt,
   138             statusIn
(2)           => status.macStatus.txPauseCnt,
   139             statusIn
(3)           => status.macStatus.rxCountEn,
   140             statusIn
(4)           => status.macStatus.rxOverFlow,
   141             statusIn
(5)           => status.macStatus.rxCrcErrorCnt,
   142             statusIn
(6)           => status.macStatus.txCountEn,
   143             statusIn
(7)           => status.macStatus.txUnderRunCnt,
   144             statusIn
(8)           => status.macStatus.txNotReadyCnt,
   145             statusIn
(31 downto 9) => 
(others => '0'
),
   146             -- Output Status bit Signals (rdClk domain)              148             -- Status Bit Counters Signals (rdClk domain)    152             -- Clocks and Reset Ports   156       -------------------------------   157       -- Configuration Register   158       -------------------------------     160                       status, statusOut, wdtRst) 
is   161          variable v      : RegType;
   162          variable regCon : AxiLiteEndPointType;
   165          -- Latch the current value   168          -- Determine the transaction type   171          -- Reset strobe signals   176          -- Calculate the read pointer   180          axiSlaveRegisterR(regCon, "0000--------", 0, muxSlVectorArray(cntOut, rdPntr));
   181          axiSlaveRegisterR(regCon, x"100", 0, statusOut);
   182          --axiSlaveRegisterR(regCon,x"104", 0, status.macStatus.rxPauseValue);   185          axiSlaveRegister(regCon, x"200", 0, v.config.macConfig.macAddress(31 downto 0));
   186          axiSlaveRegister(regCon, x"204", 0, v.config.macConfig.macAddress(47 downto 32));
   187          --axiSlaveRegister(regCon,x"208", 0, v.config.macConfig.byteSwap);   189          --axiSlaveRegister(regCon,x"210", 0, v.config.macConfig.txShift);   190          --axiSlaveRegister(regCon,x"214", 0, v.config.macConfig.txShiftEn);   191          --axiSlaveRegister(regCon, x"218", 0, v.config.macConfig.interFrameGap);   194          --axiSlaveRegister(regCon,x"220", 0, v.config.macConfig.rxShift);   195          --axiSlaveRegister(regCon,x"224", 0, v.config.macConfig.rxShiftEn);   199          axiSlaveRegister(regCon, x"F00", 0, v.rollOverEn);
   200          axiSlaveRegister(regCon, x"FF4", 0, v.cntRst);
   202          axiSlaveRegister(regCon, x"FFC", 0, v.hardRst);
   204          -- Closeout the transaction   208          if (rst = '1') or (v.hardRst = '1') then   210             v.rollOverEn := (others => '0');
   218          -- Update the MAC address   221          -- Register the variable for next clock cycle   231       seq : 
process (
clk) 
is   233          if rising_edge(clk) then   234             r <= rin after TPD_G;
 EN_AXI_REG_Gboolean  :=   false
 
in statusGigEthStatusType  
 
out axiReadSlaveAxiLiteReadSlaveType  
 
in axiWriteMasterAxiLiteWriteMasterType  
 
DURATION_Gnatural   range  0 to (( 2** 31)- 1):= 156250000
 
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)
 
CNT_WIDTH_Gpositive  := 32
 
slv( 1 downto  0)  :=   "10" AXI_RESP_SLVERR_C
 
EthMacConfigType   macConfig
 
out axiReadSlaveAxiLiteReadSlaveType  
 
in rollOverEnInslv(   WIDTH_G- 1 downto  0)  :=( others => '0')
 
GigEthConfigType  :=(softRst  => '0',coreConfig  =>   "00000",macConfig  =>   ETH_MAC_CONFIG_INIT_C) GIG_ETH_CONFIG_INIT_C
 
in localMacslv( 47 downto  0)  :=   MAC_ADDR_INIT_C
 
in axiReadMasterAxiLiteReadMasterType  
 
AxiLiteReadSlaveType  :=(arready  => '0',rdata  =>( others => '0'),rresp  =>( others => '0'),rvalid  => '0') AXI_LITE_READ_SLAVE_INIT_C
 
out configGigEthConfigType  
 
out dataOutslv(   WIDTH_G- 1 downto  0)  
 
slv( 15 downto  0)   coreStatus
 
CNT_RST_EDGE_Gboolean  :=   true
 
AXI_ERROR_RESP_Gslv( 1 downto  0)  :=   AXI_RESP_SLVERR_C
 
in axiReadMasterAxiLiteReadMasterType  
 
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
 
out axiWriteSlaveAxiLiteWriteSlaveType