SURF  1.0
EthMacRxFifo.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 -- File : EthMacRxFifo.vhd
3 -- Company : SLAC National Accelerator Laboratory
4 -- Created : 2016-09-21
5 -- Last update: 2016-10-21
6 -------------------------------------------------------------------------------
7 -- Description: Outbound FIFO buffers
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 
21 use work.StdRtlPkg.all;
22 use work.AxiStreamPkg.all;
23 use work.EthMacPkg.all;
24 
25 --! @see entity
26  --! @ingroup ethernet_EthMacCore
27 entity EthMacRxFifo is
28  generic (
29  TPD_G : time := 1 ns;
30  DROP_ERR_PKT_G : boolean := true;
31  INT_PIPE_STAGES_G : natural := 1;
32  PIPE_STAGES_G : natural := 1;
33  FIFO_ADDR_WIDTH_G : positive := 10;
34  CASCADE_SIZE_G : positive := 2;
35  FIFO_PAUSE_THRESH_G : positive := 1000;
36  CASCADE_PAUSE_SEL_G : natural := 0;
37  PRIM_COMMON_CLK_G : boolean := false;
39  BYP_EN_G : boolean := false;
40  BYP_COMMON_CLK_G : boolean := false;
42  VLAN_EN_G : boolean := false;
43  VLAN_SIZE_G : positive := 1;
44  VLAN_COMMON_CLK_G : boolean := false;
46  port (
47  -- Clock and Reset
48  sClk : in sl;
49  sRst : in sl;
50  -- Status (sClk domain)
51  phyReady : in sl;
52  rxFifoDrop : out sl;
53  -- Primary Interface
54  mPrimClk : in sl;
55  mPrimRst : in sl;
60  -- Bypass interface
61  mBypClk : in sl;
62  mBypRst : in sl;
67  -- VLAN Interfaces
68  mVlanClk : in sl;
69  mVlanRst : in sl;
74 end EthMacRxFifo;
75 
76 architecture rtl of EthMacRxFifo is
77 
78  constant VALID_THOLD_C : natural := ite(DROP_ERR_PKT_G, 0, 1);
79 
80  type RegType is record
81  rxFifoDrop : sl;
82  end record RegType;
83  constant REG_INIT_C : RegType := (
84  rxFifoDrop => '0');
85  signal r : RegType := REG_INIT_C;
86  signal rin : RegType;
87 
88  signal primDrop : sl := '0';
89  signal bypDrop : sl := '0';
90  signal vlanDrops : slv(VLAN_SIZE_G-1 downto 0) := (others => '0');
91 
92 -- attribute dont_touch : string;
93 -- attribute dont_touch of r : signal is "TRUE";
94 
95 
96 begin
97 
98  U_Fifo : entity work.SsiFifo
99  generic map (
100  -- General Configurations
101  TPD_G => TPD_G,
104  SLAVE_READY_EN_G => false,
105  EN_FRAME_FILTER_G => true,
106  OR_DROP_FLAGS_G => true,
107  VALID_THOLD_G => VALID_THOLD_C,
108  -- FIFO configurations
109  BRAM_EN_G => true,
115  -- AXI Stream Port Configurations
118  port map (
119  sAxisClk => sClk,
120  sAxisRst => sRst,
122  sAxisCtrl => sPrimCtrl,
123  sAxisTermFrame => primDrop,
124  mAxisClk => mPrimClk,
125  mAxisRst => mPrimRst,
127  mAxisSlave => mPrimSlave);
128 
129  BYP_DISABLED : if (BYP_EN_G = false) generate
132  end generate;
133 
134  BYP_ENABLED : if (BYP_EN_G = true) generate
135  U_Fifo : entity work.SsiFifo
136  generic map (
137  -- General Configurations
138  TPD_G => TPD_G,
141  SLAVE_READY_EN_G => false,
142  EN_FRAME_FILTER_G => true,
143  OR_DROP_FLAGS_G => true,
144  VALID_THOLD_G => VALID_THOLD_C,
145  -- FIFO configurations
146  BRAM_EN_G => true,
152  -- AXI Stream Port Configurations
155  port map (
156  sAxisClk => sClk,
157  sAxisRst => sRst,
159  sAxisCtrl => sBypCtrl,
160  sAxisTermFrame => bypDrop,
161  mAxisClk => mBypClk,
162  mAxisRst => mBypRst,
164  mAxisSlave => mBypSlave);
165  end generate;
166 
167  VLAN_DISABLED : if (VLAN_EN_G = false) generate
168  sVlanCtrl <= (others => AXI_STREAM_CTRL_UNUSED_C);
169  mVlanMasters <= (others => AXI_STREAM_MASTER_INIT_C);
170  end generate;
171 
172  VLAN_ENABLED : if (VLAN_EN_G = true) generate
173  GEN_VEC : for i in (VLAN_SIZE_G-1) downto 0 generate
174  U_Fifo : entity work.SsiFifo
175  generic map (
176  -- General Configurations
177  TPD_G => TPD_G,
180  SLAVE_READY_EN_G => false,
181  EN_FRAME_FILTER_G => true,
182  OR_DROP_FLAGS_G => true,
183  VALID_THOLD_G => VALID_THOLD_C,
184  -- FIFO configurations
185  BRAM_EN_G => true,
191  -- AXI Stream Port Configurations
194  port map (
195  sAxisClk => sClk,
196  sAxisRst => sRst,
198  sAxisCtrl => sVlanCtrl(i),
199  sAxisTermFrame => vlanDrops(i),
200  mAxisClk => mVlanClk,
201  mAxisRst => mVlanRst,
203  mAxisSlave => mVlanSlaves(i));
204  end generate GEN_VEC;
205  end generate;
206 
207  comb : process (bypDrop, phyReady, primDrop, r, sRst, vlanDrops) is
208  variable v : RegType;
209  variable drop : sl;
210  begin
211  -- Latch the current value
212  v := r;
213 
214  -- OR-ing drop flags together
215  v.rxFifoDrop := primDrop or bypDrop or uOr(vlanDrops);
216 
217  -- Reset
218  if (sRst = '1') or (phyReady = '0') then
219  v := REG_INIT_C;
220  end if;
221 
222  -- Register the variable for next clock cycle
223  rin <= v;
224 
225  -- Outputs
226  rxFifoDrop <= r.rxFifoDrop;
227 
228  end process comb;
229 
230  seq : process (sClk) is
231  begin
232  if rising_edge(sClk) then
233  r <= rin after TPD_G;
234  end if;
235  end process seq;
236 
237 end rtl;
array(natural range <> ) of AxiStreamSlaveType AxiStreamSlaveArray
SLAVE_READY_EN_Gboolean := true
Definition: SsiFifo.vhd:36
PIPE_STAGES_Gnatural := 1
BYP_COMMON_CLK_Gboolean := false
VLAN_SIZE_Gpositive := 1
PRIM_CONFIG_GAxiStreamConfigType := EMAC_AXIS_CONFIG_C
std_logic sl
Definition: StdRtlPkg.vhd:28
in mVlanSlavesAxiStreamSlaveArray( VLAN_SIZE_G- 1 downto 0)
out mAxisMasterAxiStreamMasterType
Definition: SsiFifo.vhd:69
FIFO_PAUSE_THRESH_Gpositive := 1
Definition: SsiFifo.vhd:52
FIFO_ADDR_WIDTH_Gpositive := 10
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
FIFO_ADDR_WIDTH_Ginteger range 4 to 48:= 9
Definition: SsiFifo.vhd:50
out mVlanMastersAxiStreamMasterArray( VLAN_SIZE_G- 1 downto 0)
VLAN_COMMON_CLK_Gboolean := false
BYP_EN_Gboolean := false
in sBypMasterAxiStreamMasterType
out sBypCtrlAxiStreamCtrlType
in sAxisClksl
Definition: SsiFifo.vhd:58
INT_PIPE_STAGES_Gnatural := 0
Definition: SsiFifo.vhd:34
in mPrimSlaveAxiStreamSlaveType
in mBypSlaveAxiStreamSlaveType
GEN_SYNC_FIFO_Gboolean := false
Definition: SsiFifo.vhd:45
VALID_THOLD_Gnatural := 1
Definition: SsiFifo.vhd:39
PRIM_COMMON_CLK_Gboolean := false
out mPrimMasterAxiStreamMasterType
out sPrimCtrlAxiStreamCtrlType
FIFO_PAUSE_THRESH_Gpositive := 1000
out mBypMasterAxiStreamMasterType
in mAxisClksl
Definition: SsiFifo.vhd:67
out rxFifoDropsl
BRAM_EN_Gboolean := true
Definition: SsiFifo.vhd:42
in sAxisRstsl
Definition: SsiFifo.vhd:59
array(natural range <> ) of AxiStreamCtrlType AxiStreamCtrlArray
TPD_Gtime := 1 ns
Definition: SsiFifo.vhd:33
out sAxisTermFramesl
Definition: SsiFifo.vhd:64
array(natural range <> ) of AxiStreamMasterType AxiStreamMasterArray
CASCADE_PAUSE_SEL_Gnatural := 0
VLAN_EN_Gboolean := false
in mAxisSlaveAxiStreamSlaveType
Definition: SsiFifo.vhd:70
DROP_ERR_PKT_Gboolean := true
AxiStreamCtrlType :=(pause => '0',overflow => '0',idle => '1') AXI_STREAM_CTRL_UNUSED_C
VLAN_CONFIG_GAxiStreamConfigType := EMAC_AXIS_CONFIG_C
EN_FRAME_FILTER_Gboolean := true
Definition: SsiFifo.vhd:37
SLAVE_AXI_CONFIG_GAxiStreamConfigType := SSI_CONFIG_INIT_C
Definition: SsiFifo.vhd:54
CASCADE_SIZE_Gpositive := 1
Definition: SsiFifo.vhd:48
in sPrimMasterAxiStreamMasterType
out sAxisCtrlAxiStreamCtrlType
Definition: SsiFifo.vhd:62
BYP_CONFIG_GAxiStreamConfigType := EMAC_AXIS_CONFIG_C
in sVlanMastersAxiStreamMasterArray( VLAN_SIZE_G- 1 downto 0)
TPD_Gtime := 1 ns
_library_ ieeeieee
CASCADE_PAUSE_SEL_Gnatural := 0
Definition: SsiFifo.vhd:49
PIPE_STAGES_Gnatural := 1
Definition: SsiFifo.vhd:35
MASTER_AXI_CONFIG_GAxiStreamConfigType := SSI_CONFIG_INIT_C
Definition: SsiFifo.vhd:55
INT_PIPE_STAGES_Gnatural := 1
in mAxisRstsl
Definition: SsiFifo.vhd:68
CASCADE_SIZE_Gpositive := 2
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
Definition: EthMacPkg.vhd:58
std_logic_vector slv
Definition: StdRtlPkg.vhd:29
out sVlanCtrlAxiStreamCtrlArray( VLAN_SIZE_G- 1 downto 0)
OR_DROP_FLAGS_Gboolean := false
Definition: SsiFifo.vhd:38
in sAxisMasterAxiStreamMasterType
Definition: SsiFifo.vhd:60