1 |
2 |
dimamali |
------------------------------------------------------------------------------
|
2 |
|
|
-- This file is a part of the GRLIB VHDL IP LIBRARY
|
3 |
|
|
-- Copyright (C) 2003, Gaisler Research
|
4 |
|
|
--
|
5 |
|
|
-- This program is free software; you can redistribute it and/or modify
|
6 |
|
|
-- it under the terms of the GNU General Public License as published by
|
7 |
|
|
-- the Free Software Foundation; either version 2 of the License, or
|
8 |
|
|
-- (at your option) any later version.
|
9 |
|
|
--
|
10 |
|
|
-- This program is distributed in the hope that it will be useful,
|
11 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
|
|
-- GNU General Public License for more details.
|
14 |
|
|
--
|
15 |
|
|
-- You should have received a copy of the GNU General Public License
|
16 |
|
|
-- along with this program; if not, write to the Free Software
|
17 |
|
|
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
18 |
|
|
-----------------------------------------------------------------------------
|
19 |
|
|
-- Entity: atactrl
|
20 |
|
|
-- File: atactrl.vhd
|
21 |
|
|
-- Author: Nils-Johan Wessman, Gaisler Research
|
22 |
|
|
-- Description: ATA controller
|
23 |
|
|
------------------------------------------------------------------------------
|
24 |
|
|
|
25 |
|
|
library ieee;
|
26 |
|
|
use ieee.std_logic_1164.all;
|
27 |
|
|
use ieee.numeric_std.all;
|
28 |
|
|
library grlib;
|
29 |
|
|
use grlib.stdlib.all;
|
30 |
|
|
use grlib.amba.all;
|
31 |
|
|
use grlib.devices.all;
|
32 |
|
|
library gaisler;
|
33 |
|
|
use gaisler.memctrl.all;
|
34 |
|
|
use gaisler.ata.all;
|
35 |
|
|
use gaisler.misc.all; --2007-1-16
|
36 |
|
|
use gaisler.ata_inf.all;
|
37 |
|
|
library opencores;
|
38 |
|
|
use opencores.occomp.all;
|
39 |
|
|
|
40 |
|
|
entity atactrl_dma is
|
41 |
|
|
generic (
|
42 |
|
|
tech : integer := 0;
|
43 |
|
|
fdepth : integer := 8;
|
44 |
|
|
mhindex : integer := 0;
|
45 |
|
|
hindex : integer := 0;
|
46 |
|
|
haddr : integer := 0;
|
47 |
|
|
hmask : integer := 16#ff0#;
|
48 |
|
|
pirq : integer := 0;
|
49 |
|
|
|
50 |
|
|
TWIDTH : natural := 8; -- counter width
|
51 |
|
|
|
52 |
|
|
-- PIO mode 0 settings (@100MHz clock)
|
53 |
|
|
PIO_mode0_T1 : natural := 6; -- 70ns
|
54 |
|
|
PIO_mode0_T2 : natural := 28; -- 290ns
|
55 |
|
|
PIO_mode0_T4 : natural := 2; -- 30ns
|
56 |
|
|
PIO_mode0_Teoc : natural := 23 -- 240ns ==> T0 - T1 - T2 = 600 - 70 - 290 = 240
|
57 |
|
|
|
58 |
|
|
);
|
59 |
|
|
port (
|
60 |
|
|
rst : in std_ulogic;
|
61 |
|
|
arst : in std_ulogic;
|
62 |
|
|
clk : in std_ulogic;
|
63 |
|
|
ahbsi : in ahb_slv_in_type;
|
64 |
|
|
ahbso : out ahb_slv_out_type;
|
65 |
|
|
ahbmi : in ahb_mst_in_type;
|
66 |
|
|
ahbmo : out ahb_mst_out_type;
|
67 |
|
|
cfo : out cf_out_type;
|
68 |
|
|
|
69 |
|
|
-- ATA signals
|
70 |
|
|
ddin : in std_logic_vector(15 downto 0);
|
71 |
|
|
iordy : in std_logic;
|
72 |
|
|
intrq : in std_logic;
|
73 |
|
|
ata_resetn : out std_logic;
|
74 |
|
|
ddout : out std_logic_vector(15 downto 0);
|
75 |
|
|
ddoe : out std_logic;
|
76 |
|
|
da : out std_logic_vector(2 downto 0);
|
77 |
|
|
cs0n : out std_logic;
|
78 |
|
|
cs1n : out std_logic;
|
79 |
|
|
diorn : out std_logic;
|
80 |
|
|
diown : out std_logic;
|
81 |
|
|
dmack : out std_logic;
|
82 |
|
|
dmarq : in std_logic
|
83 |
|
|
);
|
84 |
|
|
end;
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
architecture rtl of atactrl_dma is
|
88 |
|
|
-- Device ID
|
89 |
|
|
constant DeviceId : integer := 2;
|
90 |
|
|
constant RevisionNo : integer := 0;
|
91 |
|
|
constant VERSION : integer := 0;
|
92 |
|
|
|
93 |
|
|
component atahost_amba_slave is
|
94 |
|
|
generic (
|
95 |
|
|
hindex : integer := 0;
|
96 |
|
|
haddr : integer := 0;
|
97 |
|
|
hmask : integer := 16#ff0#;
|
98 |
|
|
pirq : integer := 0;
|
99 |
|
|
DeviceID : integer := 0;
|
100 |
|
|
RevisionNo : integer := 0;
|
101 |
|
|
|
102 |
|
|
-- PIO mode 0 settings (@100MHz clock)
|
103 |
|
|
PIO_mode0_T1 : natural := 6; -- 70ns
|
104 |
|
|
PIO_mode0_T2 : natural := 28; -- 290ns
|
105 |
|
|
PIO_mode0_T4 : natural := 2; -- 30ns
|
106 |
|
|
PIO_mode0_Teoc : natural := 23; -- 240ns ==> T0 - T1 - T2 = 600 - 70 - 290 = 240
|
107 |
|
|
|
108 |
|
|
-- Multiword DMA mode 0 settings (@100MHz clock)
|
109 |
|
|
DMA_mode0_Tm : natural := 4; -- 50ns
|
110 |
|
|
DMA_mode0_Td : natural := 21; -- 215ns
|
111 |
|
|
DMA_mode0_Teoc : natural := 21 -- 215ns ==> T0 - Td - Tm = 480 - 50 - 215 = 215
|
112 |
|
|
);
|
113 |
|
|
port (
|
114 |
|
|
rst : in std_ulogic;
|
115 |
|
|
arst : in std_ulogic;
|
116 |
|
|
clk : in std_ulogic;
|
117 |
|
|
ahbsi : in ahb_slv_in_type;
|
118 |
|
|
ahbso : out ahb_slv_out_type;
|
119 |
|
|
cf_power: out std_logic;
|
120 |
|
|
|
121 |
|
|
-- ata controller signals
|
122 |
|
|
|
123 |
|
|
-- PIO control input
|
124 |
|
|
PIOsel : out std_logic;
|
125 |
|
|
PIOtip, -- PIO transfer in progress
|
126 |
|
|
PIOack : in std_logic; -- PIO acknowledge signal
|
127 |
|
|
PIOq : in std_logic_vector(15 downto 0); -- PIO data input
|
128 |
|
|
PIOpp_full : in std_logic; -- PIO write-ping-pong buffers full
|
129 |
|
|
irq : in std_logic; -- interrupt signal input
|
130 |
|
|
PIOa : out std_logic_vector(3 downto 0);
|
131 |
|
|
PIOd : out std_logic_vector(15 downto 0);
|
132 |
|
|
PIOwe : out std_logic;
|
133 |
|
|
|
134 |
|
|
-- DMA control inputs
|
135 |
|
|
-- DMAsel : out std_logic;
|
136 |
|
|
DMAtip, -- DMA transfer in progress
|
137 |
|
|
-- DMAack, -- DMA transfer acknowledge
|
138 |
|
|
DMARxEmpty, -- DMA receive buffer empty
|
139 |
|
|
DMATxFull, -- DMA transmit buffer full
|
140 |
|
|
DMA_dmarq : in std_logic; -- wishbone DMA request
|
141 |
|
|
-- DMAq : in std_logic_vector(31 downto 0);
|
142 |
|
|
|
143 |
|
|
-- outputs
|
144 |
|
|
-- control register outputs
|
145 |
|
|
IDEctrl_rst,
|
146 |
|
|
IDEctrl_IDEen,
|
147 |
|
|
IDEctrl_FATR1,
|
148 |
|
|
IDEctrl_FATR0,
|
149 |
|
|
IDEctrl_ppen,
|
150 |
|
|
DMActrl_DMAen,
|
151 |
|
|
DMActrl_dir,
|
152 |
|
|
DMActrl_Bytesw, --Jagre 2006-12-04
|
153 |
|
|
DMActrl_BeLeC0,
|
154 |
|
|
DMActrl_BeLeC1 : out std_logic;
|
155 |
|
|
|
156 |
|
|
-- CMD port timing registers
|
157 |
|
|
PIO_cmdport_T1,
|
158 |
|
|
PIO_cmdport_T2,
|
159 |
|
|
PIO_cmdport_T4,
|
160 |
|
|
PIO_cmdport_Teoc : out std_logic_vector(7 downto 0);
|
161 |
|
|
PIO_cmdport_IORDYen : out std_logic;
|
162 |
|
|
|
163 |
|
|
-- data-port0 timing registers
|
164 |
|
|
PIO_dport0_T1,
|
165 |
|
|
PIO_dport0_T2,
|
166 |
|
|
PIO_dport0_T4,
|
167 |
|
|
PIO_dport0_Teoc : out std_logic_vector(7 downto 0);
|
168 |
|
|
PIO_dport0_IORDYen : out std_logic;
|
169 |
|
|
|
170 |
|
|
-- data-port1 timing registers
|
171 |
|
|
PIO_dport1_T1,
|
172 |
|
|
PIO_dport1_T2,
|
173 |
|
|
PIO_dport1_T4,
|
174 |
|
|
PIO_dport1_Teoc : out std_logic_vector(7 downto 0);
|
175 |
|
|
PIO_dport1_IORDYen : out std_logic;
|
176 |
|
|
|
177 |
|
|
-- DMA device0 timing registers
|
178 |
|
|
DMA_dev0_Tm,
|
179 |
|
|
DMA_dev0_Td,
|
180 |
|
|
DMA_dev0_Teoc : out std_logic_vector(7 downto 0);
|
181 |
|
|
|
182 |
|
|
-- DMA device1 timing registers
|
183 |
|
|
DMA_dev1_Tm,
|
184 |
|
|
DMA_dev1_Td,
|
185 |
|
|
DMA_dev1_Teoc : out std_logic_vector(7 downto 0);
|
186 |
|
|
|
187 |
|
|
-- Bus master edits by Erik Jagre 2006-10-03 ------------------start-----
|
188 |
|
|
fr_BM : in bm_to_slv_type;
|
189 |
|
|
to_BM : out slv_to_bm_type
|
190 |
|
|
-- Bus master edits by Erik Jagre 2006-10-03 ------------------end-------
|
191 |
|
|
|
192 |
|
|
);
|
193 |
|
|
end component atahost_amba_slave;
|
194 |
|
|
|
195 |
|
|
|
196 |
|
|
component atahost_ahbmst is
|
197 |
|
|
generic(fdepth : integer := 8);
|
198 |
|
|
Port(clk : in std_logic;
|
199 |
|
|
rst : in std_logic;
|
200 |
|
|
i : in bmi_type;
|
201 |
|
|
o : out bmo_type
|
202 |
|
|
);
|
203 |
|
|
end component atahost_ahbmst;
|
204 |
|
|
|
205 |
|
|
-- asynchronous reset signal
|
206 |
|
|
signal arst_signal : std_logic;
|
207 |
|
|
|
208 |
|
|
-- primary address decoder
|
209 |
|
|
-- signal PIOsel,s_bmen : std_logic; -- controller select, IDE devices select
|
210 |
|
|
signal PIOsel : std_logic; -- controller select, IDE devices select
|
211 |
|
|
|
212 |
|
|
-- control signal
|
213 |
|
|
signal IDEctrl_rst, IDEctrl_IDEen, IDEctrl_FATR0, IDEctrl_FATR1 : std_logic;
|
214 |
|
|
-- compatible mode timing
|
215 |
|
|
signal s_PIO_cmdport_T1, s_PIO_cmdport_T2, s_PIO_cmdport_T4, s_PIO_cmdport_Teoc : std_logic_vector(7 downto 0);
|
216 |
|
|
signal s_PIO_cmdport_IORDYen : std_logic;
|
217 |
|
|
-- data port0 timing
|
218 |
|
|
signal s_PIO_dport0_T1, s_PIO_dport0_T2, s_PIO_dport0_T4, s_PIO_dport0_Teoc : std_logic_vector(7 downto 0);
|
219 |
|
|
signal s_PIO_dport0_IORDYen : std_logic;
|
220 |
|
|
-- data port1 timing
|
221 |
|
|
signal s_PIO_dport1_T1, s_PIO_dport1_T2, s_PIO_dport1_T4, s_PIO_dport1_Teoc : std_logic_vector(7 downto 0);
|
222 |
|
|
signal s_PIO_dport1_IORDYen : std_logic;
|
223 |
|
|
|
224 |
|
|
signal PIOack : std_logic;
|
225 |
|
|
signal PIOq : std_logic_vector(15 downto 0);
|
226 |
|
|
signal PIOa : std_logic_vector(3 downto 0):="0000";
|
227 |
|
|
signal PIOd : std_logic_vector(15 downto 0) := X"0000";
|
228 |
|
|
signal PIOwe : std_logic;
|
229 |
|
|
|
230 |
|
|
signal irq : std_logic; -- ATA bus IRQ signal
|
231 |
|
|
|
232 |
|
|
signal reset : std_logic;
|
233 |
|
|
signal gnd,vcc : std_logic;
|
234 |
|
|
signal gnd32 : std_logic_vector(31 downto 0);
|
235 |
|
|
|
236 |
|
|
--**********************SIGNAL DECLARATION*****by Erik Jagre 2006-10-04*******
|
237 |
|
|
signal s_PIOtip : std_logic:='0'; -- PIO transfer in progress
|
238 |
|
|
signal s_PIOpp_full : std_logic:='0'; -- PIO Write PingPong full
|
239 |
|
|
|
240 |
|
|
-- DMA registers
|
241 |
|
|
signal s_DMA_dev0_Td,
|
242 |
|
|
s_DMA_dev0_Tm,
|
243 |
|
|
s_DMA_dev0_Teoc : std_logic_vector(7 downto 0):= X"03"; -- DMA timing settings for device0
|
244 |
|
|
|
245 |
|
|
signal s_DMA_dev1_Td,
|
246 |
|
|
s_DMA_dev1_Tm,
|
247 |
|
|
s_DMA_dev1_Teoc : std_logic_vector(7 downto 0):= X"03"; -- DMA timing settings for device1
|
248 |
|
|
|
249 |
|
|
signal s_DMActrl_DMAen,
|
250 |
|
|
s_DMActrl_dir,
|
251 |
|
|
s_DMActrl_Bytesw,
|
252 |
|
|
s_DMActrl_BeLeC0,
|
253 |
|
|
s_DMActrl_BeLeC1 : std_logic:='0'; -- DMA settings
|
254 |
|
|
|
255 |
|
|
-- signal s_DMAsel : std_logic:='0'; -- DMA controller select
|
256 |
|
|
-- signal s_DMAack : std_logic:='0'; -- DMA controller acknowledge
|
257 |
|
|
-- signal s_DMAq : std_logic_vector(31 downto 0); -- DMA data out
|
258 |
|
|
-- signal s_DMAtip : std_logic:='0'; -- DMA transfer in progress
|
259 |
|
|
signal s_DMA_dmarq : std_logic:='0'; -- Synchronized ATA DMARQ line
|
260 |
|
|
|
261 |
|
|
-- signal s_DMATxFull : std_logic:='0'; -- DMA transmit buffer full
|
262 |
|
|
-- signal s_DMARxEmpty : std_logic:='0'; -- DMA receive buffer empty
|
263 |
|
|
-- signal s_DMA_req : std_logic:='0'; -- DMA request to external DMA engine
|
264 |
|
|
-- signal s_DMA_ack : std_logic:='0'; -- DMA acknowledge from external DMA engine
|
265 |
|
|
|
266 |
|
|
signal s_IDEctrl_ppen : std_logic; --:='0';
|
267 |
|
|
signal datemp : std_logic_vector(2 downto 0):="000";
|
268 |
|
|
|
269 |
|
|
-- signal s_mst_bm : ahb_dma_out_type;
|
270 |
|
|
-- signal s_bm_mst : ahb_dma_in_type;
|
271 |
|
|
|
272 |
|
|
-- signal s_slv_bm : slv_to_bm_type := SLV_TO_BM_RESET_VECTOR;
|
273 |
|
|
-- signal s_bm_slv : bm_to_slv_type := BM_TO_SLV_RESET_VECTOR;
|
274 |
|
|
|
275 |
|
|
-- signal s_bm_ctr : bm_to_ctrl_type;
|
276 |
|
|
-- signal s_ctr_bm : ctrl_to_bm_type;
|
277 |
|
|
|
278 |
|
|
signal s_bmi : bmi_type;
|
279 |
|
|
signal s_bmo : bmo_type;
|
280 |
|
|
|
281 |
|
|
signal s_d : std_logic_vector(31 downto 0);
|
282 |
|
|
signal s_we, s_irq : std_logic;
|
283 |
|
|
|
284 |
|
|
constant DMA_mode0_Tm : natural := 4; -- 50ns
|
285 |
|
|
constant DMA_mode0_Td : natural := 21; -- 215ns
|
286 |
|
|
constant DMA_mode0_Teoc : natural := 21; -- 215ns ==> T0 - Td - Tm = 480 - 50 - 215 = 215
|
287 |
|
|
constant SECTOR_LENGTH : integer := 16;
|
288 |
|
|
|
289 |
|
|
-- signal PIOa_temp : std_logic_vector(7 downto 0);
|
290 |
|
|
--**********************END SIGNAL DECLARATION********************************
|
291 |
|
|
|
292 |
|
|
begin
|
293 |
|
|
gnd <= '0';vcc <= '1'; gnd32 <= zero32;
|
294 |
|
|
-- generate asynchronous reset level
|
295 |
|
|
arst_signal <= arst;-- xor ARST_LVL;
|
296 |
|
|
reset <= not rst;
|
297 |
|
|
da<=datemp;
|
298 |
|
|
--PIOa_temp <= unsigned(PIOa);
|
299 |
|
|
--dmack <= vcc; -- Disable DMA
|
300 |
|
|
-- Generate CompactFlash signals
|
301 |
|
|
--cfo.power connected to bit 31 of the control register
|
302 |
|
|
cfo.atasel <= gnd;
|
303 |
|
|
cfo.we <= vcc;
|
304 |
|
|
cfo.csel <= gnd;
|
305 |
|
|
cfo.da <= (others => gnd);
|
306 |
|
|
|
307 |
|
|
--s_bmi.fr_mst<=s_mst_bm; s_bmi.fr_slv<=s_slv_bm; s_bmi.fr_ctr<=s_ctr_bm;
|
308 |
|
|
--s_bmo.to_mst<=s_bm_mst; s_bmo.to_slv<=s_slv_bm; s_bmo.to_ctr<=s_bm_ctr;
|
309 |
|
|
|
310 |
|
|
|
311 |
|
|
with s_bmi.fr_slv.en select
|
312 |
|
|
s_d(15 downto 0)<=s_bmo.d(15 downto 0) when '1',
|
313 |
|
|
PIOd when others;
|
314 |
|
|
|
315 |
|
|
with s_bmi.fr_slv.en select
|
316 |
|
|
s_d(31 downto 16)<=s_bmo.d(31 downto 16) when '1',
|
317 |
|
|
(others=>'0') when others;
|
318 |
|
|
|
319 |
|
|
with s_bmi.fr_slv.en select
|
320 |
|
|
s_we<=s_bmo.we when '1',
|
321 |
|
|
PIOwe when others;
|
322 |
|
|
|
323 |
|
|
with s_bmi.fr_slv.en select --for guaranteeing coherent memory before irq
|
324 |
|
|
s_irq<=irq and (not s_bmo.to_mst.start) when '1',
|
325 |
|
|
irq when others;
|
326 |
|
|
|
327 |
|
|
s_bmi.fr_ctr.irq<=irq;
|
328 |
|
|
|
329 |
|
|
slv: atahost_amba_slave
|
330 |
|
|
generic map(
|
331 |
|
|
hindex => hindex,
|
332 |
|
|
haddr => haddr,
|
333 |
|
|
hmask => hmask,
|
334 |
|
|
pirq => pirq,
|
335 |
|
|
DeviceID => DeviceID,
|
336 |
|
|
RevisionNo => RevisionNo,
|
337 |
|
|
|
338 |
|
|
-- PIO mode 0 settings
|
339 |
|
|
PIO_mode0_T1 => PIO_mode0_T1,
|
340 |
|
|
PIO_mode0_T2 => PIO_mode0_T2,
|
341 |
|
|
PIO_mode0_T4 => PIO_mode0_T4,
|
342 |
|
|
PIO_mode0_Teoc => PIO_mode0_Teoc,
|
343 |
|
|
|
344 |
|
|
-- Multiword DMA mode 0 settings
|
345 |
|
|
-- OCIDEC-1 does not support DMA, set registers to zero
|
346 |
|
|
DMA_mode0_Tm => 0,
|
347 |
|
|
DMA_mode0_Td => 0,
|
348 |
|
|
DMA_mode0_Teoc => 0
|
349 |
|
|
)
|
350 |
|
|
port map(
|
351 |
|
|
arst => arst_signal,
|
352 |
|
|
rst => rst,
|
353 |
|
|
clk => clk,
|
354 |
|
|
ahbsi => ahbsi,
|
355 |
|
|
ahbso => ahbso,
|
356 |
|
|
|
357 |
|
|
cf_power => cfo.power, -- power switch for compactflash
|
358 |
|
|
|
359 |
|
|
-- PIO control input
|
360 |
|
|
-- PIOtip is only asserted during a PIO transfer (No shit! ;)
|
361 |
|
|
-- Since it is impossible to read the status register and access the PIO registers at the same time
|
362 |
|
|
-- this bit is useless (besides using-up resources)
|
363 |
|
|
PIOtip => gnd,
|
364 |
|
|
PIOack => PIOack,
|
365 |
|
|
PIOq => PIOq,
|
366 |
|
|
PIOsel => PIOsel,
|
367 |
|
|
PIOpp_full => gnd, -- OCIDEC-1 does not support PIO-write PingPong, negate signal
|
368 |
|
|
irq => s_irq,
|
369 |
|
|
PIOa => PIOa,
|
370 |
|
|
PIOd => PIOd,
|
371 |
|
|
PIOwe => PIOwe,
|
372 |
|
|
|
373 |
|
|
-- DMA control inputs (negate all of them)
|
374 |
|
|
DMAtip => s_bmi.fr_ctr.tip, --Erik Jagre 2006-11-13
|
375 |
|
|
-- DMAack => gnd,
|
376 |
|
|
DMARxEmpty => s_bmi.fr_ctr.rx_empty, --Erik Jagre 2006-11-13
|
377 |
|
|
DMATxFull => s_bmi.fr_ctr.fifo_rdy, --Erik Jagre 2006-11-13
|
378 |
|
|
DMA_dmarq => s_DMA_dmarq, --Erik Jagre 2006-11-13
|
379 |
|
|
-- DMAq => gnd32,
|
380 |
|
|
|
381 |
|
|
-- outputs
|
382 |
|
|
-- control register outputs
|
383 |
|
|
IDEctrl_rst => IDEctrl_rst,
|
384 |
|
|
IDEctrl_IDEen => IDEctrl_IDEen,
|
385 |
|
|
IDEctrl_ppen => s_IDEctrl_ppen,
|
386 |
|
|
IDEctrl_FATR0 => IDEctrl_FATR0,
|
387 |
|
|
IDEctrl_FATR1 => IDEctrl_FATR1,
|
388 |
|
|
|
389 |
|
|
-- CMD port timing registers
|
390 |
|
|
PIO_cmdport_T1 => s_PIO_cmdport_T1,
|
391 |
|
|
PIO_cmdport_T2 => s_PIO_cmdport_T2,
|
392 |
|
|
PIO_cmdport_T4 => s_PIO_cmdport_T4,
|
393 |
|
|
PIO_cmdport_Teoc => s_PIO_cmdport_Teoc,
|
394 |
|
|
PIO_cmdport_IORDYen => s_PIO_cmdport_IORDYen,
|
395 |
|
|
|
396 |
|
|
-- data-port0 timing registers
|
397 |
|
|
PIO_dport0_T1 => s_PIO_dport0_T1,
|
398 |
|
|
PIO_dport0_T2 => s_PIO_dport0_T2,
|
399 |
|
|
PIO_dport0_T4 => s_PIO_dport0_T4,
|
400 |
|
|
PIO_dport0_Teoc => s_PIO_dport0_Teoc,
|
401 |
|
|
PIO_dport0_IORDYen => s_PIO_dport0_IORDYen,
|
402 |
|
|
|
403 |
|
|
-- data-port1 timing registers
|
404 |
|
|
PIO_dport1_T1 => s_PIO_dport1_T1,
|
405 |
|
|
PIO_dport1_T2 => s_PIO_dport1_T2,
|
406 |
|
|
PIO_dport1_T4 => s_PIO_dport1_T4,
|
407 |
|
|
PIO_dport1_Teoc => s_PIO_dport1_Teoc,
|
408 |
|
|
PIO_dport1_IORDYen => s_PIO_dport1_IORDYen,
|
409 |
|
|
|
410 |
|
|
-- Bus master edits by Erik Jagre 2006-10-04 ---------------start--
|
411 |
|
|
DMActrl_Bytesw=> s_DMActrl_Bytesw,
|
412 |
|
|
DMActrl_BeLeC0=> s_DMActrl_BeLeC0,
|
413 |
|
|
DMActrl_BeLeC1=> s_DMActrl_BeLeC1,
|
414 |
|
|
|
415 |
|
|
DMActrl_DMAen => s_DMActrl_DMAen,
|
416 |
|
|
DMActrl_dir => s_DMActrl_dir,
|
417 |
|
|
|
418 |
|
|
DMA_dev0_Tm => s_DMA_dev0_Tm,
|
419 |
|
|
DMA_dev0_Td => s_DMA_dev0_Td,
|
420 |
|
|
DMA_dev0_Teoc => s_DMA_dev0_Teoc,
|
421 |
|
|
|
422 |
|
|
DMA_dev1_Tm => s_DMA_dev1_Tm,
|
423 |
|
|
DMA_dev1_Td => s_DMA_dev1_Td,
|
424 |
|
|
DMA_dev1_Teoc => s_DMA_dev1_Teoc,
|
425 |
|
|
|
426 |
|
|
fr_BM =>s_bmo.to_slv,
|
427 |
|
|
to_BM =>s_bmi.fr_slv
|
428 |
|
|
-- Bus master edits by Erik Jagre 2006-10-04 ------------------end-------
|
429 |
|
|
);
|
430 |
|
|
|
431 |
|
|
ctr: atahost_controller
|
432 |
|
|
generic map(
|
433 |
|
|
fdepth => fdepth,
|
434 |
|
|
tech => tech,
|
435 |
|
|
TWIDTH => TWIDTH,
|
436 |
|
|
PIO_mode0_T1 => PIO_mode0_T1,
|
437 |
|
|
PIO_mode0_T2 => PIO_mode0_T2,
|
438 |
|
|
PIO_mode0_T4 => PIO_mode0_T4,
|
439 |
|
|
PIO_mode0_Teoc => PIO_mode0_Teoc,
|
440 |
|
|
DMA_mode0_Tm => DMA_mode0_Tm,
|
441 |
|
|
DMA_mode0_Td => DMA_mode0_Td,
|
442 |
|
|
DMA_mode0_Teoc => DMA_mode0_Teoc
|
443 |
|
|
)
|
444 |
|
|
port map(
|
445 |
|
|
clk => clk,
|
446 |
|
|
nReset => arst_signal,
|
447 |
|
|
rst => reset,
|
448 |
|
|
irq => irq,
|
449 |
|
|
IDEctrl_IDEen => IDEctrl_IDEen,
|
450 |
|
|
IDEctrl_rst => IDEctrl_rst,
|
451 |
|
|
IDEctrl_ppen => s_IDEctrl_ppen,
|
452 |
|
|
IDEctrl_FATR0 => IDEctrl_FATR0,
|
453 |
|
|
IDEctrl_FATR1 => IDEctrl_FATR1,
|
454 |
|
|
a => PIOa,
|
455 |
|
|
d => s_d,
|
456 |
|
|
we => s_we,
|
457 |
|
|
PIO_cmdport_T1 => s_PIO_cmdport_T1,
|
458 |
|
|
PIO_cmdport_T2 => s_PIO_cmdport_T2,
|
459 |
|
|
PIO_cmdport_T4 => s_PIO_cmdport_T4,
|
460 |
|
|
PIO_cmdport_Teoc => s_PIO_cmdport_Teoc,
|
461 |
|
|
PIO_cmdport_IORDYen => s_PIO_cmdport_IORDYen,
|
462 |
|
|
PIO_dport0_T1 => s_PIO_dport0_T1,
|
463 |
|
|
PIO_dport0_T2 => s_PIO_dport0_T2,
|
464 |
|
|
PIO_dport0_T4 => s_PIO_dport0_T4,
|
465 |
|
|
PIO_dport0_Teoc => s_PIO_dport0_Teoc,
|
466 |
|
|
PIO_dport0_IORDYen => s_PIO_dport0_IORDYen,
|
467 |
|
|
PIO_dport1_T1 => s_PIO_dport1_T1,
|
468 |
|
|
PIO_dport1_T2 => s_PIO_dport1_T2,
|
469 |
|
|
PIO_dport1_T4 => s_PIO_dport1_T4,
|
470 |
|
|
PIO_dport1_Teoc => s_PIO_dport1_Teoc,
|
471 |
|
|
PIO_dport1_IORDYen => s_PIO_dport1_IORDYen,
|
472 |
|
|
PIOsel => PIOsel,
|
473 |
|
|
PIOack => PIOack,
|
474 |
|
|
PIOq => PIOq,
|
475 |
|
|
PIOtip => s_PIOtip,
|
476 |
|
|
PIOpp_full => s_PIOpp_full,
|
477 |
|
|
--DMA
|
478 |
|
|
DMActrl_DMAen => s_DMActrl_DMAen,
|
479 |
|
|
DMActrl_dir => s_DMActrl_dir,
|
480 |
|
|
DMActrl_Bytesw => s_DMActrl_Bytesw,
|
481 |
|
|
DMActrl_BeLeC0 => s_DMActrl_BeLeC0,
|
482 |
|
|
DMActrl_BeLeC1 => s_DMActrl_BeLeC1,
|
483 |
|
|
DMA_dev0_Td => s_DMA_dev0_Td,
|
484 |
|
|
DMA_dev0_Tm => s_DMA_dev0_Tm,
|
485 |
|
|
DMA_dev0_Teoc => s_DMA_dev0_Teoc,
|
486 |
|
|
DMA_dev1_Td => s_DMA_dev1_Td,
|
487 |
|
|
DMA_dev1_Tm => s_DMA_dev1_Tm,
|
488 |
|
|
DMA_dev1_Teoc => s_DMA_dev1_Teoc,
|
489 |
|
|
DMAsel => s_bmo.to_ctr.sel,
|
490 |
|
|
DMAack => s_bmi.fr_ctr.ack,
|
491 |
|
|
DMAq => s_bmi.fr_ctr.q,
|
492 |
|
|
DMAtip_out => s_bmi.fr_ctr.tip,
|
493 |
|
|
DMA_dmarq => s_DMA_dmarq,
|
494 |
|
|
force_rdy => s_bmo.to_ctr.force_rdy,
|
495 |
|
|
fifo_rdy => s_bmi.fr_ctr.fifo_rdy,
|
496 |
|
|
DMARxEmpty => s_bmi.fr_ctr.rx_empty,
|
497 |
|
|
DMARxFull => s_bmi.fr_ctr.rx_full,
|
498 |
|
|
DMA_req => s_bmi.fr_ctr.req,
|
499 |
|
|
DMA_ack => s_bmo.to_ctr.ack,
|
500 |
|
|
BM_en => s_bmi.fr_slv.en, -- Bus mater enabled, for DMA reset Erik Jagre 2006-10-24
|
501 |
|
|
--ATA
|
502 |
|
|
RESETn => ata_resetn,
|
503 |
|
|
DDi => ddin,
|
504 |
|
|
DDo => ddout,
|
505 |
|
|
DDoe => ddoe,
|
506 |
|
|
DA => datemp,
|
507 |
|
|
CS0n => cs0n,
|
508 |
|
|
CS1n => cs1n,
|
509 |
|
|
DIORn => diorn,
|
510 |
|
|
DIOWn => diown,
|
511 |
|
|
IORDY => iordy,
|
512 |
|
|
INTRQ => intrq,
|
513 |
|
|
DMARQ => dmarq,
|
514 |
|
|
DMACKn => dmack
|
515 |
|
|
);
|
516 |
|
|
|
517 |
|
|
mst : ahbmst
|
518 |
|
|
generic map(
|
519 |
|
|
hindex => mhindex,
|
520 |
|
|
hirq => 0,
|
521 |
|
|
venid => VENDOR_GAISLER,
|
522 |
|
|
devid => GAISLER_ATACTRL,
|
523 |
|
|
version => 0,
|
524 |
|
|
chprot => 3,
|
525 |
|
|
incaddr => 4)
|
526 |
|
|
port map (
|
527 |
|
|
rst => rst,
|
528 |
|
|
clk => clk,
|
529 |
|
|
dmai => s_bmo.to_mst,
|
530 |
|
|
dmao => s_bmi.fr_mst,
|
531 |
|
|
ahbi => ahbmi,
|
532 |
|
|
ahbo => ahbmo
|
533 |
|
|
);
|
534 |
|
|
|
535 |
|
|
bm : atahost_ahbmst
|
536 |
|
|
generic map(fdepth=>fdepth)
|
537 |
|
|
port map(
|
538 |
|
|
clk => clk,
|
539 |
|
|
rst => rst,
|
540 |
|
|
i => s_bmi,
|
541 |
|
|
o => s_bmo
|
542 |
|
|
);
|
543 |
|
|
|
544 |
|
|
-- pragma translate_off
|
545 |
|
|
bootmsg : report_version
|
546 |
|
|
generic map ("atactrl" & tost(hindex) &
|
547 |
|
|
": ATA controller rev " & tost(VERSION) & ", irq " & tost(pirq));
|
548 |
|
|
-- pragma translate_on
|
549 |
|
|
end;
|
550 |
|
|
|