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