SURF  1.0
EthMacRxBypass.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 -- File : EthMacRxBypass.vhd
3 -- Company : SLAC National Accelerator Laboratory
4 -- Created : 2016-01-04
5 -- Last update: 2016-09-14
6 -------------------------------------------------------------------------------
7 -- Description: RX bypass frame extractor.
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 EthMacRxBypass is
30  generic (
31  TPD_G : time := 1 ns;
32  BYP_EN_G : boolean := false;
33  BYP_ETH_TYPE_G : slv(15 downto 0) := x"0000");
34  port (
35  -- Clock and Reset
36  ethClk : in sl;
37  ethRst : in sl;
38  -- Incoming data from MAC
40  -- Outgoing primary data
42  -- Outgoing bypass data
44 end EthMacRxBypass;
45 
46 architecture rtl of EthMacRxBypass is
47 
48  type StateType is (
49  IDLE_S,
50  PRIM_S,
51  BYP_S);
52 
53  type RegType is record
56  state : StateType;
57  end record RegType;
58 
59  constant REG_INIT_C : RegType := (
62  state => IDLE_S);
63 
64  signal r : RegType := REG_INIT_C;
65  signal rin : RegType;
66 
67  -- attribute dont_touch : string;
68  -- attribute dont_touch of r : signal is "true";
69 
70 begin
71 
72  U_BypRxEnGen : if (BYP_EN_G = true) generate
73 
74  comb : process (ethRst, r, sAxisMaster) is
75  variable v : RegType;
76  begin
77  -- Latch the current value
78  v := r;
79 
80  -- Clear valid
81  v.mBypMaster.tValid := '0';
82  v.mPrimMaster.tValid := '0';
83 
84  -- State Machine
85  case r.state is
86  ----------------------------------------------------------------------
87  when IDLE_S =>
88  -- Check for data
89  if sAxisMaster.tValid = '1' then
90  -- Check for bypass EtherType
91  if sAxisMaster.tData(111 downto 96) = BYP_ETH_TYPE_G then
92  -- Move data
94  -- Check for no EOF
95  if sAxisMaster.tLast = '0' then
96  -- Next state
97  v.state := BYP_S;
98  end if;
99  else
100  -- Move data
102  -- Check for no EOF
103  if sAxisMaster.tLast = '0' then
104  -- Next state
105  v.state := PRIM_S;
106  end if;
107  end if;
108  end if;
109  ----------------------------------------------------------------------
110  when BYP_S =>
111  -- Move data
112  v.mBypMaster := sAxisMaster;
113  -- Check for a valid EOF
114  if (sAxisMaster.tValid = '1') and (sAxisMaster.tLast = '1') then
115  -- Next state
116  v.state := IDLE_S;
117  end if;
118  ----------------------------------------------------------------------
119  when PRIM_S =>
120  -- Move data
122  -- Check for a valid EOF
123  if (sAxisMaster.tValid = '1') and (sAxisMaster.tLast = '1') then
124  -- Next state
125  v.state := IDLE_S;
126  end if;
127  ----------------------------------------------------------------------
128  end case;
129 
130  -- Reset
131  if ethRst = '1' then
132  v := REG_INIT_C;
133  end if;
134 
135  -- Register the variable for next clock cycle
136  rin <= v;
137 
138  -- Outputs
140  mBypMaster <= r.mBypMaster;
141 
142  end process;
143 
144  seq : process (ethClk) is
145  begin
146  if rising_edge(ethClk) then
147  r <= rin after TPD_G;
148  end if;
149  end process seq;
150 
151  end generate;
152 
153  U_BypRxDisGen : if (BYP_EN_G = false) generate
156  end generate;
157 
158 end rtl;
out mPrimMasterAxiStreamMasterType
std_logic sl
Definition: StdRtlPkg.vhd:28
TPD_Gtime := 1 ns
_library_ ieeeieee
Definition: EthMacRx.vhd:18
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
BYP_EN_Gboolean := false
slv( 127 downto 0) tData
out mBypMasterAxiStreamMasterType
in sAxisMasterAxiStreamMasterType
BYP_ETH_TYPE_Gslv( 15 downto 0) := x"0000"
std_logic_vector slv
Definition: StdRtlPkg.vhd:29