1 -------------------------------------------------------------------------------
3 -- Title : ethernet_controller_wrapper
4 -- Design : ethernet_controller
5 -- Author : rrivera at fnal dot gov
6 -- Company : Fermi National Accelerator Laboratory
8 -------------------------------------------------------------------------------
10 -- Modified : Thu Nov 12 10:33:07 2015
12 -------------------------------------------------------------------------------
16 -------------------------------------------------------------------------------
17 -- Design unit header --
19 use ieee.std_logic_1164.
ALL;
20 use ieee.numeric_std.
ALL;
32 GMII_RXD : in (7 downto 0);
35 GMII_TXD : out (7 downto 0);
39 self_addr : in (31 downto 0);
40 self_mac : in (47 downto 0);
41 self_port : in (15 downto 0);
44 user_tx_dest_addr : in (31 downto 0);
45 user_tx_dest_mac : in (47 downto 0);
46 user_tx_dest_port : in (15 downto 0);
49 user_rx_valid_out : out ;
50 user_rx_data_out : out (7 downto 0);
51 user_rx_size_out : out (10 downto 0);
52 user_tx_enable_out : out ;
53 user_tx_data_in : in (7 downto 0);
54 user_tx_size_in : in (10 downto 0);
55 user_tx_trigger : in ;
59 four_bit_mode_out : out ;
61 udp_fwd_port : out (15 downto 0);
63 user_rx_src_capture_for_ctrl : out ;
64 user_rx_src_capture_for_data : out ;
65 user_rx_src_addr : out (31 downto 0);
66 user_rx_src_mac : out (47 downto 0);
67 user_rx_src_port : out (15 downto 0)
73 ---- Verilog Component declarations ----
77 CRC_data :
in (
7 downto 0);
90 Frame_data :
in (
7 downto 0);
94 CRC_out :
out (
7 downto 0)
98 ---- Signal declarations ----
100 signal crc_chk_en : ;
101 signal crc_chk_init : ;
102 signal crc_chk_rd : ;
103 signal crc_gen_en : ;
104 signal crc_gen_en_masked : ;
105 signal crc_gen_init : ;
106 signal crc_gen_rd : ;
107 signal crc_gen_rd_masked : ;
109 signal four_bit_mode : ;
110 signal rx_dv_handled : ;
111 signal rx_er_handled : ;
116 signal crc_chk_din : (7 downto 0);
117 signal crc_gen_out : (7 downto 0);
118 signal GMII_RXD_sig : (7 downto 0);
119 signal rx_data_handled : (7 downto 0);
120 signal txd : (7 downto 0);
121 signal txd_out : (7 downto 0);
127 ---- Component instantiations ----
131 GMII_GTX_CLK => GTX_CLK,
132 GMII_RXD => rx_data_handled,
133 GMII_RX_CLK => GMII_RX_CLK,
134 GMII_RX_DV => rx_dv_handled,
135 GMII_RX_ER => rx_er_handled,
140 four_bit_mode_out => four_bit_mode,
143 self_addr => self_addr,
144 self_mac => self_mac,
145 self_port => self_port,
147 trigger => user_tx_trigger ,
148 dest_addr => user_tx_dest_addr ,
149 dest_mac => user_tx_dest_mac ,
150 dest_port => user_tx_dest_port ,
151 arp_announce => arp_announce,
153 src_addr => user_rx_src_addr ,
154 src_mac => user_rx_src_mac ,
155 src_port => user_rx_src_port ,
156 src_capture_for_ctrl => user_rx_src_capture_for_ctrl ,
157 src_capture_for_data => user_rx_src_capture_for_data ,
159 crc_chk_din => crc_chk_din,
160 crc_chk_en => crc_chk_en,
161 crc_chk_init => crc_chk_init,
162 crc_chk_rd => crc_chk_rd,
163 crc_gen_en => crc_gen_en,
164 crc_gen_init => crc_gen_init,
165 crc_gen_rd => crc_gen_rd,
167 udp_dest_port => udp_fwd_port,
--could be used as additional address space for user firmware
169 en_tx_data => user_tx_enable_out ,
170 udp_data_count => user_rx_size_out,
171 user_rx_data_out => user_rx_data_out ,
172 user_rx_valid_out => user_rx_valid_out ,
173 user_tx_data_in => user_tx_data_in,
174 user_tx_size_in => user_tx_size_in
182 rx_data_handled => rx_data_handled,
184 rx_dv_handled => rx_dv_handled,
186 rx_er_handled => rx_er_handled,
188 tx_data_handled => GMII_TXD,
190 tx_dv_handled => GMII_TX_EN,
192 tx_er_handled => GMII_TX_ER
195 crc_gen_en_masked <= crc_gen_en and crc_mask;
197 crc_gen_rd_masked <= crc_gen_rd and crc_mask;
199 crc_chk_out <= crc_chk_rd;
--output moment of checking, so downstream users know when check is complete
201 crcChk : crc_chk --Verilog
component
203 CRC_chk_en => crc_chk_rd,
204 CRC_data => crc_chk_din,
205 CRC_en => crc_chk_en,
207 CRC_init => crc_chk_init,
212 crcGen : crc_gen --Verilog
component
214 CRC_out => crc_gen_out,
215 CRC_rd => crc_gen_rd_masked ,
217 Data_en => crc_gen_en_masked ,
219 Init => crc_gen_init,
223 genDbgCRC:for i in 0 to 0 generate
224 signal tmp_rd_sig: := '0';
225 signal tmp_cnt : (1 downto 0) := (others => '0');
230 if (rising_edge(GMII_RX_CLK)) then
232 if crc_chk_rd = '1' then
235 elsif tmp_cnt /= 0 then
237 tmp_cnt <= tmp_cnt - 1;
243 crcGenDebug : crc_gen --Verilog
component for debuggin
246 CRC_rd => tmp_rd_sig,
248 Data_en => crc_chk_en,
249 Frame_data => crc_chk_din,
250 Init => crc_chk_init,
259 crc_mask => crc_mask,
261 four_bit_mode => four_bit_mode,
271 ---- Terminal assignment ----
273 -- Output\buffer terminals
274 four_bit_mode_out <= four_bit_mode;