changes
[raggedstone] / ethernet / source / top.vhd
CommitLineData
27f6f620 1LIBRARY ieee;
2USE ieee.std_logic_1164.ALL;
3
4entity ethernet is
40a1f26c 5PORT(
6 PCI_AD : INOUT std_logic_vector(31 downto 0);
7 PCI_CLOCK : IN std_logic;
8 PCI_IDSEL : IN std_logic;
9 PCI_CBEn : INOUT std_logic_vector (3 downto 0);
10 PCI_FRAMEn : INOUT std_logic;
11 PCI_IRDYn : INOUT std_logic;
12 PCI_RSTn : INOUT std_logic;
13 PCI_DEVSELn : INOUT std_logic;
14 PCI_INTAn : INOUT std_logic;
15 PCI_PERRn : INOUT std_logic;
16 PCI_SERRn : INOUT std_logic;
17 PCI_STOPn : INOUT std_logic;
18 PCI_TRDYn : INOUT std_logic;
19 PCI_PAR : INOUT std_logic;
20 PCI_REQn : OUT std_logic;
21 PCI_GNTn : IN std_logic;
22
23 MTX_CLK_PAD_I : IN std_logic;
24 MTXD_PAD_O : OUT std_logic_vector (3 downto 0);
25 MTXEN_PAD_O : OUT std_logic;
26 MRX_CLK_PAD_I : IN std_logic;
27 MRXD_PAD_I : IN std_logic_vector (3 downto 0);
28 MRXDV_PAD_I : IN std_logic;
29 MRXERR_PAD_I : IN std_logic;
30 MCOLL_PAD_I : IN std_logic;
31 MCRS_PAD_I : IN std_logic;
32 MD_PAD_IO : INOUT std_logic;
27f6f620 33 MDC_PAD_O : OUT std_logic
40a1f26c 34);
27f6f620 35end ethernet;
40a1f26c 36
27f6f620 37architecture ethernet_arch of ethernet is
40a1f26c 38
39COMPONENT eth_top
40PORT(
41 wb_clk_i : IN std_logic;
42 wb_rst_i : IN std_logic;
43 wb_dat_i : IN std_logic_vector(31 downto 0);
44 wb_adr_i : IN std_logic_vector(11 downto 2);
45 wb_sel_i : IN std_logic_vector(3 downto 0);
46 wb_we_i : IN std_logic;
47 wb_cyc_i : IN std_logic;
48 wb_stb_i : IN std_logic;
49 m_wb_dat_i : IN std_logic_vector(31 downto 0);
50 m_wb_ack_i : IN std_logic;
51 m_wb_err_i : IN std_logic;
52 mtx_clk_pad_i : IN std_logic;
53 mrx_clk_pad_i : IN std_logic;
54 mrxd_pad_i : IN std_logic_vector(3 downto 0);
55 mrxdv_pad_i : IN std_logic;
56 mrxerr_pad_i : IN std_logic;
57 mcoll_pad_i : IN std_logic;
58 mcrs_pad_i : IN std_logic;
59 md_pad_i : IN std_logic;
60 wb_dat_o : OUT std_logic_vector(31 downto 0);
61 wb_ack_o : OUT std_logic;
62 wb_err_o : OUT std_logic;
63 m_wb_adr_o : OUT std_logic_vector(31 downto 0);
64 m_wb_sel_o : OUT std_logic_vector(3 downto 0);
65 m_wb_we_o : OUT std_logic;
66 m_wb_dat_o : OUT std_logic_vector(31 downto 0);
67 m_wb_cyc_o : OUT std_logic;
68 m_wb_stb_o : OUT std_logic;
69 mtxd_pad_o : OUT std_logic_vector(3 downto 0);
70 mtxen_pad_o : OUT std_logic;
71 mtxerr_pad_o : OUT std_logic;
72 mdc_pad_o : OUT std_logic;
73 md_pad_o : OUT std_logic;
74 md_padoe_o : OUT std_logic;
75 int_o : OUT std_logic
76 );
77END COMPONENT;
78
79COMPONENT pci_bridge32
80PORT(
81 wb_clk_i : IN std_logic;
82 wb_rst_i : IN std_logic;
83 wb_int_i : IN std_logic;
84 wbs_adr_i : IN std_logic_vector(31 downto 0);
85 wbs_dat_i : IN std_logic_vector(31 downto 0);
86 wbs_sel_i : IN std_logic_vector(3 downto 0);
87 wbs_cyc_i : IN std_logic;
88 wbs_stb_i : IN std_logic;
89 wbs_we_i : IN std_logic;
90 wbs_cti_i : IN std_logic_vector(2 downto 0);
91 wbs_bte_i : IN std_logic_vector(1 downto 0);
92 wbm_dat_i : IN std_logic_vector(31 downto 0);
93 wbm_ack_i : IN std_logic;
94 wbm_rty_i : IN std_logic;
95 wbm_err_i : IN std_logic;
96 pci_clk_i : IN std_logic;
97 pci_rst_i : IN std_logic;
98 pci_inta_i : IN std_logic;
99 pci_gnt_i : IN std_logic;
100 pci_frame_i : IN std_logic;
101 pci_irdy_i : IN std_logic;
102 pci_idsel_i : IN std_logic;
103 pci_devsel_i : IN std_logic;
104 pci_trdy_i : IN std_logic;
105 pci_stop_i : IN std_logic;
106 pci_ad_i : IN std_logic_vector(31 downto 0);
107 pci_cbe_i : IN std_logic_vector(3 downto 0);
108 pci_par_i : IN std_logic;
109 pci_perr_i : IN std_logic;
110 wb_rst_o : OUT std_logic;
111 wb_int_o : OUT std_logic;
112 wbs_dat_o : OUT std_logic_vector(31 downto 0);
113 wbs_ack_o : OUT std_logic;
114 wbs_rty_o : OUT std_logic;
115 wbs_err_o : OUT std_logic;
116 wbm_adr_o : OUT std_logic_vector(31 downto 0);
117 wbm_dat_o : OUT std_logic_vector(31 downto 0);
118 wbm_sel_o : OUT std_logic_vector(3 downto 0);
119 wbm_cyc_o : OUT std_logic;
120 wbm_stb_o : OUT std_logic;
121 wbm_we_o : OUT std_logic;
122 wbm_cti_o : OUT std_logic_vector(2 downto 0);
123 wbm_bte_o : OUT std_logic_vector(1 downto 0);
124 pci_rst_o : OUT std_logic;
125 pci_inta_o : OUT std_logic;
126 pci_rst_oe_o : OUT std_logic;
127 pci_inta_oe_o : OUT std_logic;
128 pci_req_o : OUT std_logic;
129 pci_req_oe_o : OUT std_logic;
130 pci_frame_o : OUT std_logic;
131 pci_frame_oe_o : OUT std_logic;
132 pci_irdy_oe_o : OUT std_logic;
133 pci_devsel_oe_o : OUT std_logic;
134 pci_trdy_oe_o : OUT std_logic;
135 pci_stop_oe_o : OUT std_logic;
136 pci_ad_oe_o : OUT std_logic_vector(31 downto 0);
137 pci_cbe_oe_o : OUT std_logic_vector(3 downto 0);
138 pci_irdy_o : OUT std_logic;
139 pci_devsel_o : OUT std_logic;
140 pci_trdy_o : OUT std_logic;
141 pci_stop_o : OUT std_logic;
142 pci_ad_o : OUT std_logic_vector(31 downto 0);
143 pci_cbe_o : OUT std_logic_vector(3 downto 0);
144 pci_par_o : OUT std_logic;
145 pci_par_oe_o : OUT std_logic;
146 pci_perr_o : OUT std_logic;
147 pci_perr_oe_o : OUT std_logic;
148 pci_serr_o : OUT std_logic;
149 pci_serr_oe_o : OUT std_logic
150 );
151END COMPONENT;
152
153signal pci_rst_o : std_logic;
154signal pci_rst_oe_o : std_logic;
155signal pci_inta_o : std_logic;
156signal pci_inta_oe_o : std_logic;
157signal pci_req_o : std_logic;
158signal pci_req_oe_o : std_logic;
159signal pci_frame_o : std_logic;
160signal pci_frame_oe_o : std_logic;
161signal pci_irdy_o : std_logic;
162signal pci_irdy_oe_o : std_logic;
163signal pci_devsel_o : std_logic;
164signal pci_devsel_oe_o : std_logic;
165signal pci_trdy_o : std_logic;
166signal pci_trdy_oe_o : std_logic;
167signal pci_stop_o : std_logic;
168signal pci_stop_oe_o : std_logic;
169signal pci_par_o : std_logic;
170signal pci_par_oe_o : std_logic;
171signal pci_perr_o : std_logic;
172signal pci_perr_oe_o : std_logic;
173signal pci_serr_o : std_logic;
174signal pci_serr_oe_o : std_logic;
27f6f620 175signal pci_ad_oe_o : std_logic_vector(31 downto 0);
176signal pci_cbe_oe_o : std_logic_vector(3 downto 0);
40a1f26c 177signal pci_ad_o : std_logic_vector (31 downto 0);
178signal pci_cbe_o : std_logic_vector (3 downto 0);
179
27f6f620 180signal wb_clk_i : std_logic;
181signal wb_rst_i : std_logic;
182signal wb_dat_i : std_logic_vector (31 downto 0);
183signal wb_dat_o : std_logic_vector (31 downto 0);
184signal wb_adr_i : std_logic_vector (11 downto 2);
185signal wb_sel_i : std_logic_vector (3 downto 0);
186signal wb_we_i : std_logic;
187signal wb_cyc_i : std_logic;
188signal wb_stb_i : std_logic;
189signal wb_ack_o : std_logic;
190signal wb_err_o : std_logic;
191signal m_wb_adr_o : std_logic_vector(31 downto 0);
192signal m_wb_sel_o : std_logic_vector(3 downto 0);
193signal m_wb_we_o : std_logic;
194signal m_wb_dat_o : std_logic_vector(31 downto 0);
195signal m_wb_dat_i : std_logic_vector(31 downto 0);
196signal m_wb_cyc_o : std_logic;
197signal m_wb_stb_o : std_logic;
198signal m_wb_ack_i : std_logic;
199signal m_wb_err_i : std_logic;
200signal md_pad_o : std_logic;
201signal md_padoe_o : std_logic;
202signal int_o : std_logic;
203signal wbm_adr_o : std_logic_vector(31 downto 0);
204
40a1f26c 205BEGIN
206
2268f768 207PCI_RSTn <= not pci_rst_o when (pci_rst_oe_o = '1') else 'Z';
208PCI_INTAn <= not pci_inta_o when (pci_inta_oe_o = '1') else 'Z';
209PCI_REQn <= not pci_req_o when (pci_req_oe_o = '1') else 'Z';
210PCI_FRAMEn <= not pci_frame_o when (pci_frame_oe_o = '1') else 'Z';
211PCI_IRDYn <= not pci_irdy_o when (pci_irdy_oe_o = '1') else 'Z';
212PCI_DEVSELn <= not pci_devsel_o when (pci_devsel_oe_o = '1') else 'Z';
213PCI_TRDYn <= not pci_trdy_o when (pci_trdy_oe_o = '1') else 'Z';
214PCI_STOPn <= not pci_stop_o when (pci_stop_oe_o = '1') else 'Z';
27f6f620 215PCI_PAR <= pci_par_o when (pci_par_oe_o = '1') else 'Z';
2268f768 216PCI_PERRn <= not pci_perr_o when (pci_perr_oe_o = '1') else 'Z';
217PCI_SERRn <= not pci_serr_o when (pci_serr_oe_o = '1') else 'Z';
27f6f620 218MD_PAD_IO <= md_pad_o when (md_padoe_o = '1') else 'Z';
219
220BLA1: FOR i in 31 downto 0 generate
221PCI_AD(i) <= pci_ad_o(i) when (pci_ad_oe_o(i) = '1') else 'Z';
222end generate;
223
224BLA2: FOR i in 3 downto 0 generate
225PCI_CBEn(i) <= pci_cbe_o(i) when (pci_cbe_oe_o(i) = '1') else 'Z';
226end generate;
227
228wb_adr_i <= wbm_adr_o (11 downto 2);
40a1f26c 229
230Inst_pci_bridge32: pci_bridge32 PORT MAP(
27f6f620 231 wb_clk_i => wb_clk_i ,
232 wb_rst_i => '0',
233 wb_rst_o => wb_rst_i,
234 wb_int_i => int_o,
235 -- wb_int_o => ,
236 wbs_adr_i => m_wb_adr_o ,
237 wbs_dat_i => m_wb_dat_o,
238 wbs_dat_o => m_wb_dat_i,
239 wbs_sel_i => m_wb_sel_o,
240 wbs_cyc_i => m_wb_cyc_o,
241 wbs_stb_i => m_wb_stb_o,
242 wbs_we_i => m_wb_we_o,
243 wbs_cti_i => (others => '0'),
244 wbs_bte_i => (others => '0'),
245 wbs_ack_o => m_wb_ack_i,
246 -- wbs_rty_o => ,
247 wbs_err_o => m_wb_err_i,
248 wbm_adr_o => wbm_adr_o,
249 wbm_dat_i => wb_dat_o,
250 wbm_dat_o => wb_dat_i,
251 wbm_sel_o => wb_sel_i,
252 wbm_cyc_o => wb_cyc_i,
253 wbm_stb_o => wb_stb_i,
254 wbm_we_o => wb_we_i,
255 -- wbm_cti_o => ,
256 -- wbm_bte_o => ,
257 wbm_ack_i => wb_ack_o ,
258 wbm_rty_i => '0',
259 wbm_err_i => wb_err_o,
40a1f26c 260 pci_clk_i => PCI_CLOCK,
2268f768 261 pci_rst_i => not PCI_RSTn,
40a1f26c 262 pci_rst_o => pci_rst_o ,
263 pci_rst_oe_o => pci_rst_oe_o,
2268f768 264 pci_inta_i => not PCI_INTAn,
40a1f26c 265 pci_inta_o => pci_inta_o,
266 pci_inta_oe_o => pci_inta_oe_o,
267 pci_req_o => pci_req_o,
268 pci_req_oe_o => pci_req_oe_o,
2268f768 269 pci_gnt_i => not PCI_GNTn,
270 pci_frame_i => not PCI_FRAMEn,
40a1f26c 271 pci_frame_o => pci_frame_o,
272 pci_frame_oe_o => pci_frame_oe_o,
273 pci_irdy_oe_o => pci_irdy_oe_o,
274 pci_devsel_oe_o => pci_devsel_oe_o,
275 pci_trdy_oe_o => pci_trdy_oe_o,
276 pci_stop_oe_o => pci_stop_oe_o,
277 pci_ad_oe_o => pci_ad_oe_o,
278 pci_cbe_oe_o => pci_cbe_oe_o,
2268f768 279 pci_irdy_i => not PCI_IRDYn,
40a1f26c 280 pci_irdy_o => pci_irdy_o,
281 pci_idsel_i => PCI_IDSEL,
2268f768 282 pci_devsel_i => not PCI_DEVSELn,
40a1f26c 283 pci_devsel_o => pci_devsel_o,
2268f768 284 pci_trdy_i => not PCI_TRDYn,
40a1f26c 285 pci_trdy_o => pci_trdy_o,
2268f768 286 pci_stop_i => not PCI_STOPn,
40a1f26c 287 pci_stop_o => pci_stop_o,
288 pci_ad_i => PCI_AD,
289 pci_ad_o => pci_ad_o,
2268f768 290 pci_cbe_i => not PCI_CBEn,
40a1f26c 291 pci_cbe_o => pci_cbe_o,
292 pci_par_i => PCI_PAR,
293 pci_par_o => pci_par_o,
294 pci_par_oe_o => pci_par_oe_o,
2268f768 295 pci_perr_i => not PCI_PERRn,
40a1f26c 296 pci_perr_o => pci_perr_o,
297 pci_perr_oe_o => pci_perr_oe_o,
298 pci_serr_o => pci_serr_o,
299 pci_serr_oe_o => pci_serr_oe_o
300);
301
302Inst_eth_top: eth_top PORT MAP(
27f6f620 303 wb_clk_i => wb_clk_i ,
304 wb_rst_i => wb_rst_i ,
305 wb_dat_i => wb_dat_i ,
306 wb_dat_o => wb_dat_o ,
307 wb_adr_i => wb_adr_i ,
308 wb_sel_i => wb_sel_i ,
309 wb_we_i => wb_we_i ,
310 wb_cyc_i => wb_cyc_i ,
311 wb_stb_i => wb_stb_i ,
312 wb_ack_o => wb_ack_o ,
313 wb_err_o => wb_err_o ,
314 m_wb_adr_o => m_wb_adr_o,
315 m_wb_sel_o => m_wb_sel_o,
316 m_wb_we_o => m_wb_we_o ,
317 m_wb_dat_o => m_wb_dat_o,
318 m_wb_dat_i => m_wb_dat_i,
319 m_wb_cyc_o => m_wb_cyc_o,
320 m_wb_stb_o => m_wb_stb_o,
321 m_wb_ack_i => m_wb_ack_i,
322 m_wb_err_i => m_wb_err_i,
323 mtx_clk_pad_i => MTX_CLK_PAD_I,
324 mtxd_pad_o => MTXD_PAD_O,
325 mtxen_pad_o => MTXEN_PAD_O,
326 -- mtxerr_pad_o => ,
327 mrx_clk_pad_i => MRX_CLK_PAD_I,
328 mrxd_pad_i => MRXD_PAD_I,
329 mrxdv_pad_i => MRXDV_PAD_I,
330 mrxerr_pad_i => MRXERR_PAD_I,
331 mcoll_pad_i => MCOLL_PAD_I,
332 mcrs_pad_i => MCRS_PAD_I,
333 mdc_pad_o => MDC_PAD_O,
334 md_pad_i => MD_PAD_IO,
335 md_pad_o => md_pad_o,
336 md_padoe_o => md_padoe_o,
337 int_o => int_o
40a1f26c 338);
339
27f6f620 340end architecture ethernet_arch;
Impressum, Datenschutz