1 |
10 |
peio |
--+-------------------------------------------------------------------------------------------------+
|
2 |
|
|
--| |
|
3 |
|
|
--| File: pciregs.vhd |
|
4 |
|
|
--| |
|
5 |
|
|
--| Project: pci32tLite |
|
6 |
|
|
--| |
|
7 |
|
|
--| Description: PCI Registers |
|
8 |
|
|
--| |
|
9 |
|
|
--| +-----------------------------------------------------------------------+ |
|
10 |
|
|
--| | PCI CONFIGURATION SPACE REGISTERS | |
|
11 |
|
|
--| +-----------------------------------------------------------------------+ |
|
12 |
|
|
--| |
|
13 |
|
|
--| +-------------------------------------------------------------------+ |
|
14 |
|
|
--| | REGISTER | adr(7..2) | offset | Byte Enable | Size | |
|
15 |
|
|
--| +-------------------------------------------------------------------+ |
|
16 |
|
|
--| | VENDORID | 000000 (r) | 00 | 0/1 | 2 | |
|
17 |
|
|
--| +-------------------------------------------------------------------+ |
|
18 |
|
|
--| | DERVICEID | 000000 (r) | 02 | 2/3 | 2 | |
|
19 |
|
|
--| +-------------------------------------------------------------------+ |
|
20 |
|
|
--| | CMD | 000001 (r/w) | 04 | 0/1 | 2 | |
|
21 |
|
|
--| +-------------------------------------------------------------------+ |
|
22 |
|
|
--| | ST | 000001 (r/w*)| 06 | 2/3 | 2 | |
|
23 |
|
|
--| +-------------------------------------------------------------------+ |
|
24 |
|
|
--| | REVISIONID | 000010 (r) | 08 | 0 | 1 | |
|
25 |
|
|
--| +-------------------------------------------------------------------+ |
|
26 |
|
|
--| | CLASSCODE | 000010 (r) | 09 | 1/2/3 | 3 | |
|
27 |
|
|
--| +-------------------------------------------------------------------+ |
|
28 |
|
|
--| | HEADERTYPE | 000011 (r) | 0E | 2 | 1 | |
|
29 |
|
|
--| +-------------------------------------------------------------------+ |
|
30 |
|
|
--| | BAR0 | 000100 (r/w) | 10 | 0/1/2/3 | 4 | |
|
31 |
|
|
--| +-------------------------------------------------------------------+ |
|
32 |
|
|
--| | SUBSYSTEMID | 001011 (r) | 2C | 0/1 | 2 | |
|
33 |
|
|
--| +-------------------------------------------------------------------+ |
|
34 |
|
|
--| | SUBSYSTEMVID | 001011 (r) | 2E | 0/1 | 2 | |
|
35 |
|
|
--| +-------------------------------------------------------------------+ |
|
36 |
|
|
--| | INTLINE | 001111 (r/w) | 3C | 0 | 1 | |
|
37 |
|
|
--| +-------------------------------------------------------------------+ |
|
38 |
|
|
--| | INTPIN | 001111 (r) | 3D | 1 | 1 | |
|
39 |
|
|
--| +-------------------------------------------------------------------+ |
|
40 |
|
|
--| (w*) Reseteable |
|
41 |
|
|
--| |
|
42 |
|
|
--| +-----------------------------------------------+ |
|
43 |
|
|
--| | VENDORID (r) Vendor ID register | |
|
44 |
|
|
--| +-----------------------------------------------+-----------------------+ |
|
45 |
|
|
--| | Identifies manufacturer of device. | |
|
46 |
|
|
--| | VENDORIDr : vendorID (generic) | |
|
47 |
|
|
--| +-----------------------------------------------------------------------+ |
|
48 |
|
|
--| |
|
49 |
|
|
--| +-----------------------------------------------+ |
|
50 |
|
|
--| | DEVICEID (r) Device ID register | |
|
51 |
|
|
--| +-----------------------------------------------+-----------------------+ |
|
52 |
|
|
--| | Identifies the device. | |
|
53 |
|
|
--| | DEVICEIDr : deviceID (generic) | |
|
54 |
|
|
--| +-----------------------------------------------------------------------+ |
|
55 |
|
|
--| |
|
56 |
|
|
--| +-----------------------------------------------+ |
|
57 |
|
|
--| | CMD (r/w) CoMmanD register | |
|
58 |
|
|
--| +-----------------------------------------------+------------------------------+ |
|
59 |
|
|
--| | 0 | 0 | 0 | 0 | 0 | 0 | 0 | SERRENb | (15-8) |
|
60 |
|
|
--| +------------------------------------------------------------------------------+ |
|
61 |
|
|
--| | 0 | PERRENb| 0 | 0 | 0 | 0 |MEMSPACEENb|IOSPACEENb| (7-0) |
|
62 |
|
|
--| +------------------------------------------------------------------------------+ |
|
63 |
|
|
--| | SERRENb : System ERRor ENable (1 = Enabled) | |
|
64 |
|
|
--| | PERRENb : Parity ERRor ENable (1 = Enabled) | |
|
65 |
|
|
--| | MEMSPACEENb : MEMory SPACE ENable (1 = Enabled) | |
|
66 |
|
|
--| | IOSPACEENb : IO SPACE ENable (1 = Enabled) | |
|
67 |
|
|
--| +-----------------------------------------------------------------------+ |
|
68 |
|
|
--| |
|
69 |
|
|
--| +-----------------------------------------------+ |
|
70 |
|
|
--| | ST (r/w*) STatus register | |
|
71 |
|
|
--| +-----------------------------------------------+-------------------------+ |
|
72 |
|
|
--| | PERRDTb | SERRSIb| -- | -- |TABORTSIb| DEVSELTIMb(1..0)| -- | (15-8) |
|
73 |
|
|
--| +-------------------------------------------------------------------------+ |
|
74 |
|
|
--| | -- | -- | -- | -- | -- | -- | -- | -- | (7-0) |
|
75 |
|
|
--| +-------------------------------------------------------------------------+ |
|
76 |
|
|
--| | PERRDTb : Parity ERRor DeTected | |
|
77 |
|
|
--| | SERRSIb : System ERRor SIgnaled | |
|
78 |
|
|
--| | TABORTSIb : Target ABORT SIgnaled | |
|
79 |
|
|
--| +-----------------------------------------------------------------------+ |
|
80 |
|
|
--| |
|
81 |
|
|
--| +-----------------------------------------------+ |
|
82 |
|
|
--| | REVISIONID (r) Revision ID register | |
|
83 |
|
|
--| +-----------------------------------------------+-----------------------+ |
|
84 |
|
|
--| | Identifies a device revision. | |
|
85 |
|
|
--| +-----------------------------------------------------------------------+ |
|
86 |
|
|
--| +-----------------------------------------------+ |
|
87 |
|
|
--| | CLASSCODE (r) CLASS CODE register | |
|
88 |
|
|
--| +-----------------------------------------------+-----------------------+ |
|
89 |
|
|
--| | Identifies the generic funtion of the device. | |
|
90 |
|
|
--| +-----------------------------------------------------------------------+ |
|
91 |
|
|
--| +-----------------------------------------------+ |
|
92 |
|
|
--| | HEADERTYPE (r) Header Type register | |
|
93 |
|
|
--| +-----------------------------------------------+-----------------------+ |
|
94 |
|
|
--| | Identifies the layout of the second part of the predefined header. | |
|
95 |
|
|
--| +-----------------------------------------------------------------------+ |
|
96 |
|
|
--| |
|
97 |
|
|
--| +-----------------------------------------------+ |
|
98 |
|
|
--| | BAR0 (r/w) Base AddRess 0 register | |
|
99 |
|
|
--| +-----------------------------------------------+-----------------------+ |
|
100 |
|
|
--| | BAR032MBb(6..0) | -- | (31-24) |
|
101 |
|
|
--| +-----------------------------------------------------------------------+ |
|
102 |
|
|
--| | BAR032MBb : Base Address 32MBytes decode space (7 bits) | |
|
103 |
|
|
--| +-----------------------------------------------------------------------+ |
|
104 |
|
|
--| |
|
105 |
|
|
--| +-----------------------------------------------+ |
|
106 |
|
|
--| | SUBSYSTEMVID (r) SUBSYSTEM Vendor ID register | |
|
107 |
|
|
--| +-----------------------------------------------+-----------------------+ |
|
108 |
|
|
--| | Identifies vendor of add-in board or subsystem. | |
|
109 |
|
|
--| | SUBSYSTEMVIDr : subsystemvID (generic) | |
|
110 |
|
|
--| +-----------------------------------------------------------------------+ |
|
111 |
|
|
--| |
|
112 |
|
|
--| +-----------------------------------------------+ |
|
113 |
|
|
--| | SUBSYSTEMID (r) SUBSYSTEM ID register | |
|
114 |
|
|
--| +-----------------------------------------------+-----------------------+ |
|
115 |
|
|
--| | Vendor specific. | |
|
116 |
|
|
--| | SUBSYTEMIDr : subsytemID (generic) | |
|
117 |
|
|
--| +-----------------------------------------------------------------------+ |
|
118 |
|
|
--| |
|
119 |
|
|
--| +-----------------------------------------------+ |
|
120 |
|
|
--| | INTLINE (r/w) INTerrupt LINE register | |
|
121 |
|
|
--| +-----------------------------------------------+-----------------------+ |
|
122 |
|
|
--| | INTLINEr(7..0) | (7..0) |
|
123 |
|
|
--| +-----------------------------------------------------------------------+ |
|
124 |
|
|
--| | Interrupt Line routing information | |
|
125 |
|
|
--| +-----------------------------------------------------------------------+ |
|
126 |
|
|
--| |
|
127 |
|
|
--| +-----------------------------------------------+ |
|
128 |
|
|
--| | INTPIN (r) INTerrupt PIN register | |
|
129 |
|
|
--| +-----------------------------------------------+-----------------------+ |
|
130 |
|
|
--| | Tells which interrupt pin the device uses: 01=INTA | |
|
131 |
|
|
--| +-----------------------------------------------------------------------+ |
|
132 |
|
|
--| |
|
133 |
|
|
--+-------------------------------------------------------------------------------------------------+
|
134 |
|
|
--+-----------------------------------------------------------------+
|
135 |
|
|
--| |
|
136 |
|
|
--| Copyright (C) 2005-2008 Peio Azkarate, peio.azkarate@gmail.com |
|
137 |
|
|
--| |
|
138 |
|
|
--| This source file may be used and distributed without |
|
139 |
|
|
--| restriction provided that this copyright statement is not |
|
140 |
|
|
--| removed from the file and that any derivative work contains |
|
141 |
|
|
--| the original copyright notice and the associated disclaimer. |
|
142 |
|
|
--| |
|
143 |
|
|
--| This source file is free software; you can redistribute it |
|
144 |
|
|
--| and/or modify it under the terms of the GNU Lesser General |
|
145 |
|
|
--| Public License as published by the Free Software Foundation; |
|
146 |
|
|
--| either version 2.1 of the License, or (at your option) any |
|
147 |
|
|
--| later version. |
|
148 |
|
|
--| |
|
149 |
|
|
--| This source is distributed in the hope that it will be |
|
150 |
|
|
--| useful, but WITHOUT ANY WARRANTY; without even the implied |
|
151 |
|
|
--| warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
152 |
|
|
--| PURPOSE. See the GNU Lesser General Public License for more |
|
153 |
|
|
--| details. |
|
154 |
|
|
--| |
|
155 |
|
|
--| You should have received a copy of the GNU Lesser General |
|
156 |
|
|
--| Public License along with this source; if not, download it |
|
157 |
|
|
--| from http://www.opencores.org/lgpl.shtml |
|
158 |
|
|
--| |
|
159 |
|
|
--+-----------------------------------------------------------------+
|
160 |
|
|
|
161 |
|
|
|
162 |
|
|
--+-----------------------------------------------------------------------------+
|
163 |
|
|
--| LIBRARIES |
|
164 |
|
|
--+-----------------------------------------------------------------------------+
|
165 |
|
|
|
166 |
|
|
library ieee;
|
167 |
|
|
use ieee.std_logic_1164.all;
|
168 |
|
|
|
169 |
|
|
library onalib;
|
170 |
|
|
use onalib.onapackage.all;
|
171 |
|
|
|
172 |
|
|
|
173 |
|
|
--+-----------------------------------------------------------------------------+
|
174 |
|
|
--| ENTITY |
|
175 |
|
|
--+-----------------------------------------------------------------------------+
|
176 |
|
|
|
177 |
|
|
entity pciregs is
|
178 |
|
|
generic (
|
179 |
|
|
|
180 |
|
|
vendorID : std_logic_vector(15 downto 0);
|
181 |
|
|
deviceID : std_logic_vector(15 downto 0);
|
182 |
|
|
revisionID : std_logic_vector(7 downto 0);
|
183 |
|
|
subsystemID : std_logic_vector(15 downto 0);
|
184 |
|
|
subsystemvID : std_logic_vector(15 downto 0);
|
185 |
|
|
classcodeID : std_logic_vector(23 downto 0);
|
186 |
|
|
BARS : string := "1BARMEM"
|
187 |
|
|
|
188 |
|
|
);
|
189 |
|
|
port (
|
190 |
|
|
|
191 |
|
|
-- General
|
192 |
|
|
clk_i : in std_logic;
|
193 |
|
|
rst_i : in std_logic;
|
194 |
|
|
--
|
195 |
|
|
adr_i : in std_logic_vector(5 downto 0);
|
196 |
|
|
cbe_i : in std_logic_vector(3 downto 0);
|
197 |
|
|
dat_i : in std_logic_vector(31 downto 0);
|
198 |
|
|
dat_o : out std_logic_vector(31 downto 0);
|
199 |
|
|
--
|
200 |
|
|
wrcfg_i : in std_logic;
|
201 |
|
|
rdcfg_i : in std_logic;
|
202 |
|
|
perr_i : in std_logic;
|
203 |
|
|
serr_i : in std_logic;
|
204 |
|
|
tabort_i : in std_logic;
|
205 |
|
|
--
|
206 |
|
|
bar0_o : out std_logic_vector(31 downto 9);
|
207 |
|
|
perrEN_o : out std_logic;
|
208 |
|
|
serrEN_o : out std_logic;
|
209 |
|
|
memEN_o : out std_logic;
|
210 |
|
|
ioEN_o : out std_logic
|
211 |
|
|
|
212 |
|
|
);
|
213 |
|
|
end pciregs;
|
214 |
|
|
|
215 |
|
|
|
216 |
|
|
architecture rtl of pciregs is
|
217 |
|
|
|
218 |
|
|
|
219 |
|
|
--+-----------------------------------------------------------------------------+
|
220 |
|
|
--| COMPONENTS |
|
221 |
|
|
--+-----------------------------------------------------------------------------+
|
222 |
|
|
--+-----------------------------------------------------------------------------+
|
223 |
|
|
--| CONSTANTS |
|
224 |
|
|
--+-----------------------------------------------------------------------------+
|
225 |
|
|
|
226 |
|
|
--constant CLASSCODEr : std_logic_vector(23 downto 0) := X"068000"; -- Bridge-OtherBridgeDevice
|
227 |
|
|
constant CLASSCODEr : std_logic_vector(23 downto 0) := classcodeID;
|
228 |
|
|
constant REVISIONIDr : std_logic_vector(7 downto 0) := revisionID; -- PR00=80,PR1=81...
|
229 |
|
|
constant HEADERTYPEr : std_logic_vector(7 downto 0) := X"00";
|
230 |
|
|
constant DEVSELTIMb : std_logic_vector(1 downto 0) := b"01"; -- DEVSEL TIMing (bits) medium speed
|
231 |
|
|
constant VENDORIDr : std_logic_vector(15 downto 0) := vendorID;
|
232 |
|
|
constant DEVICEIDr : std_logic_vector(15 downto 0) := deviceID;
|
233 |
|
|
constant SUBSYSTEMIDr : std_logic_vector(15 downto 0) := subsystemID;
|
234 |
|
|
constant SUBSYSTEMVIDr : std_logic_vector(15 downto 0) := subsystemvID;
|
235 |
|
|
constant INTPINr : std_logic_vector(7 downto 0) := X"01"; -- INTA#
|
236 |
|
|
|
237 |
|
|
|
238 |
|
|
--+-----------------------------------------------------------------------------+
|
239 |
|
|
--| SIGNALS |
|
240 |
|
|
--+-----------------------------------------------------------------------------+
|
241 |
|
|
|
242 |
|
|
signal dataout : std_logic_vector(31 downto 0);
|
243 |
|
|
signal tabortPFS : std_logic;
|
244 |
|
|
signal serrPFS : std_logic;
|
245 |
|
|
signal perrPFS : std_logic;
|
246 |
|
|
signal adrSTCMD : std_logic;
|
247 |
|
|
signal adrBAR0 : std_logic;
|
248 |
|
|
signal adrINT : std_logic;
|
249 |
|
|
signal we0CMD : std_logic;
|
250 |
|
|
signal we1CMD : std_logic;
|
251 |
|
|
signal we3ST : std_logic;
|
252 |
|
|
signal we3BAR0 : std_logic;
|
253 |
|
|
signal we0INT : std_logic;
|
254 |
|
|
signal we1INT : std_logic;
|
255 |
|
|
signal st11SEN : std_logic;
|
256 |
|
|
signal st11REN : std_logic;
|
257 |
|
|
signal st14SEN : std_logic;
|
258 |
|
|
signal st14REN : std_logic;
|
259 |
|
|
signal st15SEN : std_logic;
|
260 |
|
|
signal st15REN : std_logic;
|
261 |
|
|
|
262 |
|
|
|
263 |
|
|
--+---------------------------------------------------------+
|
264 |
|
|
--| CONFIGURATION SPACE REGISTERS |
|
265 |
|
|
--+---------------------------------------------------------+
|
266 |
|
|
|
267 |
|
|
-- INTERRUPT LINE register
|
268 |
|
|
signal INTLINEr : std_logic_vector(7 downto 0);
|
269 |
|
|
-- COMMAND register bits
|
270 |
|
|
signal MEMSPACEENb : std_logic; -- Memory SPACE ENable (bit)
|
271 |
|
|
signal IOSPACEENb : std_logic; -- IO SPACE ENable (bit)
|
272 |
|
|
signal PERRENb : std_logic; -- Parity ERRor ENable (bit)
|
273 |
|
|
signal SERRENb : std_logic; -- SERR ENable (bit)
|
274 |
|
|
-- STATUS register bits
|
275 |
|
|
--signal DEVSELTIMb : std_logic_vector(1 downto 0); -- DEVSEL TIMing (bits)
|
276 |
|
|
signal TABORTSIb : std_logic; -- TarGet ABORT SIgnaling (bit)
|
277 |
|
|
signal SERRSIb : std_logic; -- System ERRor SIgnaling (bit)
|
278 |
|
|
signal PERRDTb : std_logic; -- Parity ERRor DeTected (bit)
|
279 |
|
|
-- BAR0 register bits
|
280 |
|
|
signal BAR0b : std_logic_vector(31 downto 0);
|
281 |
|
|
|
282 |
|
|
|
283 |
|
|
begin
|
284 |
|
|
|
285 |
|
|
--+-----------------------------------------+
|
286 |
|
|
--| BAR0 32MBytes Memory Space |
|
287 |
|
|
--+-----------------------------------------+
|
288 |
|
|
barmem_g: if (BARS="1BARMEM") generate
|
289 |
|
|
BAR0b(24 downto 0) <= (others => '0');
|
290 |
|
|
end generate;
|
291 |
|
|
|
292 |
|
|
--+-----------------------------------------+
|
293 |
|
|
--| BAR0 512Bytes Io Space |
|
294 |
|
|
--+-----------------------------------------+
|
295 |
|
|
bario_g: if (BARS="1BARIO") generate
|
296 |
|
|
BAR0b(31 downto 16) <= (others => '0');
|
297 |
|
|
BAR0b(8 downto 1) <= (others => '0');
|
298 |
|
|
BAR0b(0) <= '1';
|
299 |
|
|
end generate;
|
300 |
|
|
|
301 |
|
|
--+-------------------------------------------------------------------------+
|
302 |
|
|
--| Component instances |
|
303 |
|
|
--+-------------------------------------------------------------------------+
|
304 |
|
|
|
305 |
|
|
u1: pfs port map ( clk => clk_i, rst => rst_i, a => tabort_i, y => tabortPFS );
|
306 |
|
|
u2: pfs port map ( clk => clk_i, rst => rst_i, a => serr_i, y => serrPFS );
|
307 |
|
|
u3: pfs port map ( clk => clk_i, rst => rst_i, a => perr_i, y => perrPFS );
|
308 |
|
|
|
309 |
|
|
|
310 |
|
|
--+-------------------------------------------------------------------------+
|
311 |
|
|
--| Registers Address Decoder |
|
312 |
|
|
--+-------------------------------------------------------------------------+
|
313 |
|
|
|
314 |
|
|
adrSTCMD <= '1' when ( adr_i(5 downto 0) = b"000001" ) else '0';
|
315 |
|
|
adrBAR0 <= '1' when ( adr_i(5 downto 0) = b"000100" ) else '0';
|
316 |
|
|
adrINT <= '1' when ( adr_i(5 downto 0) = b"001111" ) else '0';
|
317 |
|
|
|
318 |
|
|
|
319 |
|
|
--+-------------------------------------------------------------------------+
|
320 |
|
|
--| WRITE ENABLE REGISTERS |
|
321 |
|
|
--+-------------------------------------------------------------------------+
|
322 |
|
|
|
323 |
|
|
--+-----------------------------------------+
|
324 |
|
|
--| Write Enable Registers |
|
325 |
|
|
--+-----------------------------------------+
|
326 |
|
|
|
327 |
|
|
we0CMD <= adrSTCMD and wrcfg_i and (not cbe_i(0));
|
328 |
|
|
we1CMD <= adrSTCMD and wrcfg_i and (not cbe_i(1));
|
329 |
|
|
--we2ST <= adrSTCMD and wrcfg_i and (not cbe_i(2));
|
330 |
|
|
we3ST <= adrSTCMD and wrcfg_i and (not cbe_i(3));
|
331 |
|
|
--we2BAR0 <= adrBAR0 and wrcfg_i and (not cbe_i(2));
|
332 |
|
|
we3BAR0 <= adrBAR0 and wrcfg_i and (not cbe_i(3));
|
333 |
|
|
we0INT <= adrINT and wrcfg_i and (not cbe_i(0));
|
334 |
|
|
--we1INT <= adrINT and wrcfg_i and (not cbe_i(1));
|
335 |
|
|
|
336 |
|
|
--+-----------------------------------------+
|
337 |
|
|
--| Set Enable & Reset Enable bits |
|
338 |
|
|
--+-----------------------------------------+
|
339 |
|
|
st11SEN <= tabortPFS;
|
340 |
|
|
st11REN <= we3ST and dat_i(27);
|
341 |
|
|
st14SEN <= serrPFS;
|
342 |
|
|
st14REN <= we3ST and dat_i(30);
|
343 |
|
|
st15SEN <= perrPFS;
|
344 |
|
|
st15REN <= we3ST and dat_i(31);
|
345 |
|
|
|
346 |
|
|
|
347 |
|
|
--+-------------------------------------------------------------------------+
|
348 |
|
|
--| WRITE REGISTERS |
|
349 |
|
|
--+-------------------------------------------------------------------------+
|
350 |
|
|
|
351 |
|
|
--+---------------------------------------------------------+
|
352 |
|
|
--| COMMAND REGISTER Write |
|
353 |
|
|
--+---------------------------------------------------------+
|
354 |
|
|
|
355 |
|
|
REGCMDWR: process( clk_i, rst_i, we0CMD, we1CMD, dat_i )
|
356 |
|
|
begin
|
357 |
|
|
if( rst_i = '1' ) then
|
358 |
|
|
IOSPACEENb <= '0';
|
359 |
|
|
MEMSPACEENb <= '0';
|
360 |
|
|
PERRENb <= '0';
|
361 |
|
|
SERRENb <= '0';
|
362 |
|
|
elsif( rising_edge( clk_i ) ) then
|
363 |
|
|
|
364 |
|
|
-- Byte 0
|
365 |
|
|
if( we0CMD = '1' ) then
|
366 |
|
|
IOSPACEENb <= dat_i(0);
|
367 |
|
|
MEMSPACEENb <= dat_i(1);
|
368 |
|
|
PERRENb <= dat_i(6);
|
369 |
|
|
end if;
|
370 |
|
|
|
371 |
|
|
-- Byte 1
|
372 |
|
|
if( we1CMD = '1' ) then
|
373 |
|
|
SERRENb <= dat_i(8);
|
374 |
|
|
end if;
|
375 |
|
|
|
376 |
|
|
end if;
|
377 |
|
|
|
378 |
|
|
end process REGCMDWR;
|
379 |
|
|
|
380 |
|
|
|
381 |
|
|
--+---------------------------------------------------------+
|
382 |
|
|
--| STATUS REGISTER WRITE (Reset only) |
|
383 |
|
|
--+---------------------------------------------------------+
|
384 |
|
|
|
385 |
|
|
REGSTWR: process( clk_i, rst_i, st11SEN, st11REN, st14SEN, st14REN, st15SEN, st15REN )
|
386 |
|
|
begin
|
387 |
|
|
|
388 |
|
|
if( rst_i = '1' ) then
|
389 |
|
|
TABORTSIb <= '0';
|
390 |
|
|
SERRSIb <= '0';
|
391 |
|
|
PERRDTb <= '0';
|
392 |
|
|
elsif( rising_edge( clk_i ) ) then
|
393 |
|
|
|
394 |
|
|
-- TarGet ABORT SIgnaling bit
|
395 |
|
|
if( st11SEN = '1' ) then
|
396 |
|
|
TABORTSIb <= '1';
|
397 |
|
|
elsif ( st11REN = '1' ) then
|
398 |
|
|
TABORTSIb <= '0';
|
399 |
|
|
end if;
|
400 |
|
|
|
401 |
|
|
-- System ERRor SIgnaling bit
|
402 |
|
|
if( st14SEN = '1' ) then
|
403 |
|
|
SERRSIb <= '1';
|
404 |
|
|
elsif ( st14REN = '1' ) then
|
405 |
|
|
SERRSIb <= '0';
|
406 |
|
|
end if;
|
407 |
|
|
|
408 |
|
|
-- Parity ERRor DEtected bit
|
409 |
|
|
if( st15SEN = '1' ) then
|
410 |
|
|
PERRDTb <= '1';
|
411 |
|
|
elsif ( st15REN = '1' ) then
|
412 |
|
|
PERRDTb <= '0';
|
413 |
|
|
end if;
|
414 |
|
|
|
415 |
|
|
end if;
|
416 |
|
|
|
417 |
|
|
end process REGSTWR;
|
418 |
|
|
|
419 |
|
|
|
420 |
|
|
--+---------------------------------------------------------+
|
421 |
|
|
--| INTERRUPT REGISTER Write |
|
422 |
|
|
--+---------------------------------------------------------+
|
423 |
|
|
|
424 |
|
|
REGINTWR: process( clk_i, rst_i, we0INT, dat_i )
|
425 |
|
|
begin
|
426 |
|
|
|
427 |
|
|
if( rst_i = '1' ) then
|
428 |
|
|
INTLINEr <= ( others => '0' );
|
429 |
|
|
elsif( rising_edge( clk_i ) ) then
|
430 |
|
|
-- Byte 0
|
431 |
|
|
if( we0INT = '1' ) then
|
432 |
|
|
INTLINEr <= dat_i(7 downto 0);
|
433 |
|
|
end if;
|
434 |
|
|
end if;
|
435 |
|
|
end process REGINTWR;
|
436 |
|
|
|
437 |
|
|
|
438 |
|
|
--+---------------------------------------------------------+
|
439 |
|
|
--| BAR0 32MBytes MEM address space (bits 31-25) |
|
440 |
|
|
--+---------------------------------------------------------+
|
441 |
|
|
rbarmem_g: if (BARS="1BARMEM") generate
|
442 |
|
|
RBAR0MEMWR: process( clk_i, rst_i, we3BAR0, dat_i )
|
443 |
|
|
begin
|
444 |
|
|
if( rst_i = '1' ) then
|
445 |
|
|
BAR0b(31 downto 25) <= ( others => '0' );
|
446 |
|
|
elsif( rising_edge( clk_i ) ) then
|
447 |
|
|
-- Byte 3
|
448 |
|
|
if( we3BAR0 = '1' ) then
|
449 |
|
|
BAR0b(31 downto 25) <= dat_i(31 downto 25);
|
450 |
|
|
end if;
|
451 |
|
|
end if;
|
452 |
|
|
end process RBAR0MEMWR;
|
453 |
|
|
end generate;
|
454 |
|
|
|
455 |
|
|
--+---------------------------------------------------------+
|
456 |
|
|
--| BAR0 512Bytes IO address space (bits 15-9) |
|
457 |
|
|
--+---------------------------------------------------------+
|
458 |
|
|
rbario_g: if (BARS="1BARIO") generate
|
459 |
|
|
RBAR0IOWR: process( clk_i, rst_i, we3BAR0, dat_i )
|
460 |
|
|
begin
|
461 |
|
|
if( rst_i = '1' ) then
|
462 |
|
|
BAR0b(15 downto 9) <= ( others => '0' );
|
463 |
|
|
elsif( rising_edge( clk_i ) ) then
|
464 |
|
|
-- Byte 3
|
465 |
|
|
if( we3BAR0 = '1' ) then
|
466 |
|
|
BAR0b(15 downto 9) <= dat_i(15 downto 9);
|
467 |
|
|
end if;
|
468 |
|
|
end if;
|
469 |
|
|
end process RBAR0IOWR;
|
470 |
|
|
end generate;
|
471 |
|
|
|
472 |
|
|
|
473 |
|
|
|
474 |
|
|
--+-------------------------------------------------------------------------+
|
475 |
|
|
--| Registers MUX (READ) |
|
476 |
|
|
--+-------------------------------------------------------------------------+
|
477 |
|
|
RRMUX: process( adr_i, PERRDTb, SERRSIb, TABORTSIb, SERRENb, PERRENb, MEMSPACEENb, IOSPACEENb, BAR0b,
|
478 |
|
|
INTLINEr, rdcfg_i )
|
479 |
|
|
begin
|
480 |
|
|
|
481 |
|
|
if ( rdcfg_i = '1' ) then
|
482 |
|
|
|
483 |
|
|
case adr_i is
|
484 |
|
|
|
485 |
|
|
when b"000000" =>
|
486 |
|
|
dataout <= DEVICEIDr & VENDORIDr;
|
487 |
|
|
when b"000001" =>
|
488 |
|
|
dataout <= PERRDTb & SERRSIb & b"00" & TABORTSIb & DEVSELTIMb & b"000000000" &
|
489 |
|
|
b"0000000" & SERRENb & b"0" & PERRENb & b"0000" & MEMSPACEENb & IOSPACEENb;
|
490 |
|
|
when b"000010" =>
|
491 |
|
|
dataout <= CLASSCODEr & REVISIONIDr;
|
492 |
|
|
when b"000100" =>
|
493 |
|
|
dataout <= BAR0b;
|
494 |
|
|
when b"001011" =>
|
495 |
|
|
dataout <= SUBSYSTEMIDr & SUBSYSTEMVIDr;
|
496 |
|
|
when b"001111" =>
|
497 |
|
|
dataout <= b"0000000000000000" & INTPINr & INTLINEr;
|
498 |
|
|
when others =>
|
499 |
|
|
dataout <= ( others => '0' );
|
500 |
|
|
|
501 |
|
|
end case;
|
502 |
|
|
|
503 |
|
|
else
|
504 |
|
|
|
505 |
|
|
dataout <= ( others => '0' );
|
506 |
|
|
|
507 |
|
|
end if;
|
508 |
|
|
|
509 |
|
|
end process RRMUX;
|
510 |
|
|
|
511 |
|
|
dat_o <= dataout;
|
512 |
|
|
|
513 |
|
|
|
514 |
|
|
--+-------------------------------------------------------------------------+
|
515 |
|
|
--| BAR0 & COMMAND REGS bits outputs |
|
516 |
|
|
--+-------------------------------------------------------------------------+
|
517 |
|
|
|
518 |
|
|
bar0_o <= BAR0b(31 downto 9);
|
519 |
|
|
perrEN_o <= PERRENb;
|
520 |
|
|
serrEN_o <= SERRENb;
|
521 |
|
|
memEN_o <= MEMSPACEENb;
|
522 |
|
|
ioEN_o <= IOSPACEENb;
|
523 |
|
|
|
524 |
|
|
|
525 |
|
|
end rtl;
|