1 |
145 |
lanttu |
-- ***************************************************
|
2 |
|
|
-- File: udp_receiver_example_dm9000a.vhd
|
3 |
|
|
-- Creation date: 30.03.2012
|
4 |
|
|
-- Creation time: 15:18:58
|
5 |
|
|
-- Description:
|
6 |
|
|
-- Created by: ege
|
7 |
|
|
-- This file was generated with Kactus2 vhdl generator.
|
8 |
|
|
-- ***************************************************
|
9 |
|
|
library IEEE;
|
10 |
|
|
library work;
|
11 |
|
|
use work.all;
|
12 |
|
|
use IEEE.std_logic_1164.all;
|
13 |
|
|
|
14 |
|
|
entity udp_receiver_example_dm9000a is
|
15 |
|
|
|
16 |
|
|
port (
|
17 |
|
|
|
18 |
|
|
-- Interface: clk_in
|
19 |
|
|
clk_in_CLK : in std_logic;
|
20 |
|
|
|
21 |
|
|
-- Interface: DM9000A
|
22 |
|
|
DM9000A_eth_interrupt_in : in std_logic;
|
23 |
|
|
DM9000A_eth_chip_sel_out : out std_logic;
|
24 |
|
|
DM9000A_eth_clk_out : out std_logic;
|
25 |
|
|
DM9000A_eth_cmd_out : out std_logic;
|
26 |
|
|
DM9000A_eth_read_out : out std_logic;
|
27 |
|
|
DM9000A_eth_reset_out : out std_logic;
|
28 |
|
|
DM9000A_eth_write_out : out std_logic;
|
29 |
|
|
DM9000A_eth_data_inout : inout std_logic_vector(15 downto 0);
|
30 |
|
|
|
31 |
|
|
-- Interface: led_out
|
32 |
|
|
led_out_gpio_out : out std_logic;
|
33 |
|
|
|
34 |
|
|
-- Interface: link_up_out
|
35 |
|
|
link_up_out_gpio_out : out std_logic;
|
36 |
|
|
|
37 |
|
|
-- Interface: rst_n
|
38 |
|
|
rst_n_RESETn : in std_logic
|
39 |
|
|
);
|
40 |
|
|
|
41 |
|
|
end udp_receiver_example_dm9000a;
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
architecture kactusHierarchical of udp_receiver_example_dm9000a is
|
45 |
|
|
|
46 |
|
|
signal altera_de2_pll_25_1_clk_out_to_udp_ip_dm9000a_1_clkCLK : std_logic;
|
47 |
|
|
signal udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxdest_port_out : std_logic_vector(15 downto 0);
|
48 |
|
|
signal udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxfatal_error_out : std_logic;
|
49 |
|
|
signal udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxlink_up_out : std_logic;
|
50 |
|
|
signal udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxnew_rx_out : std_logic;
|
51 |
|
|
signal simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txnew_tx_in : std_logic;
|
52 |
|
|
signal simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txno_arp_target_MAC_in : std_logic_vector(47 downto 0);
|
53 |
|
|
signal udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxrx_data_out : std_logic_vector(15 downto 0);
|
54 |
|
|
signal udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxrx_data_valid_out : std_logic;
|
55 |
|
|
signal udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxrx_erroneous_out : std_logic;
|
56 |
|
|
signal udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxrx_error_out : std_logic;
|
57 |
|
|
signal udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxrx_len_out : std_logic_vector(10 downto 0);
|
58 |
|
|
signal udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxrx_re_in : std_logic;
|
59 |
|
|
signal udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxsource_addr_out : std_logic_vector(31 downto 0);
|
60 |
|
|
signal udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxsource_port_out : std_logic_vector(15 downto 0);
|
61 |
|
|
signal simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txsource_port_in : std_logic_vector(15 downto 0);
|
62 |
|
|
signal simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txtarget_addr_in : std_logic_vector(31 downto 0);
|
63 |
|
|
signal simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txtarget_port_in : std_logic_vector(15 downto 0);
|
64 |
|
|
signal simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txtx_data_in : std_logic_vector(15 downto 0);
|
65 |
|
|
signal simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txtx_data_valid_in : std_logic;
|
66 |
|
|
signal simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txtx_len_in : std_logic_vector(10 downto 0);
|
67 |
|
|
signal simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txtx_re_out : std_logic;
|
68 |
|
|
|
69 |
|
|
-- Connect to UDP/IP controller. Receives all packets and blinks a LED as packets are received. Our own IP and MAC addresses are defined in udp_ip_pkg.
|
70 |
|
|
--
|
71 |
|
|
-- If you decide to disable ARP, you have to manually add the FPGA MAC address to your PC's ARP table.
|
72 |
|
|
component simple_udp_receiver_example
|
73 |
|
|
port (
|
74 |
|
|
|
75 |
|
|
-- Interface: clk
|
76 |
|
|
-- 25 MHz clock synch with udp/ip ctrl.
|
77 |
|
|
clk : in std_logic;
|
78 |
|
|
|
79 |
|
|
-- Interface: led_out
|
80 |
|
|
-- Led that changes its state after each received packet.
|
81 |
|
|
led_out : out std_logic;
|
82 |
|
|
|
83 |
|
|
-- Interface: link_up_out
|
84 |
|
|
-- Connect a LED here; rises a few seconds after the autonegotiation process is done.
|
85 |
|
|
link_up_out : out std_logic;
|
86 |
|
|
|
87 |
|
|
-- Interface: rst_n
|
88 |
|
|
-- rst_n
|
89 |
|
|
rst_n : in std_logic;
|
90 |
|
|
|
91 |
|
|
-- There ports are contained in many interfaces
|
92 |
|
|
fatal_error_in : in std_logic;
|
93 |
|
|
link_up_in : in std_logic;
|
94 |
|
|
|
95 |
|
|
-- Interface: udp_ip_rx
|
96 |
|
|
-- udp_ip_rx
|
97 |
|
|
dest_port_in : in std_logic_vector(15 downto 0);
|
98 |
|
|
new_rx_in : in std_logic;
|
99 |
|
|
rx_data_in : in std_logic_vector(15 downto 0);
|
100 |
|
|
rx_data_valid_in : in std_logic;
|
101 |
|
|
rx_erroneous_in : in std_logic;
|
102 |
|
|
rx_error_in : in std_logic;
|
103 |
|
|
rx_len_in : in std_logic_vector(10 downto 0);
|
104 |
|
|
source_addr_in : in std_logic_vector(31 downto 0);
|
105 |
|
|
source_port_in : in std_logic_vector(15 downto 0);
|
106 |
|
|
rx_re_out : out std_logic;
|
107 |
|
|
|
108 |
|
|
-- Interface: udp_ip_tx
|
109 |
|
|
-- udp_ip_tx. Optional; this example does not send anything.
|
110 |
|
|
tx_re_in : in std_logic;
|
111 |
|
|
new_tx_out : out std_logic;
|
112 |
|
|
no_arp_target_MAC_out : out std_logic_vector(47 downto 0);
|
113 |
|
|
source_port_out : out std_logic_vector(15 downto 0);
|
114 |
|
|
target_addr_out : out std_logic_vector(31 downto 0);
|
115 |
|
|
target_port_out : out std_logic_vector(15 downto 0);
|
116 |
|
|
tx_data_out : out std_logic_vector(15 downto 0);
|
117 |
|
|
tx_data_valid_out : out std_logic;
|
118 |
|
|
tx_len_out : out std_logic_vector(10 downto 0)
|
119 |
|
|
|
120 |
|
|
);
|
121 |
|
|
end component;
|
122 |
|
|
|
123 |
|
|
-- DM9000A controller and UDP/IP.
|
124 |
|
|
component udp_ip_dm9000a
|
125 |
|
|
generic (
|
126 |
|
|
disable_arp_g : integer := 0;
|
127 |
|
|
disable_rx_g : integer := 0
|
128 |
|
|
|
129 |
|
|
);
|
130 |
|
|
port (
|
131 |
|
|
|
132 |
|
|
-- Interface: app_rx
|
133 |
|
|
-- Application receive operations
|
134 |
|
|
rx_re_in : in std_logic;
|
135 |
|
|
dest_port_out : out std_logic_vector(15 downto 0);
|
136 |
|
|
new_rx_out : out std_logic;
|
137 |
|
|
rx_data_out : out std_logic_vector(15 downto 0);
|
138 |
|
|
rx_data_valid_out : out std_logic;
|
139 |
|
|
rx_erroneous_out : out std_logic;
|
140 |
|
|
rx_error_out : out std_logic;
|
141 |
|
|
rx_len_out : out std_logic_vector(10 downto 0);
|
142 |
|
|
source_addr_out : out std_logic_vector(31 downto 0);
|
143 |
|
|
source_port_out : out std_logic_vector(15 downto 0);
|
144 |
|
|
|
145 |
|
|
-- Interface: app_tx
|
146 |
|
|
-- Application transmit operations
|
147 |
|
|
new_tx_in : in std_logic;
|
148 |
|
|
no_arp_target_MAC_in : in std_logic_vector(47 downto 0);
|
149 |
|
|
source_port_in : in std_logic_vector(15 downto 0);
|
150 |
|
|
target_addr_in : in std_logic_vector(31 downto 0);
|
151 |
|
|
target_port_in : in std_logic_vector(15 downto 0);
|
152 |
|
|
tx_data_in : in std_logic_vector(15 downto 0);
|
153 |
|
|
tx_data_valid_in : in std_logic;
|
154 |
|
|
tx_len_in : in std_logic_vector(10 downto 0);
|
155 |
|
|
tx_re_out : out std_logic;
|
156 |
|
|
|
157 |
|
|
-- Interface: clk
|
158 |
|
|
-- Clock 25 MHz in.
|
159 |
|
|
clk : in std_logic;
|
160 |
|
|
|
161 |
|
|
-- Interface: DM9000A
|
162 |
|
|
-- Connection to the DM9000A chip via IO pins.
|
163 |
|
|
eth_interrupt_in : in std_logic;
|
164 |
|
|
eth_chip_sel_out : out std_logic;
|
165 |
|
|
eth_clk_out : out std_logic;
|
166 |
|
|
eth_cmd_out : out std_logic;
|
167 |
|
|
eth_read_out : out std_logic;
|
168 |
|
|
eth_reset_out : out std_logic;
|
169 |
|
|
eth_write_out : out std_logic;
|
170 |
|
|
eth_data_inout : inout std_logic_vector(15 downto 0);
|
171 |
|
|
|
172 |
|
|
-- Interface: rst_n
|
173 |
|
|
-- Asynchronous reset active-low.
|
174 |
|
|
rst_n : in std_logic;
|
175 |
|
|
|
176 |
|
|
-- There ports are contained in many interfaces
|
177 |
|
|
fatal_error_out : out std_logic;
|
178 |
|
|
link_up_out : out std_logic
|
179 |
|
|
|
180 |
|
|
);
|
181 |
|
|
end component;
|
182 |
|
|
|
183 |
|
|
-- 25 MHz Altera ALTPLL instantiation for Cyclone II FPGA's with input clk of 50 MHz (mul = 1, div = 2)
|
184 |
|
|
component altera_de2_pll_25
|
185 |
|
|
port (
|
186 |
|
|
|
187 |
|
|
-- Interface: clk_in
|
188 |
|
|
-- Input clock (50 MHz, DE2 PIN_N2)
|
189 |
|
|
inclk0 : in std_logic;
|
190 |
|
|
|
191 |
|
|
-- Interface: clk_out
|
192 |
|
|
-- Output clock: input clock divided by 2.
|
193 |
|
|
c0 : out std_logic
|
194 |
|
|
|
195 |
|
|
);
|
196 |
|
|
end component;
|
197 |
|
|
|
198 |
|
|
-- You can write vhdl code after this tag and it is saved through the generator.
|
199 |
|
|
-- ##KACTUS2_BLACK_BOX_DECLARATIONS_BEGIN##
|
200 |
|
|
-- ##KACTUS2_BLACK_BOX_DECLARATIONS_END##
|
201 |
|
|
-- Stop writing your code after this tag.
|
202 |
|
|
|
203 |
|
|
|
204 |
|
|
begin
|
205 |
|
|
|
206 |
|
|
-- You can write vhdl code after this tag and it is saved through the generator.
|
207 |
|
|
-- ##KACTUS2_BLACK_BOX_ASSIGNMENTS_BEGIN##
|
208 |
|
|
-- ##KACTUS2_BLACK_BOX_ASSIGNMENTS_END##
|
209 |
|
|
-- Stop writing your code after this tag.
|
210 |
|
|
|
211 |
|
|
altera_de2_pll_25_1 : altera_de2_pll_25
|
212 |
|
|
port map (
|
213 |
|
|
c0 => altera_de2_pll_25_1_clk_out_to_udp_ip_dm9000a_1_clkCLK,
|
214 |
|
|
inclk0 => clk_in_CLK
|
215 |
|
|
);
|
216 |
|
|
|
217 |
|
|
simple_udp_receiver_example_1 : simple_udp_receiver_example
|
218 |
|
|
port map (
|
219 |
|
|
clk => altera_de2_pll_25_1_clk_out_to_udp_ip_dm9000a_1_clkCLK,
|
220 |
|
|
dest_port_in(15 downto 0) => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxdest_port_out(15 downto 0),
|
221 |
|
|
fatal_error_in => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxfatal_error_out,
|
222 |
|
|
led_out => led_out_gpio_out,
|
223 |
|
|
link_up_in => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxlink_up_out,
|
224 |
|
|
link_up_out => link_up_out_gpio_out,
|
225 |
|
|
new_rx_in => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxnew_rx_out,
|
226 |
|
|
new_tx_out => simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txnew_tx_in,
|
227 |
|
|
no_arp_target_MAC_out(47 downto 0) => simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txno_arp_target_MAC_in(47 downto 0),
|
228 |
|
|
rst_n => rst_n_RESETn,
|
229 |
|
|
rx_data_in(15 downto 0) => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxrx_data_out(15 downto 0),
|
230 |
|
|
rx_data_valid_in => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxrx_data_valid_out,
|
231 |
|
|
rx_erroneous_in => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxrx_erroneous_out,
|
232 |
|
|
rx_error_in => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxrx_error_out,
|
233 |
|
|
rx_len_in(10 downto 0) => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxrx_len_out(10 downto 0),
|
234 |
|
|
rx_re_out => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxrx_re_in,
|
235 |
|
|
source_addr_in(31 downto 0) => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxsource_addr_out(31 downto 0),
|
236 |
|
|
source_port_in(15 downto 0) => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxsource_port_out(15 downto 0),
|
237 |
|
|
source_port_out(15 downto 0) => simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txsource_port_in(15 downto 0),
|
238 |
|
|
target_addr_out(31 downto 0) => simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txtarget_addr_in(31 downto 0),
|
239 |
|
|
target_port_out(15 downto 0) => simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txtarget_port_in(15 downto 0),
|
240 |
|
|
tx_data_out(15 downto 0) => simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txtx_data_in(15 downto 0),
|
241 |
|
|
tx_data_valid_out => simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txtx_data_valid_in,
|
242 |
|
|
tx_len_out(10 downto 0) => simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txtx_len_in(10 downto 0),
|
243 |
|
|
tx_re_in => simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txtx_re_out
|
244 |
|
|
);
|
245 |
|
|
|
246 |
|
|
udp_ip_dm9000a_1 : udp_ip_dm9000a
|
247 |
|
|
port map (
|
248 |
|
|
clk => altera_de2_pll_25_1_clk_out_to_udp_ip_dm9000a_1_clkCLK,
|
249 |
|
|
dest_port_out(15 downto 0) => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxdest_port_out(15 downto 0),
|
250 |
|
|
eth_chip_sel_out => DM9000A_eth_chip_sel_out,
|
251 |
|
|
eth_clk_out => DM9000A_eth_clk_out,
|
252 |
|
|
eth_cmd_out => DM9000A_eth_cmd_out,
|
253 |
|
|
eth_data_inout(15 downto 0) => DM9000A_eth_data_inout(15 downto 0),
|
254 |
|
|
eth_interrupt_in => DM9000A_eth_interrupt_in,
|
255 |
|
|
eth_read_out => DM9000A_eth_read_out,
|
256 |
|
|
eth_reset_out => DM9000A_eth_reset_out,
|
257 |
|
|
eth_write_out => DM9000A_eth_write_out,
|
258 |
|
|
fatal_error_out => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxfatal_error_out,
|
259 |
|
|
link_up_out => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxlink_up_out,
|
260 |
|
|
new_rx_out => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxnew_rx_out,
|
261 |
|
|
new_tx_in => simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txnew_tx_in,
|
262 |
|
|
no_arp_target_MAC_in(47 downto 0) => simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txno_arp_target_MAC_in(47 downto 0),
|
263 |
|
|
rst_n => rst_n_RESETn,
|
264 |
|
|
rx_data_out(15 downto 0) => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxrx_data_out(15 downto 0),
|
265 |
|
|
rx_data_valid_out => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxrx_data_valid_out,
|
266 |
|
|
rx_erroneous_out => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxrx_erroneous_out,
|
267 |
|
|
rx_error_out => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxrx_error_out,
|
268 |
|
|
rx_len_out(10 downto 0) => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxrx_len_out(10 downto 0),
|
269 |
|
|
rx_re_in => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxrx_re_in,
|
270 |
|
|
source_addr_out(31 downto 0) => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxsource_addr_out(31 downto 0),
|
271 |
|
|
source_port_in(15 downto 0) => simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txsource_port_in(15 downto 0),
|
272 |
|
|
source_port_out(15 downto 0) => udp_ip_dm9000a_1_app_rx_to_simple_udp_receiver_example_1_udp_ip_rxsource_port_out(15 downto 0),
|
273 |
|
|
target_addr_in(31 downto 0) => simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txtarget_addr_in(31 downto 0),
|
274 |
|
|
target_port_in(15 downto 0) => simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txtarget_port_in(15 downto 0),
|
275 |
|
|
tx_data_in(15 downto 0) => simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txtx_data_in(15 downto 0),
|
276 |
|
|
tx_data_valid_in => simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txtx_data_valid_in,
|
277 |
|
|
tx_len_in(10 downto 0) => simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txtx_len_in(10 downto 0),
|
278 |
|
|
tx_re_out => simple_udp_receiver_example_1_udp_ip_tx_to_udp_ip_dm9000a_1_app_txtx_re_out
|
279 |
|
|
);
|
280 |
|
|
|
281 |
|
|
end kactusHierarchical;
|
282 |
|
|
|