1 ------------------------------------------------------------------------------- 2 -- File : EthMacRxImportGmii.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2015-02-04 5 -- Last update: 2016-09-14 6 ------------------------------------------------------------------------------- 7 -- Description: 1GbE Import 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 42 -- Configuration and status 46 end EthMacRxImportGmii;
50 constant SFD_C : slv(7 downto 0) := x"D5";
68 type RegType is record 73 delRxDvSr : slv(7 downto 0);
77 macData : slv(63 downto 0);
81 constant REG_INIT_C : RegType := ( 86 delRxDvSr => (others => '0'), 90 macData => (others => '0'), 93 signal r : RegType := REG_INIT_C;
96 signal crcOut : slv(31 downto 0);
97 signal crcIn : slv(31 downto 0);
100 -- attribute dont_touch : string; 101 -- attribute dont_touch of r : signal is "TRUE"; 102 -- attribute dont_touch of crcIn : signal is "TRUE"; 103 -- attribute dont_touch of crcOut : signal is "TRUE"; 104 -- attribute dont_touch of macMaster : signal is "TRUE"; 110 -- General Configurations 115 -- FIFO configurations 121 -- AXI Stream Port Configurations 128 sAxisMaster => macMaster,
-- 8-bit AXI stream interface 137 variable v : RegType;
139 -- Latch the current value 145 v.crcDataValid := '0';
147 v.macMaster.tValid := '0';
148 v.macMaster.tLast := '0';
149 v.macMaster.tUser := (others => '0');
150 v.macMaster.tKeep := (others => '1');
152 -- Delay data to avoid sending the CRC 153 v.macData(63 downto 0) := r.macData(55 downto 0) & gmiiRxd;
155 -- Delay the GMII valid for start up sequencing 156 v.delRxDvSr := r.delRxDvSr(6 downto 0) & r.delRxDv;
158 -- Check for CRC reset 163 ---------------------------------------------------------------------- 168 v.state := WAIT_DATA_S;
170 ---------------------------------------------------------------------- 173 v.state := WAIT_SFD_S;
174 elsif (r.delRxDvSr(3) = '1') then 175 v.state := GET_DATA_S;
177 ---------------------------------------------------------------------- 180 v.macMaster.tvalid := '1';
181 v.macMaster.tlast := '1';
182 axiStreamSetUserBit(AXI_CONFIG_C, v.macMaster, EMAC_EOFE_BIT_C, '1', 0);
183 v.state := WAIT_SFD_S;
185 v.crcDataValid := '1';
187 v.macMaster.tdata(7 downto 0) := r.macData(39 downto 32);
191 if (r.sof = '1') then 192 axiStreamSetUserBit(AXI_CONFIG_C, v.macMaster, EMAC_SOF_BIT_C, '1', 0);
196 ---------------------------------------------------------------------- 199 ---------------------------------------------------------------------- 202 ---------------------------------------------------------------------- 204 v.macMaster.tvalid := '1';
205 v.macMaster.tlast := '1';
206 if (crcIn /= crcOut) then 208 axiStreamSetUserBit(AXI_CONFIG_C, v.macMaster, EMAC_EOFE_BIT_C, '1', 0);
212 v.state := WAIT_SFD_S;
213 ---------------------------------------------------------------------- 221 -- Register the variable for next clock cycle 225 macMaster <= r.macMaster;
233 if rising_edge(ethClk) then 234 r <= rin after TPD_G;
239 crcIn(31 downto 0) <= r.macData(55 downto 24);
250 crcIn => r.macData
(47 downto 40),
FIFO_ADDR_WIDTH_Ginteger range 4 to 48:= 9
natural range 0 to 8 TDEST_BITS_C
PIPE_STAGES_Gnatural range 0 to 16:= 1
out crcOutslv( 31 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
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
integer := 0 EMAC_EOFE_BIT_C
integer := 1 EMAC_SOF_BIT_C
TUserModeType TUSER_MODE_C
in gmiiRxdslv( 7 downto 0)
natural range 0 to 8 TUSER_BITS_C
out sAxisSlaveAxiStreamSlaveType
out macIbMasterAxiStreamMasterType
in sAxisMasterAxiStreamMasterType
out mAxisMasterAxiStreamMasterType
in crcInslv(( BYTE_WIDTH_G* 8- 1) downto 0)
AxiStreamSlaveType :=(tReady => '1') AXI_STREAM_SLAVE_FORCE_C
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