1 -------------------------------------------------------------------------------     2 -- File       : UdpEngineArp.vhd     3 -- Company    : SLAC National Accelerator Laboratory     4 -- Created    : 2015-08-20     5 -- Last update: 2016-09-16     6 -------------------------------------------------------------------------------     7 -- Description: UDP Client's ARP Messaging 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;
    27  --! @ingroup ethernet_UdpEngine    35       -- Local Configurations    36       localIp         : 
in  slv(
31 downto 0);  --  big-Endian 
configuration       37       -- Interface to ARP Engine    42       -- Interface to UDP Client engine(s)    53    constant TIMER_1_SEC_C :  := getTimeRatio(CLK_FREQ_G, 1.
0);
    60    type StateArray is array ( range <>) of StateType;
    62    type RegType is record    67       timer           :  range 0 to (TIMER_1_SEC_C-1);
    71    constant REG_INIT_C : RegType := (    77       arpTimers       => (others => 0),    78       state           => (others => IDLE_S));      
    80    signal r   : RegType := REG_INIT_C;
    89       -- Latch the current value   102       -- Increment the timer   103       if r.timer = (TIMER_1_SEC_C-1) then   107          v.timer := r.timer + 1;
   110       -- Loop through the clients   114          if (r.timerEn = '1') and (r.arpTimers(i) /= 0) then   115             -- Decrement the timers   116             v.arpTimers(i) := r.arpTimers(i) - 1;
   119          -- Update the IP address    122          -- Check for dynamic change in IP address   124             -- Stop any outstanding requests   126             -- Reset the remote MAC address   129             v.state(i)                := IDLE_S;
   133                ----------------------------------------------------------------------   137                   -- Reset the remote MAC address   139                   -- Check if we have a non-zero IP address to request   141                      -- Make an ARP request   144                      v.state(i)                := WAIT_S;
   146                ----------------------------------------------------------------------   148                   -- Wait for the ARP response   152                      -- Latch the MAC address value   157                      v.state(i)               := COMM_MONITOR_S;
   159                ----------------------------------------------------------------------   160                when COMM_MONITOR_S =>   161                   -- Check for inbound client communication    165                   elsif r.arpTimers(i) = 0 then   167                      v.state(i) := IDLE_S;
   169             ----------------------------------------------------------------------   179       -- Register the variable for next clock cycle   189    seq : 
process (
clk) 
is   191       if rising_edge(clk) then   192          r <= rin after TPD_G;
 array(natural range <> ) of AxiStreamSlaveType   AxiStreamSlaveArray
 
array(natural range <> ) of slv( 31 downto  0)   Slv32Array
 
out clientRemoteMacSlv48Array(   CLIENT_SIZE_G- 1 downto  0)  
 
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
 
array(natural range <> ) of slv( 47 downto  0)   Slv48Array
 
CLIENT_SIZE_Gpositive  := 1
 
CLK_FREQ_Greal  := 156.25E+06
 
in clientRemoteDetslv(   CLIENT_SIZE_G- 1 downto  0)  
 
AxiStreamSlaveType  :=(tReady  => '0') AXI_STREAM_SLAVE_INIT_C
 
out arpReqMastersAxiStreamMasterArray(   CLIENT_SIZE_G- 1 downto  0)  
 
array(natural range <> ) of AxiStreamMasterType   AxiStreamMasterArray
 
in clientRemoteIpSlv32Array(   CLIENT_SIZE_G- 1 downto  0)  
 
COMM_TIMEOUT_Gpositive  := 30
 
in arpReqSlavesAxiStreamSlaveArray(   CLIENT_SIZE_G- 1 downto  0)  
 
out arpAckSlavesAxiStreamSlaveArray(   CLIENT_SIZE_G- 1 downto  0)  
 
in arpAckMastersAxiStreamMasterArray(   CLIENT_SIZE_G- 1 downto  0)