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: pcipads
|
20 |
|
|
-- File: pcipads.vhd
|
21 |
|
|
-- Author: Jiri Gaisler - Gaisler Research
|
22 |
|
|
-- Description: PCI pads module
|
23 |
|
|
------------------------------------------------------------------------------
|
24 |
|
|
|
25 |
|
|
library ieee;
|
26 |
|
|
use ieee.std_logic_1164.all;
|
27 |
|
|
|
28 |
|
|
library techmap;
|
29 |
|
|
use techmap.gencomp.all;
|
30 |
|
|
use work.pci.all;
|
31 |
|
|
library grlib;
|
32 |
|
|
use grlib.stdlib.all;
|
33 |
|
|
|
34 |
|
|
entity pcipads is
|
35 |
|
|
generic (
|
36 |
|
|
padtech : integer := 0;
|
37 |
|
|
noreset : integer := 0;
|
38 |
|
|
oepol : integer := 0;
|
39 |
|
|
host : integer := 1;
|
40 |
|
|
int : integer := 0;
|
41 |
|
|
no66 : integer := 0
|
42 |
|
|
);
|
43 |
|
|
port (
|
44 |
|
|
pci_rst : inout std_logic;
|
45 |
|
|
pci_gnt : in std_ulogic;
|
46 |
|
|
pci_idsel : in std_ulogic;
|
47 |
|
|
pci_lock : inout std_ulogic;
|
48 |
|
|
pci_ad : inout std_logic_vector(31 downto 0);
|
49 |
|
|
pci_cbe : inout std_logic_vector(3 downto 0);
|
50 |
|
|
pci_frame : inout std_ulogic;
|
51 |
|
|
pci_irdy : inout std_ulogic;
|
52 |
|
|
pci_trdy : inout std_ulogic;
|
53 |
|
|
pci_devsel : inout std_ulogic;
|
54 |
|
|
pci_stop : inout std_ulogic;
|
55 |
|
|
pci_perr : inout std_ulogic;
|
56 |
|
|
pci_par : inout std_ulogic;
|
57 |
|
|
pci_req : inout std_ulogic; -- tristate pad but never read
|
58 |
|
|
pci_serr : inout std_ulogic; -- open drain output
|
59 |
|
|
pci_host : in std_ulogic;
|
60 |
|
|
pci_66 : in std_ulogic;
|
61 |
|
|
pcii : out pci_in_type;
|
62 |
|
|
pcio : in pci_out_type;
|
63 |
|
|
pci_int : inout std_logic_vector(3 downto 0) := conv_std_logic_vector(16#F#, 4) -- Disable int by default
|
64 |
|
|
--pci_int : inout std_logic_vector(3 downto 0) :=
|
65 |
|
|
-- conv_std_logic_vector(16#F# - (16#F# * oepol), 4) -- Disable int by default
|
66 |
|
|
);
|
67 |
|
|
end;
|
68 |
|
|
|
69 |
|
|
architecture rtl of pcipads is
|
70 |
|
|
signal vcc : std_ulogic;
|
71 |
|
|
begin
|
72 |
|
|
|
73 |
|
|
vcc <= '1';
|
74 |
|
|
|
75 |
|
|
-- Reset
|
76 |
|
|
rstpad : if noreset = 0 generate
|
77 |
|
|
pci_rst_pad : iodpad generic map (tech => padtech, level => pci33, oepol => 0)
|
78 |
|
|
port map (pci_rst, pcio.rst, pcii.rst);
|
79 |
|
|
end generate;
|
80 |
|
|
norstpad : if noreset = 1 generate
|
81 |
|
|
pcii.rst <= pci_rst;
|
82 |
|
|
end generate;
|
83 |
|
|
|
84 |
|
|
pad_pci_gnt : inpad generic map (padtech, pci33, 0) port map (pci_gnt, pcii.gnt);
|
85 |
|
|
pad_pci_idsel : inpad generic map (padtech, pci33, 0) port map (pci_idsel, pcii.idsel);
|
86 |
|
|
|
87 |
|
|
dohost : if host = 1 generate
|
88 |
|
|
pad_pci_host : inpad generic map (padtech, pci33, 0) port map (pci_host, pcii.host);
|
89 |
|
|
end generate;
|
90 |
|
|
nohost : if host = 0 generate
|
91 |
|
|
pcii.host <= '1'; -- disable pci host functionality
|
92 |
|
|
end generate;
|
93 |
|
|
|
94 |
|
|
do66 : if no66 = 0 generate
|
95 |
|
|
pad_pci_66 : inpad generic map (padtech, pci33, 0) port map (pci_66, pcii.pci66);
|
96 |
|
|
end generate;
|
97 |
|
|
dono66 : if no66 = 1 generate
|
98 |
|
|
pcii.pci66 <= '0';
|
99 |
|
|
end generate;
|
100 |
|
|
|
101 |
|
|
pad_pci_lock : iopad generic map (tech => padtech, level => pci33, oepol => oepol)
|
102 |
|
|
port map (pci_lock, pcio.lock, pcio.locken, pcii.lock);
|
103 |
|
|
pad_pci_ad : iopadvv generic map (tech => padtech, level => pci33, width => 32,
|
104 |
|
|
oepol => oepol)
|
105 |
|
|
port map (pci_ad, pcio.ad, pcio.vaden, pcii.ad);
|
106 |
|
|
pad_pci_cbe0 : iopad generic map (tech => padtech, level => pci33, oepol => oepol)
|
107 |
|
|
port map (pci_cbe(0), pcio.cbe(0), pcio.cbeen(0), pcii.cbe(0));
|
108 |
|
|
pad_pci_cbe1 : iopad generic map (tech => padtech, level => pci33, oepol => oepol)
|
109 |
|
|
port map (pci_cbe(1), pcio.cbe(1), pcio.cbeen(1), pcii.cbe(1));
|
110 |
|
|
pad_pci_cbe2 : iopad generic map (tech => padtech, level => pci33, oepol => oepol)
|
111 |
|
|
port map (pci_cbe(2), pcio.cbe(2), pcio.cbeen(2), pcii.cbe(2));
|
112 |
|
|
pad_pci_cbe3 : iopad generic map (tech => padtech, level => pci33, oepol => oepol)
|
113 |
|
|
port map (pci_cbe(3), pcio.cbe(3), pcio.cbeen(3), pcii.cbe(3));
|
114 |
|
|
pad_pci_frame : iopad generic map (tech => padtech, level => pci33, oepol => oepol)
|
115 |
|
|
port map (pci_frame, pcio.frame, pcio.frameen, pcii.frame);
|
116 |
|
|
pad_pci_trdy : iopad generic map (tech => padtech, level => pci33, oepol => oepol)
|
117 |
|
|
port map (pci_trdy, pcio.trdy, pcio.trdyen, pcii.trdy);
|
118 |
|
|
pad_pci_irdy : iopad generic map (tech => padtech, level => pci33, oepol => oepol)
|
119 |
|
|
port map (pci_irdy, pcio.irdy, pcio.irdyen, pcii.irdy);
|
120 |
|
|
pad_pci_devsel: iopad generic map (tech => padtech, level => pci33, oepol => oepol)
|
121 |
|
|
port map (pci_devsel, pcio.devsel, pcio.devselen, pcii.devsel);
|
122 |
|
|
pad_pci_stop : iopad generic map (tech => padtech, level => pci33, oepol => oepol)
|
123 |
|
|
port map (pci_stop, pcio.stop, pcio.stopen, pcii.stop);
|
124 |
|
|
pad_pci_perr : iopad generic map (tech => padtech, level => pci33, oepol => oepol)
|
125 |
|
|
port map (pci_perr, pcio.perr, pcio.perren, pcii.perr);
|
126 |
|
|
pad_pci_par : iopad generic map (tech => padtech, level => pci33, oepol => oepol)
|
127 |
|
|
port map (pci_par, pcio.par, pcio.paren, pcii.par);
|
128 |
|
|
pad_pci_req : toutpad generic map (tech => padtech, level => pci33, oepol => oepol)
|
129 |
|
|
port map (pci_req, pcio.req, pcio.reqen);
|
130 |
|
|
pad_pci_serr : iopad generic map (tech => padtech, level => pci33, oepol => oepol)
|
131 |
|
|
port map (pci_serr, pcio.serr, pcio.serren, pcii.serr);
|
132 |
|
|
|
133 |
|
|
-- PCI interrupt pads
|
134 |
|
|
-- int = 0 => no interrupt
|
135 |
|
|
-- int = 1 => PCI_INT[A] = out, PCI_INT[B,C,D] = Not connected
|
136 |
|
|
-- int = 2 => PCI_INT[B] = out, PCI_INT[A,C,D] = Not connected
|
137 |
|
|
-- int = 3 => PCI_INT[C] = out, PCI_INT[A,B,D] = Not connected
|
138 |
|
|
-- int = 4 => PCI_INT[D] = out, PCI_INT[A,B,C] = Not connected
|
139 |
|
|
|
140 |
|
|
-- int = 10 => PCI_INT[A] = inout, PCI_INT[B,C,D] = in
|
141 |
|
|
-- int = 11 => PCI_INT[B] = inout, PCI_INT[A,C,D] = in
|
142 |
|
|
-- int = 12 => PCI_INT[C] = inout, PCI_INT[A,B,D] = in
|
143 |
|
|
-- int = 13 => PCI_INT[D] = inout, PCI_INT[A,B,C] = in
|
144 |
|
|
|
145 |
|
|
-- int > 13 => PCI_INT[A,B,C,D] = in
|
146 |
|
|
|
147 |
|
|
interrupt : if int /= 0 generate
|
148 |
|
|
x : for i in 0 to 3 generate
|
149 |
|
|
xo : if i = int - 1 and int < 10 generate
|
150 |
|
|
pad_pci_int : odpad generic map (tech => padtech, level => pci33, oepol => oepol)
|
151 |
|
|
port map (pci_int(i), pcio.inten);
|
152 |
|
|
end generate;
|
153 |
|
|
xio : if i = (int - 10) and int >= 10 generate
|
154 |
|
|
pad_pci_int : iodpad generic map (tech => padtech, level => pci33, oepol => oepol)
|
155 |
|
|
port map (pci_int(i), pcio.inten, pcii.int(i));
|
156 |
|
|
end generate;
|
157 |
|
|
xi : if i /= (int - 10) and int >= 10 generate
|
158 |
|
|
pad_pci_int : inpad generic map (tech => padtech, level => pci33)
|
159 |
|
|
port map (pci_int(i), pcii.int(i));
|
160 |
|
|
end generate;
|
161 |
|
|
end generate;
|
162 |
|
|
end generate;
|
163 |
|
|
|
164 |
|
|
end;
|