1 ------------------------------------------------------------------------------- 2 -- File : UdpEngineWrapper.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2015-08-20 5 -- Last update: 2016-11-02 6 ------------------------------------------------------------------------------- 7 -- Description: Wrapper for UdpEngine 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;
29 --! @ingroup ethernet_UdpEngine 32 -- Simulation Generics 34 -- UDP Server Generics 38 -- UDP Client Generics 44 -- General IPv4/ARP/DHCP Generics 47 COMM_TIMEOUT_G : positive := 30;
-- In units of seconds, Client's Communication timeout before re-ARPing or DHCP discover/request 48 TTL_G : slv(7 downto 0) := x"20";
-- IPv4's Time-To-Live (TTL) 49 VLAN_G : := false);
-- true = VLAN support 51 -- Local Configurations 52 localMac :
in slv(
47 downto 0); -- big-Endian
configuration 53 localIp :
in slv(
31 downto 0); -- big-Endian
configuration 54 -- Remote Configurations 57 -- Interface to Ethernet Media Access Controller (MAC) 62 -- Interface to UDP Server engine(s) 67 -- Interface to UDP Client engine(s) 84 type RegType is record 91 constant REG_INIT_C : RegType := ( 97 signal r : RegType := REG_INIT_C;
112 signal dhcpIp : slv(31 downto 0);
128 -- Local Configurations 131 -- Interface to Ethernet Media Access Controller (MAC) 136 -- Interface to Protocol Engine(s) 137 obProtocolMasters
(0) => obUdpMaster,
138 obProtocolSlaves
(0) => obUdpSlave,
139 ibProtocolMasters
(0) => ibUdpMaster,
140 ibProtocolSlaves
(0) => ibUdpSlave,
141 -- Interface to Client Engine(s) 155 -- Simulation Generics 157 -- UDP Server Generics 161 -- UDP Client Generics 165 -- UDP ARP/DHCP Generics 170 -- Local Configurations 174 -- Interface to IPV4 Engine 179 -- Interface to ARP Engine 184 -- Interface to UDP Server engine(s) 191 -- Interface to UDP Client engine(s) 203 localMac, r,
rst, serverRemoteIp, serverRemotePort)
is 204 variable v : RegType;
205 variable regCon : AxiLiteEndPointType;
208 -- Latch the current value 211 -- Determine the transaction type 214 -- Map the read/write registers 216 axiSlaveRegister(regCon, toSlv((8*i)+0, 12), 0, v.clientRemotePort(i));
-- big-Endian configuration 217 axiSlaveRegister(regCon, toSlv((8*i)+4, 12), 0, v.clientRemoteIp(i));
-- big-Endian configuration 219 -- Map the read only registers 221 axiSlaveRegisterR(regCon, toSlv((8*i)+0+2048, 12), 0, serverRemotePort(i));
-- big-Endian configuration 222 axiSlaveRegisterR(regCon, toSlv((8*i)+4+2048, 12), 0, serverRemoteIp(i));
-- big-Endian configuration 225 axiSlaveRegisterR(regCon, x"FF4", 0, dhcpIp);
226 axiSlaveRegisterR(regCon, x"FF8", 0, localMac);
228 -- Closeout the transaction 236 -- Check for external configuration 242 -- Register the variable for next clock cycle 251 seq :
process (
clk)
is 253 if (rising_edge(clk)) then 254 r <= rin after TPD_G;
out serverRemotePortSlv16Array( SERVER_SIZE_G- 1 downto 0)
array(natural range <> ) of AxiStreamSlaveType AxiStreamSlaveArray
in axilReadMasterAxiLiteReadMasterType := AXI_LITE_READ_MASTER_INIT_C
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_DECERR_C
array(natural range <> ) of slv( 31 downto 0) Slv32Array
in ibServerMastersAxiStreamMasterArray( SERVER_SIZE_G- 1 downto 0)
out ibServerSlavesAxiStreamSlaveArray( SERVER_SIZE_G- 1 downto 0)
in localIpInslv( 31 downto 0)
CLK_FREQ_Greal := 156.25E+06
PROTOCOL_SIZE_Gpositive := 1
CLK_FREQ_Greal := 156.25E+06
in obMacMasterAxiStreamMasterType
out ibServerSlavesAxiStreamSlaveArray( SERVER_SIZE_G- 1 downto 0)
in obServerSlavesAxiStreamSlaveArray( SERVER_SIZE_G- 1 downto 0) :=( others => AXI_STREAM_SLAVE_FORCE_C)
PROTOCOL_GSlv8Array :=( 0=> UDP_C)
SERVER_PORTS_GPositiveArray :=( 0=> 8192)
in ibServerMastersAxiStreamMasterArray( SERVER_SIZE_G- 1 downto 0) :=( others => AXI_STREAM_MASTER_INIT_C)
CLIENT_SIZE_Gpositive := 1
CLIENT_PORTS_GPositiveArray :=( 0=> 8193)
SERVER_PORTS_GPositiveArray :=( 0=> 8192)
in ibClientMastersAxiStreamMasterArray( CLIENT_SIZE_G- 1 downto 0)
out ibMacMasterAxiStreamMasterType
in arpReqSlavesAxiStreamSlaveArray( CLIENT_SIZE_G- 1 downto 0)
out ibMacMasterAxiStreamMasterType
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
SERVER_SIZE_Gpositive := 1
in obServerSlavesAxiStreamSlaveArray( SERVER_SIZE_G- 1 downto 0)
in clientRemoteIpSlv32Array( CLIENT_SIZE_G- 1 downto 0) :=( others => x"00000000")
COMM_TIMEOUT_Gpositive := 30
CLIENT_PORTS_GPositiveArray :=( 0=> 8193)
out arpAckSlavesAxiStreamSlaveArray( CLIENT_SIZE_G- 1 downto 0)
CLIENT_EXT_CONFIG_Gboolean := false
CLIENT_SIZE_Gpositive := 1
TTL_Gslv( 7 downto 0) := x"20"
in clientRemoteIpSlv32Array( CLIENT_SIZE_G- 1 downto 0)
in axilWriteMasterAxiLiteWriteMasterType := AXI_LITE_WRITE_MASTER_INIT_C
SERVER_EN_Gboolean := true
CLIENT_EN_Gboolean := true
out arpAckMastersAxiStreamMasterArray( CLIENT_SIZE_G- 1 downto 0)
in localMacslv( 47 downto 0)
slv( 1 downto 0) := "11" AXI_RESP_DECERR_C
out axilWriteSlaveAxiLiteWriteSlaveType
in localIpslv( 31 downto 0)
out arpReqMastersAxiStreamMasterArray( CLIENT_SIZE_G- 1 downto 0)
out obMacSlaveAxiStreamSlaveType
array(natural range <> ) of positive PositiveArray
out dhcpIpOutslv( 31 downto 0)
in clientRemotePortSlv16Array( CLIENT_SIZE_G- 1 downto 0) :=( others => x"0000")
out arpReqSlavesAxiStreamSlaveArray( CLIENT_SIZE_G- 1 downto 0)
CLIENT_EN_Gboolean := true
SERVER_SIZE_Gpositive := 1
out serverRemoteIpSlv32Array( SERVER_SIZE_G- 1 downto 0)
in obUdpSlaveAxiStreamSlaveType
in ibClientMastersAxiStreamMasterArray( CLIENT_SIZE_G- 1 downto 0) :=( others => AXI_STREAM_MASTER_INIT_C)
out obUdpMasterAxiStreamMasterType
out obServerMastersAxiStreamMasterArray( SERVER_SIZE_G- 1 downto 0)
out ibClientSlavesAxiStreamSlaveArray( CLIENT_SIZE_G- 1 downto 0)
in arpReqMastersAxiStreamMasterArray( CLIENT_SIZE_G- 1 downto 0)
in arpAckSlavesAxiStreamSlaveArray( CLIENT_SIZE_G- 1 downto 0)
out ibUdpSlaveAxiStreamSlaveType
AxiLiteReadSlaveType :=(arready => '0',rdata =>( others => '0'),rresp =>( others => '0'),rvalid => '0') AXI_LITE_READ_SLAVE_INIT_C
out obClientMastersAxiStreamMasterArray( CLIENT_SIZE_G- 1 downto 0)
out ibClientSlavesAxiStreamSlaveArray( CLIENT_SIZE_G- 1 downto 0)
array(natural range <> ) of AxiStreamMasterType AxiStreamMasterArray
array(natural range <> ) of slv( 15 downto 0) Slv16Array
in ibUdpMasterAxiStreamMasterType
in localIpslv( 31 downto 0)
AxiLiteReadMasterType :=(araddr =>( others => '0'),arprot =>( others => '0'),arvalid => '0',rready => '1') AXI_LITE_READ_MASTER_INIT_C
in obMacMasterAxiStreamMasterType
out axilReadSlaveAxiLiteReadSlaveType
in arpAckMastersAxiStreamMasterArray( CLIENT_SIZE_G- 1 downto 0)
in clientRemotePortSlv16Array( CLIENT_SIZE_G- 1 downto 0)
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
CLK_FREQ_Greal := 156.25E+06
COMM_TIMEOUT_Gpositive := 30
CLIENT_SIZE_Gpositive := 1
AxiStreamSlaveType :=(tReady => '1') AXI_STREAM_SLAVE_FORCE_C
out obClientMastersAxiStreamMasterArray( CLIENT_SIZE_G- 1 downto 0)
in localMacslv( 47 downto 0)
slv( 7 downto 0) := x"11" UDP_C
in ibMacSlaveAxiStreamSlaveType
in obClientSlavesAxiStreamSlaveArray( CLIENT_SIZE_G- 1 downto 0) :=( others => AXI_STREAM_SLAVE_FORCE_C)
out obMacSlaveAxiStreamSlaveType
SERVER_EN_Gboolean := true
in obClientSlavesAxiStreamSlaveArray( CLIENT_SIZE_G- 1 downto 0)
in ibMacSlaveAxiStreamSlaveType
AxiLiteWriteSlaveType :=(awready => '0',wready => '0',bresp =>( others => '0'),bvalid => '0') AXI_LITE_WRITE_SLAVE_INIT_C
out obServerMastersAxiStreamMasterArray( SERVER_SIZE_G- 1 downto 0)
in localMacslv( 47 downto 0)