eFEX firmware  1.7.3
ATLAS l1-calo - electron and tau feature extraction firmware for eFEX boards

Back to eFEX documentation
eth_7s_gmii.vhd
1 -- Contains the instantiation of the Xilinx MAC IP plus the GMII PHY interface
2 --
3 -- Do not change signal names in here without corresponding alteration to the timing contraints file
4 --
5 -- Dave Newbold, April 2011
6 --
7 -- $Id$
8 
9 library ieee;
10 use ieee.std_logic_1164.all;
11 
12 library unisim;
13 use unisim.VComponents.all;
14 library ipbus_lib;
15 use ipbus_lib.emac_hostbus_decl.all;
16 
17 entity eth_7s_gmii is
18  port(
19  clk125: in std_logic;
20  clk200: in std_logic;
21  rst: in std_logic;
22  gmii_gtx_clk: out std_logic;
23  gmii_txd: out std_logic_vector(7 downto 0);
24  gmii_tx_en: out std_logic;
25  gmii_tx_er: out std_logic;
26  gmii_rx_clk: in std_logic;
27  gmii_rxd: in std_logic_vector(7 downto 0);
28  gmii_rx_dv: in std_logic;
29  gmii_rx_er: in std_logic;
30  tx_data: in std_logic_vector(7 downto 0);
31  tx_valid: in std_logic;
32  tx_last: in std_logic;
33  tx_error: in std_logic;
34  tx_ready: out std_logic;
35  rx_data: out std_logic_vector(7 downto 0);
36  rx_valid: out std_logic;
37  rx_last: out std_logic;
38  rx_error: out std_logic;
39  hostbus_in: in emac_hostbus_in := ('0', "00", "0000000000", X"00000000", '0', '0', '0');
40  hostbus_out: out emac_hostbus_out
41  );
42 
43 end eth_7s_gmii;
44 
45 architecture rtl of eth_7s_gmii is
46 
47  --COMPONENT temac_gbe_v9_0_gmii
48  COMPONENT temac_gbe_v9_0
49  PORT (
50  gtx_clk : IN STD_LOGIC;
51  glbl_rstn : IN STD_LOGIC;
52  rx_axi_rstn : IN STD_LOGIC;
53  tx_axi_rstn : IN STD_LOGIC;
54  rx_statistics_vector : OUT STD_LOGIC_VECTOR(27 DOWNTO 0);
55  rx_statistics_valid : OUT STD_LOGIC;
56  rx_mac_aclk : OUT STD_LOGIC;
57  rx_reset : OUT STD_LOGIC;
58  rx_axis_mac_tdata : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
59  rx_axis_mac_tvalid : OUT STD_LOGIC;
60  rx_axis_mac_tlast : OUT STD_LOGIC;
61  rx_axis_mac_tuser : OUT STD_LOGIC;
62  tx_ifg_delay : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
63  tx_statistics_vector : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
64  tx_statistics_valid : OUT STD_LOGIC;
65  tx_mac_aclk : OUT STD_LOGIC;
66  tx_reset : OUT STD_LOGIC;
67  tx_axis_mac_tdata : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
68  tx_axis_mac_tvalid : IN STD_LOGIC;
69  tx_axis_mac_tlast : IN STD_LOGIC;
70  tx_axis_mac_tuser : IN STD_LOGIC_VECTOR(0 DOWNTO 0);
71  tx_axis_mac_tready : OUT STD_LOGIC;
72  pause_req : IN STD_LOGIC;
73  pause_val : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
74  speedis100 : OUT STD_LOGIC;
75  speedis10100 : OUT STD_LOGIC;
76  gmii_txd : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
77  gmii_tx_en : OUT STD_LOGIC;
78  gmii_tx_er : OUT STD_LOGIC;
79  gmii_tx_clk : OUT STD_LOGIC;
80  gmii_rxd : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
81  gmii_rx_dv : IN STD_LOGIC;
82  gmii_rx_er : IN STD_LOGIC;
83  gmii_rx_clk : IN STD_LOGIC;
84  rx_configuration_vector : IN STD_LOGIC_VECTOR(79 DOWNTO 0);
85  tx_configuration_vector : IN STD_LOGIC_VECTOR(79 DOWNTO 0)
86  );
87  END COMPONENT;
88 
89  COMPONENT mac_fifo_axi4
90  PORT (
91  m_aclk : IN STD_LOGIC;
92  s_aclk : IN STD_LOGIC;
93  s_aresetn : IN STD_LOGIC;
94  s_axis_tvalid : IN STD_LOGIC;
95  s_axis_tready : OUT STD_LOGIC;
96  s_axis_tdata : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
97  s_axis_tlast : IN STD_LOGIC;
98  s_axis_tuser : IN STD_LOGIC_VECTOR(0 DOWNTO 0);
99  m_axis_tvalid : OUT STD_LOGIC;
100  m_axis_tready : IN STD_LOGIC;
101  m_axis_tdata : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
102  m_axis_tlast : OUT STD_LOGIC;
103  m_axis_tuser : OUT STD_LOGIC_VECTOR(0 DOWNTO 0)
104  );
105  END COMPONENT;
106 
107  signal rx_data_e: std_logic_vector(7 downto 0);
108  signal rx_clk_e, rx_valid_e, rx_last_e, rx_user_e, rx_rst_e, rx_rst_en, rstn: std_logic;
109  signal rx_user_f, rx_user_ef: std_logic_vector(0 downto 0);
110 
111  attribute IODELAY_GROUP : STRING;
112  attribute IODELAY_GROUP of idelayctrl0: label is "tri_mode_ethernet_mac_iodelay_grp";
113 
114 begin
115 
116  idelayctrl0: idelayctrl port map(
117  refclk => clk200,
118  rst => rst
119  );
120 
121  rstn <= not rst;
122 
123  -- emac0: temac_gbe_v9_0_gmii
124  emac0: temac_gbe_v9_0
125  port map(
126  gtx_clk => clk125,
127  glbl_rstn => rstn,
128  rx_axi_rstn => '1',
129  tx_axi_rstn => '1',
130  rx_statistics_vector => open,
131  rx_statistics_valid => open,
132  rx_mac_aclk => rx_clk_e,
133  rx_reset => rx_rst_e,
134  rx_axis_mac_tdata => rx_data_e,
135  rx_axis_mac_tvalid => rx_valid_e,
136  rx_axis_mac_tlast => rx_last_e,
137  rx_axis_mac_tuser => rx_user_e,
138  tx_ifg_delay => X"00",
139  tx_statistics_vector => open,
140  tx_statistics_valid => open,
141  tx_mac_aclk => open, -- Internally connected to gtx_clk inside core
142  tx_reset => open,
143  tx_axis_mac_tdata => tx_data,
144  tx_axis_mac_tvalid => tx_valid,
145  tx_axis_mac_tlast => tx_last,
146  tx_axis_mac_tuser(0) => tx_error,
147  tx_axis_mac_tready => tx_ready,
148  pause_req => '0',
149  pause_val => X"0000",
150  speedis100 => open,
151  speedis10100 => open,
152  gmii_txd => gmii_txd,
153  gmii_tx_en => gmii_tx_en,
154  gmii_tx_er => gmii_tx_er,
155  gmii_tx_clk => gmii_gtx_clk,
156  gmii_rxd => gmii_rxd,
157  gmii_rx_dv => gmii_rx_dv,
158  gmii_rx_er => gmii_rx_er,
159  gmii_rx_clk => gmii_rx_clk,
160  rx_configuration_vector => X"0000_0000_0000_0000_0812",
161  tx_configuration_vector => X"0000_0000_0000_0000_0012"
162  );
163 
164  rx_user_ef(0) <= rx_user_e;
165  rx_error <= rx_user_f(0);
166  rx_rst_en <= not rx_rst_e;
167 
168  fifo: mac_fifo_axi4
169  port map(
170  m_aclk => clk125,
171  s_aclk => rx_clk_e,
172  s_aresetn => rx_rst_en,
173  s_axis_tvalid => rx_valid_e,
174  s_axis_tready => open,
175  s_axis_tdata => rx_data_e,
176  s_axis_tlast => rx_last_e,
177  s_axis_tuser => rx_user_ef,
178  m_axis_tvalid => rx_valid,
179  m_axis_tready => '1',
180  m_axis_tdata => rx_data,
181  m_axis_tlast => rx_last,
182  m_axis_tuser => rx_user_f
183  ); -- Clock domain crossing FIFO
184 
185  hostbus_out.hostrddata <= (others => '0');
186  hostbus_out.hostmiimrdy <= '0';
187 
188 
189 end rtl;