1 |
2 |
tarookumic |
----------------------------------------------------------------------------
|
2 |
|
|
-- This file is a part of the LEON VHDL model
|
3 |
|
|
-- Copyright (C) 2003 Gaisler Research
|
4 |
|
|
--
|
5 |
|
|
-- This library is free software; you can redistribute it and/or
|
6 |
|
|
-- modify it under the terms of the GNU Lesser General Public
|
7 |
|
|
-- License as published by the Free Software Foundation; either
|
8 |
|
|
-- version 2 of the License, or (at your option) any later version.
|
9 |
|
|
--
|
10 |
|
|
-- See the file COPYING.LGPL for the full details of the license.
|
11 |
|
|
----------------------------------------------------------------------------
|
12 |
|
|
-- Entity: pci_oc
|
13 |
|
|
-- File: pci_oc.vhd
|
14 |
|
|
-- Description: Backend for Opencores PCI_IF
|
15 |
|
|
-- Author: Daniel Hedberg, Gaisler Research
|
16 |
|
|
------------------------------------------------------------------------------
|
17 |
|
|
-- ReadMe.txt
|
18 |
|
|
-- This backend enables access from PCI to AHB and vice-versa. The address
|
19 |
|
|
-- mappings are as follows:
|
20 |
|
|
--
|
21 |
|
|
-- PCI to AHB access
|
22 |
|
|
--
|
23 |
|
|
-- BAR0 (MEM area - 4KB)
|
24 |
|
|
--
|
25 |
|
|
-- 0x000 - 0x0FF PCI conf. space
|
26 |
|
|
-- 0x100 - 0x1F0 Opencores device specific conf. space
|
27 |
|
|
--
|
28 |
|
|
-- BAR1 (MEM area - 1 MB)
|
29 |
|
|
--
|
30 |
|
|
-- PCI AHB
|
31 |
|
|
-- 0x00000 - 0xFFFFC 0x[000]00000 - 0x[000]FFFFC
|
32 |
|
|
--
|
33 |
|
|
-- Values within [default] are configurable in Opencores device specific
|
34 |
|
|
-- conf. space.
|
35 |
|
|
-- EXAMPLE: How to map an access to AHB address 0x4000_1000?
|
36 |
|
|
-- Write 0x4 to P_IMG_CTRL1 reg at 0x110 to enable translation
|
37 |
|
|
-- Write 0x4000_1000 to P_TA1 reg at 0x11C
|
38 |
|
|
-- For further information refer to Opencores specification
|
39 |
|
|
--
|
40 |
|
|
-- AHB to PCI access
|
41 |
|
|
--
|
42 |
|
|
-- AHB PCI
|
43 |
|
|
-- 0xA000_0000 - 0xA000_FFFC 0x0000 - 0xFFFC (I/O access)
|
44 |
|
|
-- 0xA001_0000 - 0xA001_01F0 (Read only) Opencores device specific conf. space
|
45 |
|
|
-- 0xC000_0000 - 0xFFFF_FFFC 0xC000_0000 - 0xFFFF_FFFC (MEM access)
|
46 |
|
|
--
|
47 |
|
|
--
|
48 |
|
|
-- How to configure the verilog core (all.v)
|
49 |
|
|
--
|
50 |
|
|
-- FIFO implementaion: To get an implemention with flip-flops instead of RAMB4
|
51 |
|
|
-- comment the lines marked with "//comment for flip-flops"
|
52 |
|
|
--
|
53 |
|
|
-- To alter default values for how Wishbone addresses are mapped on PCI 16195
|
54 |
|
|
-- edit line 16195 to 16221 and 349 to 357
|
55 |
|
|
--
|
56 |
|
|
-----------------------------------------------------------------------------
|
57 |
|
|
|
58 |
|
|
library ieee;
|
59 |
|
|
use ieee.std_logic_1164.all;
|
60 |
|
|
use work.amba.all;
|
61 |
|
|
use work.ambacomp.all;
|
62 |
|
|
use work.leon_iface.all;
|
63 |
|
|
|
64 |
|
|
entity pci_oc is
|
65 |
|
|
port (
|
66 |
|
|
rst : in std_logic;
|
67 |
|
|
clk : in std_logic;
|
68 |
|
|
pci_clk : in std_logic;
|
69 |
|
|
ahbsi : in ahb_slv_in_type;
|
70 |
|
|
ahbso : out ahb_slv_out_type;
|
71 |
|
|
ahbmi : in ahb_mst_in_type;
|
72 |
|
|
ahbmo : out ahb_mst_out_type;
|
73 |
|
|
apbi : in apb_slv_in_type;
|
74 |
|
|
apbo : out apb_slv_out_type;
|
75 |
|
|
pcio : out pci_out_type;
|
76 |
|
|
pcii : in pci_in_type;
|
77 |
|
|
irq : out std_logic
|
78 |
|
|
);
|
79 |
|
|
end;
|
80 |
|
|
|
81 |
|
|
architecture rtl of pci_oc is
|
82 |
|
|
|
83 |
|
|
type wb_mst_in_type is record
|
84 |
|
|
mdat_i : std_logic_vector(31 downto 0); -- binary data bus
|
85 |
|
|
rty_i : std_logic;
|
86 |
|
|
ack_i : std_logic; -- data available
|
87 |
|
|
end record;
|
88 |
|
|
|
89 |
|
|
type wb_mst_out_type is record
|
90 |
|
|
adr_o : std_logic_vector(31 downto 0); -- address bus (byte)
|
91 |
|
|
mdat_o : std_logic_vector(31 downto 0); -- binary data bus
|
92 |
|
|
we_o : std_logic;
|
93 |
|
|
stb_o : std_logic;
|
94 |
|
|
cab_o : std_logic;
|
95 |
|
|
end record;
|
96 |
|
|
|
97 |
|
|
type wb_slv_in_type is record
|
98 |
|
|
adr_i : std_logic_vector(31 downto 0);
|
99 |
|
|
sdat_i : std_logic_vector(31 downto 0);
|
100 |
|
|
we_i : std_logic;
|
101 |
|
|
stb_i : std_logic;
|
102 |
|
|
end record;
|
103 |
|
|
|
104 |
|
|
type wb_slv_out_type is record
|
105 |
|
|
ack_o : std_logic; -- data available
|
106 |
|
|
rty_o : std_logic;
|
107 |
|
|
sdat_o : std_logic_vector(31 downto 0); -- binary data bus
|
108 |
|
|
end record;
|
109 |
|
|
|
110 |
|
|
type ahbslv_state_type is (idle, strobe, respond, rty, doreturn);
|
111 |
|
|
type ahbmst_state_type is (idle, req, respond);
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
type ahbslv_reg_type is record
|
115 |
|
|
hresp : std_logic_vector(1 downto 0);
|
116 |
|
|
hready : std_logic;
|
117 |
|
|
adr_o : std_logic_vector(31 downto 0);
|
118 |
|
|
hrdata : std_logic_vector(31 downto 0);
|
119 |
|
|
mdat_o : std_logic_vector(31 downto 0);
|
120 |
|
|
mdat_i : std_logic_vector(31 downto 0);
|
121 |
|
|
ack_i : std_logic;
|
122 |
|
|
rty_i : std_logic;
|
123 |
|
|
we_o : std_logic;
|
124 |
|
|
hburst : std_logic_vector(2 downto 0);
|
125 |
|
|
htrans : std_logic_vector(1 downto 0);
|
126 |
|
|
end record;
|
127 |
|
|
|
128 |
|
|
type ahbmst_reg_type is record
|
129 |
|
|
adr_i : std_logic_vector(31 downto 0);
|
130 |
|
|
ack_o : std_logic;
|
131 |
|
|
sdat_i : std_logic_vector(31 downto 0);
|
132 |
|
|
|
133 |
|
|
end record;
|
134 |
|
|
|
135 |
|
|
type wb_reg_type is record
|
136 |
|
|
stb_i : std_logic;
|
137 |
|
|
we_i : std_logic;
|
138 |
|
|
cab_o : std_logic;
|
139 |
|
|
end record;
|
140 |
|
|
|
141 |
|
|
type reg_type is record
|
142 |
|
|
ahbslv_state : ahbslv_state_type;
|
143 |
|
|
ahbmst_state : ahbmst_state_type;
|
144 |
|
|
ahbslv : ahbslv_reg_type;
|
145 |
|
|
ahbmst : ahbmst_reg_type;
|
146 |
|
|
rdata : std_logic_vector(31 downto 0);
|
147 |
|
|
wb : wb_reg_type;
|
148 |
|
|
-- AHB2WBCtrl : std_logic_vector(31 downto 0); --31:29=WB_TA,0=WB_TA enable,
|
149 |
|
|
end record;
|
150 |
|
|
|
151 |
|
|
signal r, rin : reg_type;
|
152 |
|
|
signal highbits : std_logic_vector(31 downto 0);
|
153 |
|
|
signal lowbits : std_logic_vector(31 downto 0);
|
154 |
|
|
signal occlk : std_logic;
|
155 |
|
|
signal ocrst : std_logic;
|
156 |
|
|
|
157 |
|
|
signal cbe_en : std_logic_vector(3 downto 0);
|
158 |
|
|
signal wbmi : wb_mst_in_type;
|
159 |
|
|
signal wbmo : wb_mst_out_type;
|
160 |
|
|
signal wbsi : wb_slv_in_type;
|
161 |
|
|
signal wbso : wb_slv_out_type;
|
162 |
|
|
|
163 |
|
|
signal dmai : ahb_dma_in_type;
|
164 |
|
|
signal dmao : ahb_dma_out_type;
|
165 |
|
|
|
166 |
|
|
|
167 |
|
|
component pci_bridge32
|
168 |
|
|
port (
|
169 |
|
|
PCI_CLK_i : in std_logic;
|
170 |
|
|
PCI_AD_oe_o : out std_logic_vector(31 downto 0);
|
171 |
|
|
PCI_AD_i : in std_logic_vector(31 downto 0);
|
172 |
|
|
PCI_AD_o : out std_logic_vector(31 downto 0);
|
173 |
|
|
PCI_CBE_oe_o : out std_logic_vector(3 downto 0);
|
174 |
|
|
PCI_CBE_i : in std_logic_vector(3 downto 0);
|
175 |
|
|
PCI_CBE_o : out std_logic_vector(3 downto 0);
|
176 |
|
|
PCI_RST_oe_o : out std_logic;
|
177 |
|
|
PCI_RST_i : in std_logic;
|
178 |
|
|
PCI_RST_o : out std_logic;
|
179 |
|
|
PCI_INTA_oe_o : out std_logic;
|
180 |
|
|
PCI_INTA_i : in std_logic;
|
181 |
|
|
PCI_INTA_o : out std_logic;
|
182 |
|
|
PCI_REQ_oe_o : out std_logic;
|
183 |
|
|
PCI_REQ_o : out std_logic;
|
184 |
|
|
PCI_GNT_i: in std_logic;
|
185 |
|
|
PCI_FRAME_oe_o : out std_logic;
|
186 |
|
|
PCI_FRAME_i : in std_logic;
|
187 |
|
|
PCI_FRAME_o : out std_logic;
|
188 |
|
|
PCI_IRDY_oe_o : out std_logic;
|
189 |
|
|
PCI_IRDY_i : in std_logic;
|
190 |
|
|
PCI_IRDY_o : out std_logic;
|
191 |
|
|
PCI_IDSEL_i: in std_logic;
|
192 |
|
|
PCI_DEVSEL_oe_o : out std_logic;
|
193 |
|
|
PCI_DEVSEL_i : in std_logic;
|
194 |
|
|
PCI_DEVSEL_o : out std_logic;
|
195 |
|
|
PCI_TRDY_oe_o : out std_logic;
|
196 |
|
|
PCI_TRDY_i : in std_logic;
|
197 |
|
|
PCI_TRDY_o : out std_logic;
|
198 |
|
|
PCI_STOP_oe_o : out std_logic;
|
199 |
|
|
PCI_STOP_i : in std_logic;
|
200 |
|
|
PCI_STOP_o : out std_logic;
|
201 |
|
|
PCI_PAR_oe_o : out std_logic;
|
202 |
|
|
PCI_PAR_i : in std_logic;
|
203 |
|
|
PCI_PAR_o : out std_logic;
|
204 |
|
|
PCI_PERR_oe_o : out std_logic;
|
205 |
|
|
PCI_PERR_i : in std_logic;
|
206 |
|
|
PCI_PERR_o : out std_logic;
|
207 |
|
|
PCI_SERR_oe_o : out std_logic;
|
208 |
|
|
PCI_SERR_o : out std_logic;
|
209 |
|
|
|
210 |
|
|
WB_CLK_I: in std_logic;
|
211 |
|
|
WB_RST_I: in std_logic;
|
212 |
|
|
WB_RST_O: out std_logic;
|
213 |
|
|
WB_INT_I: in std_logic;
|
214 |
|
|
WB_INT_O: out std_logic;
|
215 |
|
|
|
216 |
|
|
-- WISHBONE slave interface
|
217 |
|
|
WBS_ADR_I: in std_logic_vector(31 downto 0);
|
218 |
|
|
WBS_DAT_I: in std_logic_vector(31 downto 0);
|
219 |
|
|
WBS_DAT_O: out std_logic_vector(31 downto 0);
|
220 |
|
|
WBS_SEL_I: in std_logic_vector(3 downto 0);
|
221 |
|
|
WBS_CYC_I: in std_logic;
|
222 |
|
|
WBS_STB_I: in std_logic;
|
223 |
|
|
WBS_WE_I: in std_logic;
|
224 |
|
|
WBS_CAB_I: in std_logic;
|
225 |
|
|
WBS_ACK_O: out std_logic;
|
226 |
|
|
WBS_RTY_O: out std_logic;
|
227 |
|
|
WBS_ERR_O: out std_logic;
|
228 |
|
|
|
229 |
|
|
-- WISHBONE master interface
|
230 |
|
|
WBM_ADR_O: out std_logic_vector(31 downto 0);
|
231 |
|
|
WBM_DAT_I: in std_logic_vector(31 downto 0);
|
232 |
|
|
WBM_DAT_O: out std_logic_vector(31 downto 0);
|
233 |
|
|
WBM_SEL_O: out std_logic_vector(3 downto 0);
|
234 |
|
|
WBM_CYC_O: out std_logic;
|
235 |
|
|
WBM_STB_O: out std_logic;
|
236 |
|
|
WBM_WE_O: out std_logic;
|
237 |
|
|
WBM_CAB_O: out std_logic;
|
238 |
|
|
WBM_ACK_I: in std_logic;
|
239 |
|
|
WBM_RTY_I: in std_logic;
|
240 |
|
|
WBM_ERR_I: in std_logic
|
241 |
|
|
|
242 |
|
|
);
|
243 |
|
|
end component;
|
244 |
|
|
|
245 |
|
|
begin
|
246 |
|
|
|
247 |
|
|
lowbits <= (others => '0');
|
248 |
|
|
highbits <= (others => '1');
|
249 |
|
|
comb: process (r, ahbsi, wbmi, rst, cbe_en,
|
250 |
|
|
ahbmi, wbsi, dmao)
|
251 |
|
|
variable v : reg_type;
|
252 |
|
|
variable vstb_o, vstart : std_logic;
|
253 |
|
|
variable vprdata : std_logic_vector(31 downto 0);
|
254 |
|
|
-- variable vAHB_TA : std_logic_vector(31 downto 29);
|
255 |
|
|
-- variable vAHB_TA_enable : boolean;
|
256 |
|
|
begin -- process comb
|
257 |
|
|
v := r;
|
258 |
|
|
vstb_o := '0';
|
259 |
|
|
v.ahbslv.hready := '1';
|
260 |
|
|
-- v.wb.cab_o := '0';
|
261 |
|
|
-- vAHB_TA := r.AHB2WBCtrl(31 downto 29);
|
262 |
|
|
-- if r.AHB2WBCtrl(0) = '1' then
|
263 |
|
|
-- vAHB_TA_enable := true;
|
264 |
|
|
-- else
|
265 |
|
|
-- vAHB_TA_enable := false;
|
266 |
|
|
-- end if;
|
267 |
|
|
|
268 |
|
|
case r.ahbslv_state is
|
269 |
|
|
|
270 |
|
|
when idle =>
|
271 |
|
|
v.ahbslv.ack_i := '0';
|
272 |
|
|
-- if not r.ahbslv.hburst = "001" then
|
273 |
|
|
-- v.wb.cab_o := '0';
|
274 |
|
|
-- end if;
|
275 |
|
|
-- v.wb.cab_o := '0';
|
276 |
|
|
v.ahbslv.hburst := ahbsi.hburst;
|
277 |
|
|
v.ahbslv.htrans := ahbsi.htrans;
|
278 |
|
|
if ahbsi.haddr(31 downto 16) = "1010000000000000" then -- 0xA000
|
279 |
|
|
v.ahbslv.adr_o := "0000000000000000" & ahbsi.haddr(15 downto 0);
|
280 |
|
|
else
|
281 |
|
|
v.ahbslv.adr_o := ahbsi.haddr; --0xa0010000-0xfffffffc
|
282 |
|
|
end if;
|
283 |
|
|
if (ahbsi.hsel and ahbsi.hready and ahbsi.htrans(1)) = '1' then
|
284 |
|
|
-- if ahbsi.hsize = "010" then --word
|
285 |
|
|
v.ahbslv.hready := '0';
|
286 |
|
|
v.ahbslv_state := strobe;
|
287 |
|
|
v.ahbslv.we_o := ahbsi.hwrite;
|
288 |
|
|
-- end if; --ahbsi.hsize = word
|
289 |
|
|
end if; --ahbsi.hsel = '1'
|
290 |
|
|
|
291 |
|
|
when strobe =>
|
292 |
|
|
v.ahbslv_state := respond;
|
293 |
|
|
v.ahbslv.mdat_o := ahbsi.hwdata; --write specific
|
294 |
|
|
v.ahbslv.mdat_i := wbmi.mdat_i;
|
295 |
|
|
vstb_o := '1';
|
296 |
|
|
v.ahbslv.ack_i := wbmi.ack_i;
|
297 |
|
|
v.ahbslv.rty_i := wbmi.rty_i;
|
298 |
|
|
v.ahbslv.hready := '0';
|
299 |
|
|
if r.ahbslv.hburst = "001" then
|
300 |
|
|
v.wb.cab_o := '1';
|
301 |
|
|
-- v.ahbslv.hburst := ahbsi.hburst;
|
302 |
|
|
end if;
|
303 |
|
|
|
304 |
|
|
when respond =>
|
305 |
|
|
if r.ahbslv.ack_i = '1' then
|
306 |
|
|
v.ahbslv_state := idle;
|
307 |
|
|
v.ahbslv.hrdata := r.ahbslv.mdat_i; --read specific
|
308 |
|
|
elsif r.ahbslv.rty_i = '1' then
|
309 |
|
|
v.ahbslv_state := rty;
|
310 |
|
|
v.ahbslv.hready := '0';
|
311 |
|
|
v.ahbslv.hresp := hresp_retry;
|
312 |
|
|
else
|
313 |
|
|
vstb_o := '1'; --fix
|
314 |
|
|
v.ahbslv.hready := '0';
|
315 |
|
|
v.ahbslv.mdat_i := wbmi.mdat_i; --read specific
|
316 |
|
|
v.ahbslv.ack_i := wbmi.ack_i;
|
317 |
|
|
v.ahbslv.rty_i := wbmi.rty_i;
|
318 |
|
|
end if;
|
319 |
|
|
if (r.wb.cab_o = '1' and ahbsi.htrans(0) = '0') then
|
320 |
|
|
v.wb.cab_o := '0';
|
321 |
|
|
end if;
|
322 |
|
|
-- if not r.ahbslv.hburst = "001" then
|
323 |
|
|
-- v.wb.cab_o := '0';
|
324 |
|
|
-- end if;
|
325 |
|
|
|
326 |
|
|
when rty =>
|
327 |
|
|
v.ahbslv_state := doreturn;
|
328 |
|
|
|
329 |
|
|
when doreturn =>
|
330 |
|
|
v.ahbslv_state := idle;
|
331 |
|
|
v.ahbslv.hresp := hresp_okay;
|
332 |
|
|
|
333 |
|
|
when others => null;
|
334 |
|
|
end case;
|
335 |
|
|
|
336 |
|
|
----------------------------------------
|
337 |
|
|
----------------------------------------
|
338 |
|
|
|
339 |
|
|
v.wb.stb_i := wbsi.stb_i;
|
340 |
|
|
v.wb.we_i := wbsi.we_i;
|
341 |
|
|
|
342 |
|
|
v.ahbmst.adr_i := wbsi.adr_i(31 downto 0);
|
343 |
|
|
v.ahbmst.sdat_i := wbsi.sdat_i;
|
344 |
|
|
v.rdata := dmao.rdata;
|
345 |
|
|
vstart := '0';
|
346 |
|
|
v.ahbmst.ack_o := '0';
|
347 |
|
|
case r.ahbmst_state is
|
348 |
|
|
|
349 |
|
|
when idle =>
|
350 |
|
|
if r.wb.stb_i = '1' then
|
351 |
|
|
v.ahbmst_state := req;
|
352 |
|
|
end if;
|
353 |
|
|
|
354 |
|
|
when req =>
|
355 |
|
|
if dmao.active = '1' and dmao.ready = '1' then
|
356 |
|
|
v.ahbmst.ack_o := '1';
|
357 |
|
|
v.ahbmst_state := respond;
|
358 |
|
|
else
|
359 |
|
|
vstart := '1';
|
360 |
|
|
end if;
|
361 |
|
|
|
362 |
|
|
when respond =>
|
363 |
|
|
v.ahbmst_state := idle;
|
364 |
|
|
|
365 |
|
|
when others => null;
|
366 |
|
|
end case;
|
367 |
|
|
|
368 |
|
|
-------------------------------------------------------------------------------
|
369 |
|
|
-------------------------------------------------------------------------------
|
370 |
|
|
|
371 |
|
|
-- if apbi.psel = '1' then
|
372 |
|
|
-- if apbi.pwrite = '1' then
|
373 |
|
|
-- case apbi.paddr(7 downto 0) is
|
374 |
|
|
-- when "00000000" =>
|
375 |
|
|
-- v.AHB2WBCtrl := apbi.pwdata;
|
376 |
|
|
-- when others => Null;
|
377 |
|
|
-- end case;
|
378 |
|
|
|
379 |
|
|
-- else
|
380 |
|
|
-- case apbi.paddr(3 downto 0) is
|
381 |
|
|
-- when "0000" =>
|
382 |
|
|
-- vprdata := r.AHB2WBCtrl;
|
383 |
|
|
-- when others => Null;
|
384 |
|
|
-- end case;
|
385 |
|
|
-- end if;
|
386 |
|
|
|
387 |
|
|
-- end if;
|
388 |
|
|
|
389 |
|
|
|
390 |
|
|
if rst = '0' then
|
391 |
|
|
v.ahbslv_state := idle;
|
392 |
|
|
v.ahbslv.hresp := hresp_okay;
|
393 |
|
|
v.ahbslv.hready := '1';
|
394 |
|
|
v.ahbslv.adr_o := (others => '0');
|
395 |
|
|
v.ahbslv.hrdata := (others => '0');
|
396 |
|
|
v.ahbslv.mdat_o := (others => '0');
|
397 |
|
|
v.ahbslv.mdat_i := (others => '0');
|
398 |
|
|
v.ahbslv.ack_i := '0';
|
399 |
|
|
v.ahbslv.rty_i := '0';
|
400 |
|
|
v.ahbslv.we_o := '0';
|
401 |
|
|
|
402 |
|
|
v.ahbmst_state := idle;
|
403 |
|
|
v.ahbmst.adr_i := (others => '0');
|
404 |
|
|
v.ahbmst.ack_o := '0';
|
405 |
|
|
v.ahbmst.sdat_i := (others => '0');
|
406 |
|
|
v.rdata := (others => '0');
|
407 |
|
|
|
408 |
|
|
-- v.AHB2WBCtrl := (others => '0');
|
409 |
|
|
v.wb.cab_o := '0';
|
410 |
|
|
|
411 |
|
|
end if;
|
412 |
|
|
|
413 |
|
|
wbmo.adr_o <= r.ahbslv.adr_o;
|
414 |
|
|
-- if is_x(v.ahbslv.mdat_o) then
|
415 |
|
|
-- wbmo.mdat_o <= (others => '0');
|
416 |
|
|
-- else
|
417 |
|
|
wbmo.mdat_o <= v.ahbslv.mdat_o;
|
418 |
|
|
-- end if;
|
419 |
|
|
wbmo.we_o <= r.ahbslv.we_o;
|
420 |
|
|
wbmo.stb_o <= vstb_o;
|
421 |
|
|
ahbso.hready <= r.ahbslv.hready;
|
422 |
|
|
ahbso.hresp <= r.ahbslv.hresp;
|
423 |
|
|
wbmo.cab_o <= v.wb.cab_o;
|
424 |
|
|
-- if is_x(v.ahbslv.hrdata) then
|
425 |
|
|
-- ahbso.hrdata <= (others => '0');
|
426 |
|
|
-- else
|
427 |
|
|
ahbso.hrdata <= v.ahbslv.hrdata;
|
428 |
|
|
-- end if;
|
429 |
|
|
ahbso.hsplit <= (others => '0');
|
430 |
|
|
dmai.address <= r.ahbmst.adr_i;
|
431 |
|
|
-- if is_x(r.ahbmst.sdat_i) then
|
432 |
|
|
-- dmai.wdata <= (others => '0');
|
433 |
|
|
-- else
|
434 |
|
|
dmai.wdata <= r.ahbmst.sdat_i;
|
435 |
|
|
-- end if;
|
436 |
|
|
dmai.start <= vstart;
|
437 |
|
|
dmai.burst <= '0';
|
438 |
|
|
dmai.write <= r.wb.we_i;
|
439 |
|
|
dmai.size <= "10";
|
440 |
|
|
wbso.ack_o <= r.ahbmst.ack_o;
|
441 |
|
|
wbso.sdat_o <= r.rdata;
|
442 |
|
|
wbso.rty_o <= '0';
|
443 |
|
|
apbo.prdata <= (others => '0');
|
444 |
|
|
|
445 |
|
|
pcio.pci_cbe3_en_n <= cbe_en(3);
|
446 |
|
|
pcio.pci_cbe2_en_n <= cbe_en(2);
|
447 |
|
|
pcio.pci_cbe1_en_n <= cbe_en(1);
|
448 |
|
|
pcio.pci_cbe0_en_n <= cbe_en(0);
|
449 |
|
|
-- pcio.pci_serr_en_n <= '0';
|
450 |
|
|
pcio.pci_lock_en_n <= '1';
|
451 |
|
|
-- pcio.pci_req_en_n <= '1';
|
452 |
|
|
|
453 |
|
|
ocrst <= not rst;
|
454 |
|
|
irq <= '0';
|
455 |
|
|
|
456 |
|
|
rin <= v;
|
457 |
|
|
end process comb;
|
458 |
|
|
|
459 |
|
|
regs : process(clk)
|
460 |
|
|
begin
|
461 |
|
|
if rising_edge(clk) then
|
462 |
|
|
r <= rin;
|
463 |
|
|
end if;
|
464 |
|
|
end process;
|
465 |
|
|
|
466 |
|
|
ahbmst0 : ahbmst port map (rst, clk, dmai, dmao, ahbmi, ahbmo);
|
467 |
|
|
|
468 |
|
|
oc : pci_bridge32 port map (
|
469 |
|
|
|
470 |
|
|
PCI_CLK_i => pci_clk,
|
471 |
|
|
PCI_AD_oe_o => pcio.pci_aden_n,
|
472 |
|
|
PCI_AD_i => pcii.pci_adin,
|
473 |
|
|
PCI_AD_o => pcio.pci_adout,
|
474 |
|
|
PCI_CBE_oe_o => cbe_en,
|
475 |
|
|
PCI_CBE_i => pcii.pci_cbein_n,
|
476 |
|
|
PCI_CBE_o => pcio.pci_cbeout_n,
|
477 |
|
|
PCI_RST_oe_o => Open, --not host
|
478 |
|
|
PCI_RST_i => pcii.pci_rst_in_n,
|
479 |
|
|
PCI_RST_o => Open, --not host
|
480 |
|
|
PCI_INTA_oe_o => pcio.pci_int_en_n,
|
481 |
|
|
PCI_INTA_i => highbits(0),
|
482 |
|
|
PCI_INTA_o => pcio.pci_int_out_n,
|
483 |
|
|
PCI_REQ_oe_o => pcio.pci_req_en_n,
|
484 |
|
|
PCI_REQ_o => pcio.pci_req_out_n,
|
485 |
|
|
PCI_GNT_i => pcii.pci_gnt_in_n,
|
486 |
|
|
PCI_FRAME_oe_o => pcio.pci_frame_en_n,
|
487 |
|
|
PCI_FRAME_i => pcii.pci_frame_in_n,
|
488 |
|
|
PCI_FRAME_o => pcio.pci_frame_out_n,
|
489 |
|
|
PCI_IRDY_oe_o => pcio.pci_irdy_en_n,
|
490 |
|
|
PCI_IRDY_i => pcii.pci_irdy_in_n,
|
491 |
|
|
PCI_IRDY_o => pcio.pci_irdy_out_n,
|
492 |
|
|
PCI_IDSEL_i => pcii.pci_idsel_in,
|
493 |
|
|
PCI_DEVSEL_oe_o => pcio.pci_devsel_en_n, --FIX
|
494 |
|
|
PCI_DEVSEL_i => pcii.pci_devsel_in_n,
|
495 |
|
|
PCI_DEVSEL_o => pcio.pci_devsel_out_n,
|
496 |
|
|
PCI_TRDY_oe_o => pcio.pci_trdy_en_n, --FIX
|
497 |
|
|
PCI_TRDY_i => pcii.pci_trdy_in_n,
|
498 |
|
|
PCI_TRDY_o => pcio.pci_trdy_out_n,
|
499 |
|
|
PCI_STOP_oe_o => pcio.pci_stop_en_n, --FIX
|
500 |
|
|
PCI_STOP_i => pcii.pci_stop_in_n,
|
501 |
|
|
PCI_STOP_o => pcio.pci_stop_out_n,
|
502 |
|
|
PCI_PAR_oe_o => pcio.pci_par_en_n,
|
503 |
|
|
PCI_PAR_i => pcii.pci_par_in,
|
504 |
|
|
PCI_PAR_o => pcio.pci_par_out,
|
505 |
|
|
PCI_PERR_oe_o => pcio.pci_perr_en_n,
|
506 |
|
|
PCI_PERR_i => pcii.pci_perr_in_n,
|
507 |
|
|
PCI_PERR_o => pcio.pci_perr_out_n,
|
508 |
|
|
PCI_SERR_oe_o => pcio.pci_serr_en_n,
|
509 |
|
|
PCI_SERR_o => pcio.pci_serr_out_n,
|
510 |
|
|
|
511 |
|
|
-- SYSCON Signals
|
512 |
|
|
WB_CLK_I => clk,
|
513 |
|
|
WB_RST_I => ocrst,
|
514 |
|
|
WB_RST_O => Open,
|
515 |
|
|
WB_INT_I => lowbits(0),--negated and propagated to inta_out
|
516 |
|
|
WB_INT_O => Open, --FIX
|
517 |
|
|
|
518 |
|
|
-- WISHBONE slave interface
|
519 |
|
|
WBS_ADR_I => wbmo.adr_o,
|
520 |
|
|
WBS_DAT_I => wbmo.mdat_o,
|
521 |
|
|
WBS_DAT_O => wbmi.mdat_i,
|
522 |
|
|
WBS_SEL_I => highbits(3 downto 0),
|
523 |
|
|
WBS_CYC_I => highbits(0),
|
524 |
|
|
WBS_STB_I => wbmo.stb_o,
|
525 |
|
|
WBS_WE_I => wbmo.we_o,
|
526 |
|
|
WBS_CAB_I => wbmo.cab_o,
|
527 |
|
|
WBS_ACK_O => wbmi.ack_i,
|
528 |
|
|
WBS_RTY_O => wbmi.rty_i,
|
529 |
|
|
WBS_ERR_O => Open,
|
530 |
|
|
|
531 |
|
|
-- WISHBONE master interface
|
532 |
|
|
WBM_ADR_O => wbsi.adr_i,
|
533 |
|
|
WBM_DAT_I => wbso.sdat_o,
|
534 |
|
|
WBM_DAT_O => wbsi.sdat_i,
|
535 |
|
|
WBM_SEL_O => Open,
|
536 |
|
|
WBM_CYC_O => Open,
|
537 |
|
|
WBM_STB_O => wbsi.stb_i,
|
538 |
|
|
WBM_WE_O => wbsi.we_i,
|
539 |
|
|
WBM_CAB_O => Open,
|
540 |
|
|
WBM_ACK_I => wbso.ack_o,
|
541 |
|
|
WBM_RTY_I => wbso.rty_o,
|
542 |
|
|
WBM_ERR_I => lowbits(0)
|
543 |
|
|
);
|
544 |
|
|
|
545 |
|
|
end;
|