1 |
2 |
boa_a_m |
|
2 |
|
|
library IEEE;
|
3 |
|
|
use IEEE.STD_LOGIC_1164.all;
|
4 |
|
|
use IEEE.NUMERIC_STD.all;
|
5 |
|
|
use IEEE.std_logic_unsigned.all;
|
6 |
|
|
use IEEE.STD_LOGIC_ARITH.ALL;
|
7 |
|
|
library unisim;
|
8 |
|
|
use unisim.vcomponents.all;
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
entity GIGABYTE_LAN_Interface is
|
14 |
|
|
generic (
|
15 |
|
|
LAN_Lable : string:="LAN_0";
|
16 |
|
|
IDELAY_GRP_Str : string:="Grp_KED";
|
17 |
|
|
IDELAY_GRP_Str_s : string:="<Grp_KED_tx>";
|
18 |
|
|
c_udp_tx_src_ip : std_logic_vector (31 downto 0):= x"AC1E0101"--x"C0A86403"; --172.30.01.01(FPGA IP Adress)
|
19 |
|
|
-- c_udp_tx_src_port : std_logic_vector (15 downto 0):= x"0401"; --UDP Src Port(Value For This Constant is not Importanat)
|
20 |
|
|
-- c_udp_tx_dst_port : std_logic_vector (15 downto 0):= x"0FF5" --UDP Src Port(Value For This Constant is not Importanat);
|
21 |
|
|
|
22 |
|
|
);
|
23 |
|
|
port(
|
24 |
|
|
clk_125 : in std_logic;
|
25 |
|
|
clk_200 : in std_logic;
|
26 |
|
|
|
27 |
|
|
---------------------------------------------------------------
|
28 |
|
|
o_phy_rstn : out STD_LOGIC;--Reset to PHY
|
29 |
|
|
rx_mac_aclk : out STD_LOGIC ;
|
30 |
|
|
i_reset : in STD_LOGIC:='0' ;
|
31 |
|
|
gmii_rx_clk : in STD_LOGIC ;
|
32 |
|
|
gmii_tx_clk : out STD_LOGIC ;
|
33 |
|
|
-- o_Rgmii_txc : out std_logic;
|
34 |
|
|
-- o_Rgmii_tx_ctrl : out std_logic;
|
35 |
|
|
-- o_Rgmii_txd : out std_logic_vector(4 downto 0);
|
36 |
|
|
|
37 |
|
|
-- i_Rgmii_rxc : in std_logic;
|
38 |
|
|
-- i_Rgmii_rx_ctrl : in std_logic;
|
39 |
|
|
-- i_Rgmii_rxd : in std_logic_vector(4 downto 0);
|
40 |
|
|
|
41 |
|
|
o_gmii_tx_en : out std_logic;
|
42 |
|
|
o_gmii_tx_er : out std_logic;
|
43 |
|
|
o_gmii_txd : out std_logic_vector(7 downto 0);
|
44 |
|
|
|
45 |
|
|
i_gmii_rx_dv : in std_logic;
|
46 |
|
|
i_gmii_rx_er : in std_logic;
|
47 |
|
|
i_gmii_rxd : in std_logic_vector(7 downto 0);
|
48 |
|
|
|
49 |
|
|
o_mac_tx_tready : out std_logic;
|
50 |
|
|
|
51 |
|
|
i_udp_rx_src_ip : in std_logic_vector(31 downto 0);
|
52 |
|
|
o_udp_rx_src_ip : out std_logic_vector(31 downto 0);
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
o_mdc : out std_logic;
|
56 |
|
|
io_mdio : inout std_logic;
|
57 |
|
|
---------------------------------------------------------
|
58 |
|
|
--------------- user ------------------------------------
|
59 |
|
|
o_udp_rx_err_out : out std_logic_vector(3 downto 0);
|
60 |
|
|
i_fragment_len : in std_logic_vector(16 - 1 downto 0):=x"4000";
|
61 |
|
|
LAN_clk : out std_logic;
|
62 |
|
|
LAN_dout_rdy : out std_logic;
|
63 |
|
|
LAN_dout_last : out std_logic;
|
64 |
|
|
LAN_dout : out std_logic_vector(8 - 1 downto 0);
|
65 |
|
|
LAN_din_rdy : in std_logic;
|
66 |
|
|
LAN_din_last : in std_logic;
|
67 |
|
|
LAN_din : in std_logic_vector(8 - 1 downto 0)
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
);
|
71 |
|
|
end GIGABYTE_LAN_Interface;
|
72 |
|
|
|
73 |
|
|
architecture Behavioral of GIGABYTE_LAN_Interface is
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
--=========================== Reset Generator ==========================================
|
78 |
|
|
component reset_gen
|
79 |
|
|
port
|
80 |
|
|
(
|
81 |
|
|
i_clk : in std_logic;
|
82 |
|
|
i_reset : in std_logic;
|
83 |
|
|
o_global_reset : out std_logic;
|
84 |
|
|
o_vector_reset : out std_logic;
|
85 |
|
|
o_phy_rstn : out std_logic
|
86 |
|
|
|
87 |
|
|
);
|
88 |
|
|
end component;
|
89 |
|
|
--======================================================================================
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
--======================================================================================
|
94 |
|
|
component sync_fifo2
|
95 |
|
|
port
|
96 |
|
|
(
|
97 |
|
|
rst : IN STD_LOGIC;
|
98 |
|
|
wr_clk : IN STD_LOGIC; --Maximum 125MHz
|
99 |
|
|
wr_en : IN STD_LOGIC;
|
100 |
|
|
din : IN STD_LOGIC_VECTOR(10-1 DOWNTO 0); --(last & data)
|
101 |
|
|
|
102 |
|
|
rd_clk : IN STD_LOGIC; --Tx_Clk(125MHz)
|
103 |
|
|
rd_en : IN STD_LOGIC;
|
104 |
|
|
dout : OUT STD_LOGIC_VECTOR(10-1 DOWNTO 0);
|
105 |
|
|
valid : OUT STD_LOGIC;
|
106 |
|
|
full : OUT STD_LOGIC;
|
107 |
|
|
empty : OUT STD_LOGIC
|
108 |
|
|
|
109 |
|
|
);
|
110 |
|
|
end component;
|
111 |
|
|
--======================================================================================
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
--================================= Constant ===========================================
|
115 |
|
|
--Generate Block Conditional Constants
|
116 |
|
|
constant c_GENERATE_PING_MODULE : boolean := true; --if Ping Block is not Used,Value is False
|
117 |
|
|
constant c_GENERATE_ARP_MODULE : boolean := true; --if ARP Block is not Used,Value is False
|
118 |
|
|
constant c_DEFAULT_DST_MAC_ADDR : std_logic_vector (47 downto 0) := x"F46D04962225"; --if ARP Block is not Used,Copy PC MAC Address to This Value
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
--Application Layer Data Length
|
122 |
|
|
constant c_PACKET_LENGTH : std_logic_vector (15 downto 0):= x"05c0"; --1472 (Maximum Application Layer Packet Length)
|
123 |
|
|
--constant c_udp_tx_src_ip : std_logic_vector (31 downto 0):= x"AC1E0101";--x"C0A86403"; --172.30.01.01(FPGA IP Adress)
|
124 |
|
|
--constant c_udp_tx_src_port : std_logic_vector (15 downto 0):= x"0401"; --UDP Src Port(Value For This Constant is not Importanat)
|
125 |
|
|
constant c_udp_tx_dst_ip : std_logic_vector (31 downto 0):= x"AC1E0103";--x"C0A86402"; --172.30.01.03(PC IP Address)
|
126 |
|
|
constant c_udp_tx_protocol : std_logic_vector (7 downto 0) := x"11"; --UDP Protocol
|
127 |
|
|
constant c_udp_tx_src_mac : std_logic_vector (47 downto 0):= x"112233445566"; --FPGA MAC Address
|
128 |
|
|
constant c_udp_tx_checksum : std_logic_vector (15 downto 0):= x"0000"; --UDP Checksum(Value For This Constant is not Importanat)
|
129 |
|
|
--constant c_udp_tx_dst_port : std_logic_vector (15 downto 0):= x"0FF5"; --UDP Dst Port(Value For This Constant is not Importanat)
|
130 |
|
|
|
131 |
|
|
--ARP Constants
|
132 |
|
|
constant c_TIME_OUT_LOOKUP_TABLE_ARP : std_logic_vector (31 downto 0) := x"9502F900"; --20S(Value/125MHz = 20 )
|
133 |
|
|
constant c_TIME_OUT_WAIT_FOR_ARP_REPLY : std_logic_vector (31 downto 0) := x"07735940"; --1S (Value/125MHz = 1 )
|
134 |
|
|
constant c_RE_SEND_ARP_REQUEST : std_logic_vector (3 downto 0) := x"A"; --10
|
135 |
|
|
|
136 |
|
|
|
137 |
|
|
--IP Constants
|
138 |
|
|
constant c_IP_TTL : std_logic_vector (7 downto 0) := x"80"; -- IP Packet Time to live
|
139 |
|
|
constant c_IP_BC_ADDR : std_logic_vector (31 downto 0) := x"ffffffff"; -- Broadcast IP Address
|
140 |
|
|
constant c_MAC_BC_ADDR : std_logic_vector (47 downto 0) := x"ffffffffffff"; -- Broadcast
|
141 |
|
|
--========================================================================================
|
142 |
|
|
|
143 |
|
|
|
144 |
|
|
|
145 |
|
|
--============================== Signals =================================================
|
146 |
|
|
signal s_Reset_tx_for_eth : std_logic:='0';
|
147 |
|
|
signal s_Reset_rx_for_eth : std_logic:='0';
|
148 |
|
|
signal s_Reset_tx : std_logic:='0';
|
149 |
|
|
signal s_Reset_rx : std_logic:='0';
|
150 |
|
|
signal reset_reg : std_logic_vector(9 downto 0):=(others=>'0');
|
151 |
|
|
|
152 |
|
|
|
153 |
|
|
signal s_dout : std_logic_vector(7 downto 0):=(others=>'0');
|
154 |
|
|
signal s_dout_valid : std_logic:='0';
|
155 |
|
|
signal s_dout_last : std_logic:='0';
|
156 |
|
|
|
157 |
|
|
signal s_dout1 : std_logic_vector(7 downto 0):=(others=>'0');
|
158 |
|
|
signal s_dout_valid1 : std_logic:='0';
|
159 |
|
|
signal s_dout_last1 : std_logic:='0';
|
160 |
|
|
|
161 |
|
|
|
162 |
|
|
signal s_udp_rx_sigs : std_logic_vector(10-1 downto 0);
|
163 |
|
|
signal s_udp_sigs : std_logic_vector(10-1 downto 0);
|
164 |
|
|
signal s_udp_sigs_valid : std_logic:='0';
|
165 |
|
|
|
166 |
|
|
signal s_sync_fifo_empty : std_logic:='1';
|
167 |
|
|
signal s_not_sync_fifo_empty : std_logic:='0';
|
168 |
|
|
|
169 |
|
|
signal s_udp_data_in : std_logic_vector(8-1 downto 0):=(others=>'0');
|
170 |
|
|
signal s_udp_valid_in : std_logic:='0';
|
171 |
|
|
signal s_udp_last_in : std_logic:='0';
|
172 |
|
|
signal s_udp_last_in_r : std_logic:='0';
|
173 |
|
|
|
174 |
|
|
signal s_udp_rx_dout_last_reset : STD_LOGIC:='0';
|
175 |
|
|
signal s_udp_rx_dout_rdy_r : std_logic:='0';
|
176 |
|
|
signal internal_rst : std_logic;
|
177 |
|
|
signal vector_rst : std_logic;
|
178 |
|
|
|
179 |
|
|
signal s_udp_tx_data_len : std_logic_vector (15 downto 0):= c_PACKET_LENGTH; --1472 (Maximum Application Layer Packet Length)
|
180 |
|
|
signal s_udp_tx_start : std_logic:='0';
|
181 |
|
|
signal s_udp_tx_ready : std_logic;
|
182 |
|
|
signal s_udp_tx_din : std_logic_vector(7 downto 0);
|
183 |
|
|
|
184 |
|
|
signal s_udp_rx_dout : std_logic_vector(7 downto 0);
|
185 |
|
|
signal s_udp_rx_dout_rdy : std_logic;
|
186 |
|
|
signal s_udp_rx_dout_last : std_logic;
|
187 |
|
|
|
188 |
|
|
signal s_udp_rx_src_ip : std_logic_vector(31 downto 0);
|
189 |
|
|
signal s_udp_rx_src_port : std_logic_vector(15 downto 0);
|
190 |
|
|
signal s_udp_rx_dst_port : std_logic_vector(15 downto 0);
|
191 |
|
|
signal s_udp_rx_data_len : std_logic_vector(15 downto 0);
|
192 |
|
|
signal s_udp_rx_err_out_top : std_logic_vector(3 downto 0);
|
193 |
|
|
signal s_udp_tx_err_out_top : std_logic_vector(3 downto 0);
|
194 |
|
|
signal s_arp_rx_err_out_top : std_logic_vector(3 downto 0);
|
195 |
|
|
signal s_ip_rx_dst_ip_top : std_logic_vector(31 downto 0);
|
196 |
|
|
signal s_ip_rx_err_out_top : std_logic_vector (3 downto 0);
|
197 |
|
|
signal s_ip_tx_err_out_top : std_logic_vector (3 downto 0);
|
198 |
|
|
signal s_arp_addr_valid : std_logic:='0';
|
199 |
|
|
|
200 |
|
|
|
201 |
|
|
signal s_rx_clk_out : std_logic;
|
202 |
|
|
signal s_tx_clk_out : std_logic;
|
203 |
|
|
|
204 |
|
|
signal s_tx_fragmantation : std_logic_vector (15 downto 0):=x"4000";
|
205 |
|
|
|
206 |
|
|
|
207 |
|
|
|
208 |
|
|
|
209 |
|
|
|
210 |
|
|
--========================================================================================
|
211 |
|
|
|
212 |
|
|
begin
|
213 |
|
|
|
214 |
|
|
o_mdc <= '0';
|
215 |
|
|
io_mdio <= '0';
|
216 |
|
|
|
217 |
|
|
|
218 |
|
|
o_udp_rx_err_out <=s_udp_rx_err_out_top;
|
219 |
|
|
|
220 |
|
|
|
221 |
|
|
|
222 |
|
|
|
223 |
|
|
inst_reset_gen: reset_gen
|
224 |
|
|
port map
|
225 |
|
|
(
|
226 |
|
|
i_clk => clk_125,
|
227 |
|
|
i_reset => i_reset,
|
228 |
|
|
o_global_reset => internal_rst,
|
229 |
|
|
o_vector_reset => vector_rst,
|
230 |
|
|
o_phy_rstn => o_phy_rstn
|
231 |
|
|
);
|
232 |
|
|
|
233 |
|
|
--==========================================================================
|
234 |
|
|
s_Reset_tx_for_eth <= internal_rst or s_Reset_tx;
|
235 |
|
|
s_Reset_rx_for_eth <= internal_rst or s_Reset_rx;
|
236 |
|
|
|
237 |
|
|
|
238 |
|
|
|
239 |
|
|
|
240 |
|
|
--============================ Ethernet_1g =================================
|
241 |
|
|
inst_Ethernet_1g: entity work.Ethernet_1g
|
242 |
|
|
generic map(
|
243 |
|
|
LAN_Lable => LAN_Lable,
|
244 |
|
|
IDELAY_GRP_Str => IDELAY_GRP_Str,
|
245 |
|
|
IDELAY_GRP_Str_s => IDELAY_GRP_Str_s,
|
246 |
|
|
g_TIME_OUT_LOOKUP_TABLE_ARP => c_TIME_OUT_LOOKUP_TABLE_ARP,
|
247 |
|
|
g_TIME_OUT_WAIT_FOR_ARP_REPLY => c_TIME_OUT_WAIT_FOR_ARP_REPLY,
|
248 |
|
|
g_RE_SEND_ARP_REQUEST => c_RE_SEND_ARP_REQUEST,
|
249 |
|
|
g_GENERATE_PING_MODULE => c_GENERATE_PING_MODULE,
|
250 |
|
|
g_GENERATE_ARP_MODULE => c_GENERATE_ARP_MODULE,
|
251 |
|
|
g_DEFAULT_DST_MAC_ADDR => c_DEFAULT_DST_MAC_ADDR
|
252 |
|
|
|
253 |
|
|
)
|
254 |
|
|
port map
|
255 |
|
|
(
|
256 |
|
|
|
257 |
|
|
i_clk_125 => clk_125, --125MHz
|
258 |
|
|
refclk => clk_200, --200MHz
|
259 |
|
|
rx_mac_aclk => rx_mac_aclk ,
|
260 |
|
|
gmii_rx_clk => gmii_rx_clk ,
|
261 |
|
|
gmii_tx_clk => gmii_tx_clk ,
|
262 |
|
|
|
263 |
|
|
i_global_reset => internal_rst, --Active High
|
264 |
|
|
i_vector_reset => vector_rst, --Active High
|
265 |
|
|
i_Reset_tx => s_Reset_tx_for_eth,
|
266 |
|
|
i_Reset_rx => s_Reset_rx_for_eth,
|
267 |
|
|
o_tx_clk_out => open, --125MHz
|
268 |
|
|
o_rx_clk_out => s_rx_clk_out, --125MHz
|
269 |
|
|
|
270 |
|
|
--================= UDP ============================
|
271 |
|
|
-- UDP & IP Tx header
|
272 |
|
|
i_udp_tx_src_ip => c_udp_tx_src_ip,
|
273 |
|
|
i_udp_tx_dst_ip => i_udp_rx_src_ip,--c_udp_tx_dst_ip,
|
274 |
|
|
i_udp_tx_data_len => s_udp_tx_data_len,
|
275 |
|
|
i_udp_tx_protocol => c_udp_tx_protocol,
|
276 |
|
|
i_udp_tx_src_mac => c_udp_tx_src_mac,
|
277 |
|
|
i_udp_tx_checksum => c_udp_tx_checksum,
|
278 |
|
|
i_udp_tx_src_port => s_udp_rx_dst_port,--c_udp_tx_src_port,
|
279 |
|
|
i_udp_tx_dst_port => s_udp_rx_src_port,--c_udp_tx_dst_port,--
|
280 |
|
|
i_ip_tx_fragmantation => s_tx_fragmantation,
|
281 |
|
|
i_fragment_len => i_fragment_len,
|
282 |
|
|
-- UDP TX Inpus
|
283 |
|
|
i_udp_tx_start => s_udp_tx_start,
|
284 |
|
|
o_udp_tx_ready => s_udp_tx_ready,
|
285 |
|
|
o_mac_tx_tready => open,--o_mac_tx_tready,--
|
286 |
|
|
i_udp_tx_din => s_udp_tx_din,
|
287 |
|
|
|
288 |
|
|
-- UDP RX Outputs
|
289 |
|
|
o_udp_rx_dout => s_udp_rx_dout,
|
290 |
|
|
o_udp_rx_dout_rdy => s_udp_rx_dout_rdy,
|
291 |
|
|
o_udp_rx_dout_last => s_udp_rx_dout_last,
|
292 |
|
|
|
293 |
|
|
-- UDP RX Status Outp
|
294 |
|
|
o_udp_rx_src_ip => o_udp_rx_src_ip,
|
295 |
|
|
o_udp_rx_src_port => s_udp_rx_src_port,
|
296 |
|
|
o_udp_rx_dst_port => s_udp_rx_dst_port,
|
297 |
|
|
o_udp_rx_data_len => s_udp_rx_data_len,
|
298 |
|
|
o_udp_rx_err_out => s_udp_rx_err_out_top,
|
299 |
|
|
o_udp_tx_err_out => s_udp_tx_err_out_top,
|
300 |
|
|
o_arp_rx_err_out => s_arp_rx_err_out_top,
|
301 |
|
|
-- o_ip_rx_fragmantation => open,--o_ip_rx_fragmantation,
|
302 |
|
|
o_arp_addr_valid => s_arp_addr_valid,
|
303 |
|
|
-- IP Status
|
304 |
|
|
o_ip_rx_dst_ip => s_ip_rx_dst_ip_top,
|
305 |
|
|
o_ip_rx_err_out => s_ip_rx_err_out_top,
|
306 |
|
|
o_ip_tx_err_out => s_ip_tx_err_out_top,
|
307 |
|
|
|
308 |
|
|
|
309 |
|
|
--=============== PHY ==========================
|
310 |
|
|
-- o_Rgmii_txc => o_Rgmii_txc,
|
311 |
|
|
-- o_Rgmii_tx_ctrl => o_Rgmii_tx_ctrl,
|
312 |
|
|
-- o_Rgmii_txd => o_Rgmii_txd,
|
313 |
|
|
|
314 |
|
|
-- i_Rgmii_rxc => i_Rgmii_rxc,
|
315 |
|
|
-- i_Rgmii_rx_ctrl => i_Rgmii_rx_ctrl,
|
316 |
|
|
-- i_Rgmii_rxd => i_Rgmii_rxd,
|
317 |
|
|
|
318 |
|
|
o_gmii_tx_en => o_gmii_tx_en ,
|
319 |
|
|
o_gmii_tx_er => o_gmii_tx_er ,
|
320 |
|
|
o_gmii_txd => o_gmii_txd ,
|
321 |
|
|
|
322 |
|
|
i_gmii_rx_dv => i_gmii_rx_dv ,
|
323 |
|
|
i_gmii_rx_er => i_gmii_rx_er ,
|
324 |
|
|
i_gmii_rxd => i_gmii_rxd ,
|
325 |
|
|
|
326 |
|
|
i_gmii_crs => '0',
|
327 |
|
|
i_gmii_col => '0'
|
328 |
|
|
);
|
329 |
|
|
|
330 |
|
|
|
331 |
|
|
--=================================================
|
332 |
|
|
|
333 |
|
|
|
334 |
|
|
|
335 |
|
|
|
336 |
|
|
----================================================================================
|
337 |
|
|
----process(s_rx_clk_out)
|
338 |
|
|
----begin
|
339 |
|
|
----if rising_edge(s_rx_clk_out) then
|
340 |
|
|
---- s_udp_rx_dout_last_reset <= s_udp_rx_dout_last;
|
341 |
|
|
---- if (s_udp_rx_dout_last_reset = '1') then
|
342 |
|
|
---- reset_reg <= (others=>'1');
|
343 |
|
|
---- else
|
344 |
|
|
---- reset_reg <= reset_reg(8 downto 0) & '0';
|
345 |
|
|
---- end if;
|
346 |
|
|
----end if;
|
347 |
|
|
----end process;
|
348 |
|
|
|
349 |
|
|
----s_Reset_rx <= reset_reg(9);
|
350 |
|
|
----================================================================================
|
351 |
|
|
|
352 |
|
|
|
353 |
|
|
|
354 |
|
|
|
355 |
|
|
----========================== Recieved UDP Data ===================================
|
356 |
|
|
process(s_rx_clk_out)
|
357 |
|
|
begin
|
358 |
|
|
if rising_edge(s_rx_clk_out) then
|
359 |
|
|
s_udp_rx_dout_rdy_r <= s_udp_rx_dout_rdy;
|
360 |
|
|
s_udp_rx_sigs <= s_udp_rx_dout_last & s_udp_rx_dout_rdy & s_udp_rx_dout;
|
361 |
|
|
end if;
|
362 |
|
|
end process;
|
363 |
|
|
|
364 |
|
|
|
365 |
|
|
|
366 |
|
|
inst_sync_fifo: sync_fifo2
|
367 |
|
|
port map
|
368 |
|
|
(
|
369 |
|
|
rst => '0',
|
370 |
|
|
wr_clk => s_rx_clk_out,
|
371 |
|
|
wr_en => s_udp_rx_dout_rdy_r,
|
372 |
|
|
din => s_udp_rx_sigs,
|
373 |
|
|
|
374 |
|
|
rd_clk => clk_125,
|
375 |
|
|
rd_en => s_not_sync_fifo_empty,
|
376 |
|
|
empty => s_sync_fifo_empty,
|
377 |
|
|
dout => s_udp_sigs,
|
378 |
|
|
valid => s_udp_sigs_valid,
|
379 |
|
|
full => open
|
380 |
|
|
|
381 |
|
|
|
382 |
|
|
);
|
383 |
|
|
|
384 |
|
|
process(clk_125)
|
385 |
|
|
begin
|
386 |
|
|
if rising_edge(clk_125) then
|
387 |
|
|
s_not_sync_fifo_empty <= not(s_sync_fifo_empty);
|
388 |
|
|
|
389 |
|
|
if (s_udp_sigs_valid = '1') then
|
390 |
|
|
s_udp_data_in <= s_udp_sigs(7 downto 0);
|
391 |
|
|
s_udp_valid_in <= s_udp_sigs(8);
|
392 |
|
|
s_udp_last_in <= s_udp_sigs(9);
|
393 |
|
|
else
|
394 |
|
|
s_udp_data_in <= (others=>'0');
|
395 |
|
|
s_udp_valid_in <= '0';
|
396 |
|
|
s_udp_last_in <= '0';
|
397 |
|
|
end if;
|
398 |
|
|
|
399 |
|
|
end if;
|
400 |
|
|
end process;
|
401 |
|
|
|
402 |
|
|
----==================================================================================
|
403 |
|
|
|
404 |
|
|
|
405 |
|
|
--======================= ping_pong fifo ==========================
|
406 |
|
|
inst_ping_pong_fifo2: entity work.ping_pong_fifo2_KED
|
407 |
|
|
generic map(
|
408 |
|
|
g_PACKET_LENGTH => c_PACKET_LENGTH)
|
409 |
|
|
port map (
|
410 |
|
|
i_clk => clk_125,
|
411 |
|
|
i_rst => internal_rst,
|
412 |
|
|
|
413 |
|
|
|
414 |
|
|
-- i_din => s_udp_data_in,
|
415 |
|
|
-- i_din_valid => s_udp_valid_in,
|
416 |
|
|
-- i_din_last => s_udp_last_in,
|
417 |
|
|
|
418 |
|
|
i_din => LAN_din,
|
419 |
|
|
i_din_valid => LAN_din_rdy,
|
420 |
|
|
i_din_last => LAN_din_last,
|
421 |
|
|
|
422 |
|
|
|
423 |
|
|
--to UDP
|
424 |
|
|
i_rd_en => s_udp_tx_ready,
|
425 |
|
|
o_dout => s_udp_tx_din,
|
426 |
|
|
o_start_out => s_udp_tx_start,
|
427 |
|
|
o_dout_len => s_udp_tx_data_len,
|
428 |
|
|
o_fragment => s_tx_fragmantation,
|
429 |
|
|
|
430 |
|
|
fifo_ready => o_mac_tx_tready,--open,--
|
431 |
|
|
full => open,
|
432 |
|
|
o_wr_cnta => open,
|
433 |
|
|
o_wr_cntb => open);
|
434 |
|
|
|
435 |
|
|
|
436 |
|
|
LAN_clk <= clk_125;
|
437 |
|
|
LAN_dout_rdy <= s_udp_valid_in;
|
438 |
|
|
LAN_dout_last <= s_udp_last_in;
|
439 |
|
|
LAN_dout <= s_udp_data_in;
|
440 |
|
|
|
441 |
|
|
--======================= LAN TX Send Data ==========================
|
442 |
|
|
|
443 |
|
|
|
444 |
|
|
end Behavioral;
|
445 |
|
|
|