1 ------------------------------------------------------------------------------- 2 -- File : EthMacTxExportGmii.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2015-02-04 5 -- Last update: 2016-09-14 6 ------------------------------------------------------------------------------- 7 -- Description: 1GbE Export MAC core with GMII 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_arith.
all;
21 use ieee.std_logic_unsigned.
all;
28 --! @ingroup ethernet_EthMacCore 50 end EthMacTxExportGmii;
76 type RegType is record 80 txCount : slv(7 downto 0);
81 txData_d : slv(7 downto 0);
87 crcIn : slv(7 downto 0);
92 constant REG_INIT_C : RegType := ( 96 txCount => (others => '0'), 97 txData_d => (others => '0'), 103 crcIn => (others => '0'), 107 signal r : RegType := REG_INIT_C;
108 signal rin : RegType;
112 signal crcOut : slv(31 downto 0);
113 signal crcDataValid : sl;
114 signal crcIn : slv(7 downto 0);
116 -- attribute dont_touch : string; 117 -- attribute dont_touch of r : signal is "TRUE"; 118 -- attribute dont_touch of macMaster : signal is "TRUE"; 119 -- attribute dont_touch of macSlave : signal is "TRUE"; 120 -- attribute dont_touch of crcOut : signal is "TRUE"; 121 -- attribute dont_touch of crcDataValid : signal is "TRUE"; 122 -- attribute dont_touch of crcIn : signal is "TRUE"; 128 -- General Configurations 134 -- FIFO configurations 140 -- AXI Stream Port Configurations 152 mAxisMaster => macMaster,
-- 8-bit AXI stream interface 156 variable v : RegType;
158 -- Latch the current value 163 v.crcDataValid := '0';
169 ---------------------------------------------------------------------- 177 -- Wait for start flag 181 v.state := TX_PREAMBLE_S;
182 -- Phy is not ready dump data 188 ---------------------------------------------------------------------- 189 when TX_PREAMBLE_S => 191 if (r.TxCount = x"07") then 196 v.state := TX_DATA_S;
198 v.TxCount := r.TxCount +1;
201 v.state := TX_PREAMBLE_S;
203 ---------------------------------------------------------------------- 206 v.crcDataValid := '1';
207 v.crcIn := macMaster.tdata(7 downto 0);
208 v.txData_d := macMaster.tdata(7 downto 0);
210 if (r.TxCount < x"3C") then -- Minimum frame of 64 includes 4byte FCS 211 v.TxCount := r.TxCount + 1;
213 if (macMaster.tValid = '1') then 214 if (macMaster.tlast = '1') then 215 if (v.TxCount = x"3C") then 226 ---------------------------------------------------------------------- 228 v.crcDataValid := '1';
232 if (r.TxCount < x"3C") then 233 v.TxCount := v.TxCount + 1;
237 ---------------------------------------------------------------------- 240 v.state := TX_CRC0_S;
241 ---------------------------------------------------------------------- 243 v.gmiitxd := crcOut(31 downto 24);
244 v.state := TX_CRC1_S;
245 ---------------------------------------------------------------------- 247 v.gmiitxd := crcOut(23 downto 16);
248 v.state := TX_CRC2_S;
249 ---------------------------------------------------------------------- 251 v.gmiitxd := crcOut(15 downto 8);
252 v.state := TX_CRC3_S;
253 ---------------------------------------------------------------------- 255 v.gmiitxd := crcOut(7 downto 0);
257 v.state := INTERGAP_S;
258 ---------------------------------------------------------------------- 263 if ((macMaster.tValid = '1') and (macMaster.tlast = '1')) then 264 v.state := INTERGAP_S;
266 ---------------------------------------------------------------------- 269 v.TxCount := r.TxCount +1;
270 if r.TxCount = x"0A" then -- 12 Octels - IDLE state 274 ---------------------------------------------------------------------- 282 -- Register the variable for next clock cycle 286 macSlave <= v.macSlave;
-- Flow control with non-registered signal 293 crcDataValid <= v.crcDataValid;
300 if rising_edge(ethClk) then 301 r <= rin after TPD_G;
FIFO_ADDR_WIDTH_Ginteger range 4 to 48:= 9
out gmiiTxdslv( 7 downto 0)
natural range 0 to 8 TDEST_BITS_C
in macObMasterAxiStreamMasterType
out macObSlaveAxiStreamSlaveType
PIPE_STAGES_Gnatural range 0 to 16:= 1
out crcOutslv( 31 downto 0)
SLAVE_AXI_CONFIG_GAxiStreamConfigType := AXI_STREAM_CONFIG_INIT_C
in crcDataWidthslv( 2 downto 0)
SLAVE_READY_EN_Gboolean := true
natural range 1 to 16 TDATA_BYTES_C
GEN_SYNC_FIFO_Gboolean := false
TkeepModeType TKEEP_MODE_C
natural range 0 to 8 TID_BITS_C
INT_PIPE_STAGES_Gnatural range 0 to 16:= 0
AxiStreamSlaveType :=(tReady => '0') AXI_STREAM_SLAVE_INIT_C
in macAddressslv( 47 downto 0)
TUserModeType TUSER_MODE_C
natural range 0 to 8 TUSER_BITS_C
out sAxisSlaveAxiStreamSlaveType
in sAxisMasterAxiStreamMasterType
out mAxisMasterAxiStreamMasterType
in crcInslv(( BYTE_WIDTH_G* 8- 1) downto 0)
in mAxisSlaveAxiStreamSlaveType
CASCADE_SIZE_Ginteger range 1 to ( 2** 24):= 1
USE_BUILT_IN_Gboolean := false
VALID_THOLD_Ginteger range 0 to ( 2** 24):= 1
MASTER_AXI_CONFIG_GAxiStreamConfigType := AXI_STREAM_CONFIG_INIT_C
AxiStreamConfigType :=(TSTRB_EN_C => false,TDATA_BYTES_C => 16,TDEST_BITS_C => 8,TID_BITS_C => 0,TKEEP_MODE_C => TKEEP_COMP_C,TUSER_BITS_C => 4,TUSER_MODE_C => TUSER_FIRST_LAST_C) EMAC_AXIS_CONFIG_C