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: pci_dma
|
20 |
|
|
-- File: pci_dma.vhd
|
21 |
|
|
-- Author: Jiri Gaisler - Gaisler Research
|
22 |
|
|
-- Modified: Alf Vaerneus - Gaisler Research
|
23 |
|
|
-- Description: PCI master and target interface with DMA
|
24 |
|
|
------------------------------------------------------------------------------
|
25 |
|
|
|
26 |
|
|
library ieee;
|
27 |
|
|
use ieee.std_logic_1164.all;
|
28 |
|
|
library grlib;
|
29 |
|
|
use grlib.amba.all;
|
30 |
|
|
use grlib.stdlib.all;
|
31 |
|
|
use grlib.devices.all;
|
32 |
|
|
library techmap;
|
33 |
|
|
use techmap.gencomp.all;
|
34 |
|
|
library gaisler;
|
35 |
|
|
use gaisler.pci.all;
|
36 |
|
|
use gaisler.pcilib.all;
|
37 |
|
|
|
38 |
|
|
entity pcidma is
|
39 |
|
|
generic (
|
40 |
|
|
memtech : integer := DEFMEMTECH;
|
41 |
|
|
dmstndx : integer := 0;
|
42 |
|
|
dapbndx : integer := 0;
|
43 |
|
|
dapbaddr : integer := 0;
|
44 |
|
|
dapbmask : integer := 16#fff#;
|
45 |
|
|
blength : integer := 16;
|
46 |
|
|
mstndx : integer := 0;
|
47 |
|
|
abits : integer := 21;
|
48 |
|
|
dmaabits : integer := 26;
|
49 |
|
|
fifodepth : integer := 3; -- FIFO depth
|
50 |
|
|
device_id : integer := 0; -- PCI device ID
|
51 |
|
|
vendor_id : integer := 0; -- PCI vendor ID
|
52 |
|
|
slvndx : integer := 0;
|
53 |
|
|
apbndx : integer := 0;
|
54 |
|
|
apbaddr : integer := 0;
|
55 |
|
|
apbmask : integer := 16#fff#;
|
56 |
|
|
haddr : integer := 16#F00#;
|
57 |
|
|
hmask : integer := 16#F00#;
|
58 |
|
|
ioaddr : integer := 16#000#;
|
59 |
|
|
nsync : integer range 1 to 2 := 2; -- 1 or 2 sync regs between clocks
|
60 |
|
|
oepol : integer := 0;
|
61 |
|
|
endian : integer := 0; -- 0 little, 1 big
|
62 |
|
|
class_code: integer := 16#0B4000#;
|
63 |
|
|
rev : integer := 0;
|
64 |
|
|
irq : integer := 0;
|
65 |
|
|
irqmask : integer := 0;
|
66 |
|
|
scanen : integer := 0;
|
67 |
|
|
hostrst : integer := 0
|
68 |
|
|
);
|
69 |
|
|
port(
|
70 |
|
|
rst : in std_logic;
|
71 |
|
|
clk : in std_logic;
|
72 |
|
|
pciclk : in std_logic;
|
73 |
|
|
pcii : in pci_in_type;
|
74 |
|
|
pcio : out pci_out_type;
|
75 |
|
|
dapbo : out apb_slv_out_type;
|
76 |
|
|
dahbmo : out ahb_mst_out_type;
|
77 |
|
|
apbi : in apb_slv_in_type;
|
78 |
|
|
apbo : out apb_slv_out_type;
|
79 |
|
|
ahbmi : in ahb_mst_in_type;
|
80 |
|
|
ahbmo : out ahb_mst_out_type;
|
81 |
|
|
ahbsi : in ahb_slv_in_type;
|
82 |
|
|
ahbso : out ahb_slv_out_type
|
83 |
|
|
);
|
84 |
|
|
end;
|
85 |
|
|
|
86 |
|
|
architecture rtl of pcidma is
|
87 |
|
|
signal ahbsi2 : ahb_slv_in_type;
|
88 |
|
|
signal ahbso2 : ahb_slv_out_type;
|
89 |
|
|
|
90 |
|
|
begin
|
91 |
|
|
dma : dmactrl generic map (hindex => dmstndx, slvindex => slvndx, pindex => dapbndx,
|
92 |
|
|
paddr => dapbaddr, blength => blength)
|
93 |
|
|
port map (rst, clk, apbi, dapbo, ahbmi, dahbmo, ahbsi, ahbso, ahbsi2, ahbso2);
|
94 |
|
|
|
95 |
|
|
pci : pci_mtf generic map (memtech => memtech, hmstndx => mstndx, dmamst => dmstndx,
|
96 |
|
|
fifodepth => fifodepth, device_id => device_id, vendor_id => vendor_id,
|
97 |
|
|
hslvndx => slvndx, pindex => apbndx, paddr => apbaddr, irq => irq, irqmask => irqmask,
|
98 |
|
|
haddr => haddr, hmask => hmask, ioaddr => ioaddr, abits => abits,
|
99 |
|
|
dmaabits => dmaabits, nsync => nsync, oepol => oepol, endian => endian,
|
100 |
|
|
class_code => class_code, rev => rev, scanen => scanen, hostrst => hostrst)
|
101 |
|
|
port map (rst, clk, pciclk, pcii, pcio, apbi, apbo, ahbmi, ahbmo, ahbsi2, ahbso2);
|
102 |
|
|
end;
|
103 |
|
|
|