SURF  1.0
EthMacTx.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 -- File : EthMacTx.vhd
3 -- Company : SLAC National Accelerator Laboratory
4 -- Created : 2015-09-22
5 -- Last update: 2016-10-20
6 -------------------------------------------------------------------------------
7 -- Description: Ethernet MAC TX Wrapper
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 -------------------------------------------------------------------------------
17 
18 library ieee;
19 use ieee.std_logic_1164.all;
20 use ieee.std_logic_arith.all;
21 use ieee.std_logic_unsigned.all;
22 
23 use work.AxiStreamPkg.all;
24 use work.StdRtlPkg.all;
25 use work.EthMacPkg.all;
26 
27 --! @see entity
28  --! @ingroup ethernet_EthMacCore
29 entity EthMacTx is
30  generic (
31  -- Simulation Generics
32  TPD_G : time := 1 ns;
33  -- MAC Configurations
34  PAUSE_EN_G : boolean := true;
35  PAUSE_512BITS_G : positive range 1 to 1024 := 8;
36  PHY_TYPE_G : string := "XGMII";
37  DROP_ERR_PKT_G : boolean := true;
38  JUMBO_G : boolean := true;
39  -- Non-VLAN Configurations
40  BYP_EN_G : boolean := false;
41  -- VLAN Configurations
42  VLAN_EN_G : boolean := false;
43  VLAN_SIZE_G : positive range 1 to 8 := 1;
44  VLAN_VID_G : Slv12Array := (0 => x"001"));
45  port (
46  -- Clock and Reset
47  ethClk : in sl;
48  ethRst : in sl;
49  -- Primary Interface
52  -- Bypass interface
55  -- VLAN Interfaces
58  -- XLGMII PHY Interface
59  xlgmiiTxd : out slv(127 downto 0);
60  xlgmiiTxc : out slv(15 downto 0);
61  -- XGMII PHY Interface
62  xgmiiTxd : out slv(63 downto 0);
63  xgmiiTxc : out slv(7 downto 0);
64  -- GMII PHY Interface
65  gmiiTxEn : out sl;
66  gmiiTxEr : out sl;
67  gmiiTxd : out slv(7 downto 0);
68  -- Flow control Interface
70  rxPauseReq : in sl;
71  rxPauseValue : in slv(15 downto 0);
72  pauseTx : out sl;
73  -- Configuration and status
74  phyReady : in sl;
76  txCountEn : out sl;
77  txUnderRun : out sl;
78  txLinkNotReady : out sl);
79 end EthMacTx;
80 
81 architecture mapping of EthMacTx is
82 
91 
92 begin
93 
94  -------------------
95  -- TX Bypass Module
96  -------------------
97  U_Bypass : entity work.EthMacTxBypass
98  generic map (
99  TPD_G => TPD_G,
100  BYP_EN_G => BYP_EN_G)
101  port map (
102  -- Clock and Reset
103  ethClk => ethClk,
104  ethRst => ethRst,
105  -- Incoming primary traffic
108  -- Incoming bypass traffic
110  sBypSlave => sBypSlave,
111  -- Outgoing data to MAC
114 
115  ------------------------------
116  -- TX Non-VLAN Checksum Module
117  ------------------------------
118  U_Csum : entity work.EthMacTxCsum
119  generic map (
120  TPD_G => TPD_G,
122  JUMBO_G => JUMBO_G,
123  VLAN_G => false,
124  VID_G => x"001")
125  port map (
126  -- Clock and Reset
127  ethClk => ethClk,
128  ethRst => ethRst,
129  -- Configurations
130  ipCsumEn => ethConfig.ipCsumEn,
131  tcpCsumEn => ethConfig.tcpCsumEn,
132  udpCsumEn => ethConfig.udpCsumEn,
133  -- Outbound data to MAC
137  mAxisSlave => csumSlave);
138 
139  --------------------------
140  -- TX VLAN Checksum Module
141  --------------------------
142  GEN_VLAN : if (VLAN_EN_G = true) generate
143  GEN_VEC :
144  for i in (VLAN_SIZE_G-1) downto 0 generate
145  U_Csum : entity work.EthMacTxCsum
146  generic map (
147  TPD_G => TPD_G,
149  JUMBO_G => JUMBO_G,
150  VLAN_G => true,
151  VID_G => VLAN_VID_G(i))
152  port map (
153  -- Clock and Reset
154  ethClk => ethClk,
155  ethRst => ethRst,
156  -- Configurations
157  ipCsumEn => '1',
158  tcpCsumEn => '1',
159  udpCsumEn => '1',
160  -- Outbound data to MAC
162  sAxisSlave => sVlanSlaves(i),
163  mAxisMaster => csumMasters(i),
164  mAxisSlave => csumSlaves(i));
165  end generate GEN_VEC;
166  end generate;
167 
168  BYPASS_VLAN : if (VLAN_EN_G = false) generate
169  -- Terminate Unused buses
170  sVlanSlaves <= (others => AXI_STREAM_SLAVE_FORCE_C);
171  csumMasters <= (others => AXI_STREAM_MASTER_INIT_C);
172  end generate;
173 
174  ------------------
175  -- TX Pause Module
176  ------------------
177  U_Pause : entity work.EthMacTxPause
178  generic map (
179  TPD_G => TPD_G,
182  VLAN_EN_G => VLAN_EN_G,
184  port map (
185  -- Clock and Reset
186  ethClk => ethClk,
187  ethRst => ethRst,
188  -- Incoming data from client
193  -- Outgoing data to MAC
196  -- Flow control input
198  -- Inputs from pause frame RX
201  -- Configuration and status
202  phyReady => phyReady,
203  pauseEnable => ethConfig.pauseEnable,
204  pauseTime => ethConfig.pauseTime,
205  macAddress => ethConfig.macAddress,
206  pauseTx => pauseTx);
207 
208  -----------------------
209  -- TX MAC Export Module
210  -----------------------
211  U_Export : entity work.EthMacTxExport
212  generic map (
213  TPD_G => TPD_G,
215  port map (
216  -- Clock and reset
217  ethClk => ethClk,
218  ethRst => ethRst,
219  -- AXIS Interface
222  -- XLGMII PHY Interface
223  xlgmiiTxd => xlgmiiTxd,
224  xlgmiiTxc => xlgmiiTxc,
225  -- XGMII PHY Interface
226  xgmiiTxd => xgmiiTxd,
227  xgmiiTxc => xgmiiTxc,
228  -- GMII PHY Interface
229  gmiiTxEn => gmiiTxEn,
230  gmiiTxEr => gmiiTxEr,
231  gmiiTxd => gmiiTxd,
232  -- Configuration and status
233  macAddress => ethConfig.macAddress,
234  phyReady => phyReady,
235  txCountEn => txCountEn,
238 
239 end mapping;
PAUSE_512BITS_Gnatural range 1 to 1024:= 8
in rxPauseValueslv( 15 downto 0)
out mAxisMasterAxiStreamMasterType
in sBypMasterAxiStreamMasterType
array(natural range <> ) of AxiStreamSlaveType AxiStreamSlaveArray
AxiStreamMasterType csumMaster
Definition: EthMacTx.vhd:85
out xlgmiiTxdslv( 127 downto 0)
Definition: EthMacTx.vhd:59
TPD_Gtime := 1 ns
Definition: EthMacTx.vhd:32
array(natural range <> ) of slv( 11 downto 0) Slv12Array
Definition: StdRtlPkg.vhd:399
out txUnderRunsl
Definition: EthMacTx.vhd:77
out mAxisMasterAxiStreamMasterType
VLAN_EN_Gboolean := false
Definition: EthMacTx.vhd:42
_library_ ieeeieee
Definition: EthMacTop.vhd:18
in mAxisSlaveAxiStreamSlaveType
out sPrimSlaveAxiStreamSlaveType
Definition: EthMacTx.vhd:51
VID_Gslv( 11 downto 0) := x"001"
in macAddressslv( 47 downto 0)
out gmiiTxEnsl
Definition: EthMacTx.vhd:65
in rxPauseValueslv( 15 downto 0)
Definition: EthMacTx.vhd:71
VLAN_SIZE_Gpositive range 1 to 8:= 1
Definition: EthMacTx.vhd:43
std_logic sl
Definition: StdRtlPkg.vhd:28
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
VLAN_VID_GSlv12Array :=( 0=> x"001")
Definition: EthMacTx.vhd:44
AxiStreamSlaveType csumSlave
Definition: EthMacTx.vhd:86
out txLinkNotReadysl
Definition: EthMacTx.vhd:78
BYP_EN_Gboolean := false
Definition: EthMacTx.vhd:40
in sPrimMasterAxiStreamMasterType
TPD_Gtime := 1 ns
TPD_Gtime := 1 ns
in macAddressslv( 47 downto 0)
AxiStreamSlaveType bypassSlave
Definition: EthMacTx.vhd:84
in sPrimMasterAxiStreamMasterType
Definition: EthMacTx.vhd:50
in sBypMasterAxiStreamMasterType
Definition: EthMacTx.vhd:53
in sAxisMastersAxiStreamMasterArray( VLAN_SIZE_G- 1 downto 0)
in clientPausesl
Definition: EthMacTx.vhd:69
out sBypSlaveAxiStreamSlaveType
Definition: EthMacTx.vhd:54
in ethClksl
Definition: EthMacTx.vhd:47
PAUSE_EN_Gboolean := true
Definition: EthMacTx.vhd:34
VLAN_Gboolean := false
out mAxisMasterAxiStreamMasterType
in mAxisSlaveAxiStreamSlaveType
AxiStreamMasterType bypassMaster
Definition: EthMacTx.vhd:83
in rxPauseReqsl
Definition: EthMacTx.vhd:70
AxiStreamMasterType macObMaster
Definition: EthMacTx.vhd:89
in ethRstsl
Definition: EthMacTx.vhd:48
BYP_EN_Gboolean := false
AxiStreamSlaveType macObSlave
Definition: EthMacTx.vhd:90
JUMBO_Gboolean := true
PAUSE_EN_Gboolean := true
out gmiiTxdslv( 7 downto 0)
Definition: EthMacTx.vhd:67
in phyReadysl
Definition: EthMacTx.vhd:74
in sVlanMastersAxiStreamMasterArray( VLAN_SIZE_G- 1 downto 0)
Definition: EthMacTx.vhd:56
in sAxisMasterAxiStreamMasterType
EthMacConfigType
Definition: EthMacPkg.vhd:68
out xlgmiiTxdslv( 127 downto 0)
in ethConfigEthMacConfigType
Definition: EthMacTx.vhd:75
AxiStreamSlaveArray( VLAN_SIZE_G- 1 downto 0) csumSlaves
Definition: EthMacTx.vhd:88
out macObSlaveAxiStreamSlaveType
out pauseTxsl
Definition: EthMacTx.vhd:72
out gmiiTxdslv( 7 downto 0)
DROP_ERR_PKT_Gboolean := true
out xlgmiiTxcslv( 15 downto 0)
in mAxisSlaveAxiStreamSlaveType
out sAxisSlaveAxiStreamSlaveType
in pauseTimeslv( 15 downto 0)
array(natural range <> ) of AxiStreamMasterType AxiStreamMasterArray
out xgmiiTxdslv( 63 downto 0)
out sPrimSlaveAxiStreamSlaveType
out sAxisSlaveAxiStreamSlaveType
VLAN_SIZE_Gpositive range 1 to 8:= 1
TPD_Gtime := 1 ns
VLAN_EN_Gboolean := false
AxiStreamMasterArray( VLAN_SIZE_G- 1 downto 0) csumMasters
Definition: EthMacTx.vhd:87
out xgmiiTxcslv( 7 downto 0)
Definition: EthMacTx.vhd:63
AxiStreamSlaveType :=(tReady => '1') AXI_STREAM_SLAVE_FORCE_C
PHY_TYPE_Gstring := "XGMII"
out sAxisSlavesAxiStreamSlaveArray( VLAN_SIZE_G- 1 downto 0)
out xlgmiiTxcslv( 15 downto 0)
Definition: EthMacTx.vhd:60
TPD_Gtime := 1 ns
PHY_TYPE_Gstring := "XGMII"
Definition: EthMacTx.vhd:36
out xgmiiTxdslv( 63 downto 0)
Definition: EthMacTx.vhd:62
JUMBO_Gboolean := true
Definition: EthMacTx.vhd:38
out txCountEnsl
Definition: EthMacTx.vhd:76
out sVlanSlavesAxiStreamSlaveArray( VLAN_SIZE_G- 1 downto 0)
Definition: EthMacTx.vhd:57
in sAxisMasterAxiStreamMasterType
DROP_ERR_PKT_Gboolean := true
Definition: EthMacTx.vhd:37
out sBypSlaveAxiStreamSlaveType
std_logic_vector slv
Definition: StdRtlPkg.vhd:29
in macObMasterAxiStreamMasterType
out gmiiTxErsl
Definition: EthMacTx.vhd:66
PAUSE_512BITS_Gpositive range 1 to 1024:= 8
Definition: EthMacTx.vhd:35
out xgmiiTxcslv( 7 downto 0)