1 |
18 |
mihad |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// File name "pci_user_constants.v" ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// This file is part of the "PCI bridge" project ////
|
6 |
|
|
//// http://www.opencores.org/cores/pci/ ////
|
7 |
|
|
//// ////
|
8 |
|
|
//// Author(s): ////
|
9 |
|
|
//// - Miha Dolenc (mihad@opencores.org) ////
|
10 |
|
|
//// - Tadej Markovic (tadej@opencores.org) ////
|
11 |
|
|
//// ////
|
12 |
|
|
//////////////////////////////////////////////////////////////////////
|
13 |
|
|
//// ////
|
14 |
|
|
//// Copyright (C) 2000 Miha Dolenc, mihad@opencores.org ////
|
15 |
|
|
//// ////
|
16 |
|
|
//// This source file may be used and distributed without ////
|
17 |
|
|
//// restriction provided that this copyright statement is not ////
|
18 |
|
|
//// removed from the file and that any derivative work contains ////
|
19 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
20 |
|
|
//// ////
|
21 |
|
|
//// This source file is free software; you can redistribute it ////
|
22 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
23 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
24 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
25 |
|
|
//// later version. ////
|
26 |
|
|
//// ////
|
27 |
|
|
//// This source is distributed in the hope that it will be ////
|
28 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
29 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
30 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
31 |
|
|
//// details. ////
|
32 |
|
|
//// ////
|
33 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
34 |
|
|
//// Public License along with this source; if not, download it ////
|
35 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
36 |
|
|
//// ////
|
37 |
|
|
//////////////////////////////////////////////////////////////////////
|
38 |
|
|
//
|
39 |
|
|
// CVS Revision History
|
40 |
|
|
//
|
41 |
|
|
// $Log: not supported by cvs2svn $
|
42 |
148 |
mihad |
// Revision 1.14 2004/07/07 12:45:01 mihad
|
43 |
|
|
// Added SubsystemVendorID, SubsystemID, MAXLatency, MinGnt defines.
|
44 |
|
|
// Enabled value loading from serial EEPROM for all of the above + VendorID and DeviceID registers.
|
45 |
|
|
//
|
46 |
143 |
mihad |
// Revision 1.13 2004/01/24 11:54:18 mihad
|
47 |
|
|
// Update! SPOCI Implemented!
|
48 |
|
|
//
|
49 |
140 |
mihad |
// Revision 1.12 2003/12/28 09:54:48 fr2201
|
50 |
|
|
// def_wb_imagex_addr_map defined correctly
|
51 |
|
|
//
|
52 |
137 |
fr2201 |
// Revision 1.11 2003/12/28 09:20:00 fr2201
|
53 |
|
|
// Reset values for PCI, WB defined (PCI_TAx,WB_BAx,WB_TAx,WB_AMx,WB_BAx_MEM_IO)
|
54 |
|
|
//
|
55 |
136 |
fr2201 |
// Revision 1.10 2003/12/19 11:11:30 mihad
|
56 |
|
|
// Compact PCI Hot Swap support added.
|
57 |
|
|
// New testcases added.
|
58 |
|
|
// Specification updated.
|
59 |
|
|
// Test application changed to support WB B3 cycles.
|
60 |
|
|
//
|
61 |
132 |
mihad |
// Revision 1.9 2003/08/03 18:05:06 mihad
|
62 |
|
|
// Added limited WISHBONE B3 support for WISHBONE Slave Unit.
|
63 |
|
|
// Doesn't support full speed bursts yet.
|
64 |
|
|
//
|
65 |
106 |
mihad |
// Revision 1.8 2003/03/14 15:31:57 mihad
|
66 |
|
|
// Entered the option to disable no response counter in wb master.
|
67 |
|
|
//
|
68 |
86 |
mihad |
// Revision 1.7 2003/01/27 17:05:50 mihad
|
69 |
|
|
// Updated.
|
70 |
|
|
//
|
71 |
79 |
mihad |
// Revision 1.6 2003/01/27 16:51:19 mihad
|
72 |
|
|
// Old files with wrong names removed.
|
73 |
|
|
//
|
74 |
78 |
mihad |
// Revision 1.5 2003/01/21 16:06:56 mihad
|
75 |
|
|
// Bug fixes, testcases added.
|
76 |
|
|
//
|
77 |
73 |
mihad |
// Revision 1.4 2002/09/30 17:22:45 mihad
|
78 |
|
|
// Added support for Virtual Silicon two port RAM. Didn't run regression on it yet!
|
79 |
|
|
//
|
80 |
60 |
mihad |
// Revision 1.3 2002/08/13 11:03:53 mihad
|
81 |
|
|
// Added a few testcases. Repaired wrong reset value for PCI_AM5 register. Repaired Parity Error Detected bit setting. Changed PCI_AM0 to always enabled(regardles of PCI_AM0 define), if image 0 is used as configuration image
|
82 |
|
|
//
|
83 |
45 |
mihad |
// Revision 1.2 2002/03/05 11:53:47 mihad
|
84 |
|
|
// Added some testcases, removed un-needed fifo signals
|
85 |
|
|
//
|
86 |
33 |
mihad |
// Revision 1.1 2002/02/01 14:43:31 mihad
|
87 |
|
|
// *** empty log message ***
|
88 |
18 |
mihad |
//
|
89 |
33 |
mihad |
//
|
90 |
18 |
mihad |
|
91 |
|
|
// Fifo implementation defines:
|
92 |
|
|
// If FPGA and XILINX are defined, Xilinx's BlockSelectRAM+ is instantiated for Fifo storage.
|
93 |
|
|
// 16 bit width is used, so 8 bits of address ( 256 ) locations are available. If RAM_DONT_SHARE is not defined (commented out),
|
94 |
|
|
// then one block RAM is shared between two FIFOs. That means each Fifo can have a maximum address length of 7 - depth of 128 and only 6 block rams are used
|
95 |
|
|
// If RAM_DONT_SHARE is defined ( not commented out ), then 12 block RAMs are used and each Fifo can have a maximum address length of 8 ( 256 locations )
|
96 |
|
|
// If FPGA is not defined, then ASIC RAMs are used. Currently there is only one version of ARTISAN RAM supported. User should generate synchronous RAM with
|
97 |
|
|
// width of 40 and instantiate it in pci_tpram.v. If RAM_DONT_SHARE is defined, then these can be dual port rams ( write port
|
98 |
|
|
// in one clock domain, read in other ), otherwise it must be two port RAM ( read and write ports in both clock domains ).
|
99 |
|
|
// If RAM_DONT_SHARE is defined, then all RAM address lengths must be specified accordingly, otherwise there are two relevant lengths - PCI_FIFO_RAM_ADDR_LENGTH and
|
100 |
|
|
// WB_FIFO_RAM_ADDR_LENGTH.
|
101 |
|
|
|
102 |
143 |
mihad |
`define WBW_ADDR_LENGTH 4
|
103 |
|
|
`define WBR_ADDR_LENGTH 4
|
104 |
148 |
mihad |
`define PCIW_ADDR_LENGTH 3
|
105 |
|
|
`define PCIR_ADDR_LENGTH 3
|
106 |
18 |
mihad |
|
107 |
148 |
mihad |
//`define FPGA
|
108 |
|
|
//`define XILINX
|
109 |
18 |
mihad |
|
110 |
148 |
mihad |
`define WB_RAM_DONT_SHARE
|
111 |
143 |
mihad |
`define PCI_RAM_DONT_SHARE
|
112 |
18 |
mihad |
|
113 |
|
|
`ifdef FPGA
|
114 |
|
|
`ifdef XILINX
|
115 |
148 |
mihad |
`define PCI_FIFO_RAM_ADDR_LENGTH 8 // PCI target unit fifo storage definition
|
116 |
18 |
mihad |
`define WB_FIFO_RAM_ADDR_LENGTH 8 // WB slave unit fifo storage definition
|
117 |
148 |
mihad |
`define PCI_XILINX_RAMB4
|
118 |
18 |
mihad |
`define WB_XILINX_RAMB4
|
119 |
148 |
mihad |
//`define PCI_XILINX_DIST_RAM
|
120 |
18 |
mihad |
//`define WB_XILINX_DIST_RAM
|
121 |
|
|
`endif
|
122 |
|
|
`else
|
123 |
148 |
mihad |
`define PCI_FIFO_RAM_ADDR_LENGTH 3 // PCI target unit fifo storage definition when RAM sharing is used ( both pcir and pciw fifo use same instance of RAM )
|
124 |
|
|
`define WB_FIFO_RAM_ADDR_LENGTH 4 // WB slave unit fifo storage definition when RAM sharing is used ( both wbr and wbw fifo use same instance of RAM )
|
125 |
33 |
mihad |
// `define WB_ARTISAN_SDP
|
126 |
|
|
// `define PCI_ARTISAN_SDP
|
127 |
60 |
mihad |
// `define PCI_VS_STP
|
128 |
|
|
// `define WB_VS_STP
|
129 |
18 |
mihad |
`endif
|
130 |
|
|
|
131 |
|
|
// these two defines allow user to select active high or low output enables on PCI bus signals, depending on
|
132 |
|
|
// output buffers instantiated. Xilinx FPGAs use active low output enables.
|
133 |
|
|
`define ACTIVE_LOW_OE
|
134 |
|
|
//`define ACTIVE_HIGH_OE
|
135 |
|
|
|
136 |
|
|
// HOST/GUEST implementation selection - see design document and specification for description of each implementation
|
137 |
|
|
// only one can be defined at same time
|
138 |
79 |
mihad |
//`define HOST
|
139 |
45 |
mihad |
`define GUEST
|
140 |
18 |
mihad |
|
141 |
|
|
// if NO_CNF_IMAGE is commented out, then READ-ONLY access to configuration space is ENABLED:
|
142 |
|
|
// - ENABLED Read-Only access from WISHBONE for GUEST bridges
|
143 |
|
|
// - ENABLED Read-Only access from PCI for HOST bridges
|
144 |
|
|
// with defining NO_CNF_IMAGE, one decoder and one multiplexer are saved
|
145 |
|
|
`define NO_CNF_IMAGE
|
146 |
|
|
|
147 |
|
|
// number defined here specifies how many MS bits in PCI address are compared with base address, to decode
|
148 |
|
|
// accesses. Maximum number allows for minimum image size ( number = 20, image size = 4KB ), minimum number
|
149 |
|
|
// allows for maximum image size ( number = 1, image size = 2GB ). If you intend on using different sizes of PCI images,
|
150 |
|
|
// you have to define a number of minimum sized image and enlarge others by specifying different address mask.
|
151 |
|
|
// smaller the number here, faster the decoder operation
|
152 |
148 |
mihad |
`define PCI_NUM_OF_DEC_ADDR_LINES 24
|
153 |
18 |
mihad |
|
154 |
|
|
// no. of PCI Target IMAGES
|
155 |
|
|
// - PCI provides 6 base address registers for image implementation.
|
156 |
|
|
// PCI_IMAGE1 definition is not required and has no effect, since PCI image 1 is always implemented
|
157 |
|
|
// If GUEST is defined, PCI Image 0 is also always implemented and is used for configuration space
|
158 |
|
|
// access.
|
159 |
|
|
// If HOST is defined and NO_CNF_IMAGE is not, then PCI Image 0 is used for Read Only access to configuration
|
160 |
|
|
// space. If HOST is defined and NO_CNF_IMAGE is defined, then user can define PCI_IMAGE0 as normal image, and there
|
161 |
|
|
// is no access to Configuration space possible from PCI bus.
|
162 |
|
|
// Implementation of all other PCI images is selected by defining PCI_IMAGE2 through PCI_IMAGE5 regardles of HOST
|
163 |
|
|
// or GUEST implementation.
|
164 |
|
|
`ifdef HOST
|
165 |
|
|
`ifdef NO_CNF_IMAGE
|
166 |
132 |
mihad |
//`define PCI_IMAGE0
|
167 |
18 |
mihad |
`endif
|
168 |
|
|
`endif
|
169 |
|
|
|
170 |
148 |
mihad |
//`define PCI_IMAGE2
|
171 |
|
|
//`define PCI_IMAGE3
|
172 |
|
|
//`define PCI_IMAGE4
|
173 |
|
|
//`define PCI_IMAGE5
|
174 |
18 |
mihad |
|
175 |
|
|
// initial value for PCI image address masks. Address masks can be defined in enabled state,
|
176 |
|
|
// to allow device independent software to detect size of image and map base addresses to
|
177 |
|
|
// memory space. If initial mask for an image is defined as 0, then device independent software
|
178 |
|
|
// won't detect base address implemented and device dependent software will have to configure
|
179 |
|
|
// address masks as well as base addresses!
|
180 |
148 |
mihad |
// Don't define PCI_AMx to 24'hffff_ff for memory images! Use that just for I/O images.
|
181 |
|
|
`define PCI_AM0 24'hffff_f0
|
182 |
|
|
`define PCI_AM1 24'hffff_ff
|
183 |
|
|
`define PCI_AM2 24'hffff_f0
|
184 |
|
|
`define PCI_AM3 24'hffff_f0
|
185 |
|
|
`define PCI_AM4 24'hffff_f0
|
186 |
|
|
`define PCI_AM5 24'hffff_f0
|
187 |
18 |
mihad |
|
188 |
|
|
// initial value for PCI image maping to MEMORY or IO spaces. If initial define is set to 0,
|
189 |
|
|
// then IMAGE with that base address points to MEMORY space, othervise it points ti IO space. D
|
190 |
|
|
// Device independent software sets the base addresses acording to MEMORY or IO maping!
|
191 |
|
|
`define PCI_BA0_MEM_IO 1'b0 // considered only when PCI_IMAGE0 is used as general PCI-WB image!
|
192 |
148 |
mihad |
`define PCI_BA1_MEM_IO 1'b1
|
193 |
18 |
mihad |
`define PCI_BA2_MEM_IO 1'b0
|
194 |
148 |
mihad |
`define PCI_BA3_MEM_IO 1'b0
|
195 |
18 |
mihad |
`define PCI_BA4_MEM_IO 1'b0
|
196 |
148 |
mihad |
`define PCI_BA5_MEM_IO 1'b0
|
197 |
18 |
mihad |
|
198 |
136 |
fr2201 |
// initial value for PCI translation addresses. The initial values
|
199 |
|
|
// are set after reset. When ADDR_TRAN_IMPL is defined then then Images
|
200 |
|
|
// are transleted to this adresses whithout access to pci_ta registers.
|
201 |
148 |
mihad |
`define PCI_TA0 24'h0000_0
|
202 |
|
|
`define PCI_TA1 24'h0000_0
|
203 |
|
|
`define PCI_TA2 24'h0000_0
|
204 |
|
|
`define PCI_TA3 24'h0000_0
|
205 |
|
|
`define PCI_TA4 24'h0000_0
|
206 |
|
|
`define PCI_TA5 24'h0000_0
|
207 |
136 |
fr2201 |
|
208 |
140 |
mihad |
`define PCI_AT_EN0 1'b0
|
209 |
|
|
`define PCI_AT_EN1 1'b0
|
210 |
|
|
`define PCI_AT_EN2 1'b0
|
211 |
|
|
`define PCI_AT_EN3 1'b0
|
212 |
|
|
`define PCI_AT_EN4 1'b0
|
213 |
|
|
`define PCI_AT_EN5 1'b0
|
214 |
|
|
|
215 |
18 |
mihad |
// number defined here specifies how many MS bits in WB address are compared with base address, to decode
|
216 |
|
|
// accesses. Maximum number allows for minimum image size ( number = 20, image size = 4KB ), minimum number
|
217 |
|
|
// allows for maximum image size ( number = 1, image size = 2GB ). If you intend on using different sizes of WB images,
|
218 |
|
|
// you have to define a number of minimum sized image and enlarge others by specifying different address mask.
|
219 |
|
|
// smaller the number here, faster the decoder operation
|
220 |
143 |
mihad |
`define WB_NUM_OF_DEC_ADDR_LINES 1
|
221 |
18 |
mihad |
|
222 |
|
|
// no. of WISHBONE Slave IMAGES
|
223 |
|
|
// WB image 0 is always used for access to configuration space. In case configuration space access is not implemented,
|
224 |
|
|
// ( both GUEST and NO_CNF_IMAGE defined ), then WB image 0 is not implemented. User doesn't need to define image 0.
|
225 |
|
|
// WB Image 1 is always implemented and user doesnt need to specify its definition
|
226 |
|
|
// WB images' 2 through 5 implementation by defining each one.
|
227 |
132 |
mihad |
`define WB_IMAGE2
|
228 |
148 |
mihad |
//`define WB_IMAGE3
|
229 |
|
|
//`define WB_IMAGE4
|
230 |
|
|
//`define WB_IMAGE5
|
231 |
143 |
mihad |
|
232 |
136 |
fr2201 |
//Address bar register defines the base address for each image.
|
233 |
|
|
//To asccess bus without Software configuration.
|
234 |
137 |
fr2201 |
`define WB_BA1 20'h0000_0
|
235 |
148 |
mihad |
`define WB_BA2 20'h8000_0
|
236 |
137 |
fr2201 |
`define WB_BA3 20'h0000_0
|
237 |
|
|
`define WB_BA4 20'h0000_0
|
238 |
|
|
`define WB_BA5 20'h0000_0
|
239 |
18 |
mihad |
|
240 |
136 |
fr2201 |
// initial value for WB image maping to MEMORY or IO spaces. If initial define is set to 0,
|
241 |
|
|
// then IMAGE with that base address points to MEMORY space, othervise it points ti IO space.
|
242 |
|
|
`define WB_BA1_MEM_IO 1'b0
|
243 |
|
|
`define WB_BA2_MEM_IO 1'b0
|
244 |
|
|
`define WB_BA3_MEM_IO 1'b0
|
245 |
|
|
`define WB_BA4_MEM_IO 1'b0
|
246 |
|
|
`define WB_BA5_MEM_IO 1'b0
|
247 |
|
|
|
248 |
|
|
// initial value for WB image address masks.
|
249 |
148 |
mihad |
`define WB_AM1 20'h8000_0
|
250 |
|
|
`define WB_AM2 20'h8000_0
|
251 |
137 |
fr2201 |
`define WB_AM3 20'h0000_0
|
252 |
|
|
`define WB_AM4 20'h0000_0
|
253 |
|
|
`define WB_AM5 20'h0000_0
|
254 |
136 |
fr2201 |
|
255 |
|
|
// initial value for WB translation addresses. The initial values
|
256 |
|
|
// are set after reset. When ADDR_TRAN_IMPL is defined then then Images
|
257 |
|
|
// are transleted to this adresses whithout access to pci_ta registers.
|
258 |
137 |
fr2201 |
`define WB_TA1 20'h0000_0
|
259 |
|
|
`define WB_TA2 20'h0000_0
|
260 |
|
|
`define WB_TA3 20'h0000_0
|
261 |
|
|
`define WB_TA4 20'h0000_0
|
262 |
|
|
`define WB_TA5 20'h0000_0
|
263 |
136 |
fr2201 |
|
264 |
140 |
mihad |
`define WB_AT_EN1 1'b0
|
265 |
|
|
`define WB_AT_EN2 1'b0
|
266 |
|
|
`define WB_AT_EN3 1'b0
|
267 |
|
|
`define WB_AT_EN4 1'b0
|
268 |
|
|
`define WB_AT_EN5 1'b0
|
269 |
|
|
|
270 |
18 |
mihad |
// If this define is commented out, then address translation will not be implemented.
|
271 |
|
|
// addresses will pass through bridge unchanged, regardles of address translation enable bits.
|
272 |
|
|
// Address translation also slows down the decoding
|
273 |
136 |
fr2201 |
//When ADDR_TRAN_IMPL this define is present then adress translation is enabled after reset.
|
274 |
143 |
mihad |
//`define ADDR_TRAN_IMPL
|
275 |
18 |
mihad |
|
276 |
|
|
// decode speed for WISHBONE definition - initial cycle on WISHBONE bus will take 1 WS for FAST, 2 WSs for MEDIUM and 3 WSs for slow.
|
277 |
|
|
// slower decode speed can be used, to provide enough time for address to be decoded.
|
278 |
78 |
mihad |
`define WB_DECODE_FAST
|
279 |
|
|
//`define WB_DECODE_MEDIUM
|
280 |
18 |
mihad |
//`define WB_DECODE_SLOW
|
281 |
|
|
|
282 |
|
|
// Base address for Configuration space access from WB bus. This value cannot be changed during runtime
|
283 |
132 |
mihad |
`define WB_CONFIGURATION_BASE 20'h0000_0
|
284 |
18 |
mihad |
|
285 |
|
|
// Turn registered WISHBONE slave outputs on or off
|
286 |
|
|
// all outputs from WB Slave state machine are registered, if this is defined - WB bus outputs as well as
|
287 |
|
|
// outputs to internals of the core.
|
288 |
33 |
mihad |
//`define REGISTER_WBS_OUTPUTS
|
289 |
18 |
mihad |
|
290 |
|
|
/*-----------------------------------------------------------------------------------------------------------
|
291 |
|
|
Core speed definition - used for simulation and 66MHz Capable bit value in status register indicating 66MHz
|
292 |
|
|
capable device
|
293 |
|
|
-----------------------------------------------------------------------------------------------------------*/
|
294 |
148 |
mihad |
`define PCI33
|
295 |
|
|
//`define PCI66
|
296 |
18 |
mihad |
|
297 |
|
|
/*-----------------------------------------------------------------------------------------------------------
|
298 |
|
|
[000h-00Ch] First 4 DWORDs (32-bit) of PCI configuration header - the same regardless of the HEADER type !
|
299 |
|
|
Vendor_ID is an ID for a specific vendor defined by PCI_SIG - 2321h does not belong to anyone (e.g.
|
300 |
|
|
Xilinx's Vendor_ID is 10EEh and Altera's Vendor_ID is 1172h). Device_ID and Revision_ID should be used
|
301 |
|
|
together by application.
|
302 |
|
|
-----------------------------------------------------------------------------------------------------------*/
|
303 |
143 |
mihad |
`define HEADER_VENDOR_ID 16'h1895
|
304 |
|
|
`define HEADER_DEVICE_ID 16'h0001
|
305 |
|
|
`define HEADER_REVISION_ID 8'h01
|
306 |
|
|
`define HEADER_SUBSYS_VENDOR_ID 16'h1895
|
307 |
|
|
`define HEADER_SUBSYS_ID 16'h0001
|
308 |
|
|
`define HEADER_MAX_LAT 8'h1a
|
309 |
|
|
`define HEADER_MIN_GNT 8'h08
|
310 |
18 |
mihad |
|
311 |
|
|
// MAX Retry counter value for WISHBONE Master state-machine
|
312 |
|
|
// This value is 8-bit because of 8-bit retry counter !!!
|
313 |
|
|
`define WB_RTY_CNT_MAX 8'hff
|
314 |
86 |
mihad |
|
315 |
|
|
// define the macro below to disable internal retry generation in the wishbone master interface
|
316 |
|
|
// used when wb master accesses extremly slow devices.
|
317 |
148 |
mihad |
`define PCI_WBM_NO_RESPONSE_CNT_DISABLE
|
318 |
106 |
mihad |
|
319 |
132 |
mihad |
`define PCI_WB_REV_B3
|
320 |
106 |
mihad |
//`define PCI_WBS_B3_RTY_DISABLE
|
321 |
|
|
|
322 |
132 |
mihad |
`ifdef GUEST
|
323 |
148 |
mihad |
// `define PCI_CPCI_HS_IMPLEMENT
|
324 |
|
|
// `define PCI_SPOCI
|
325 |
132 |
mihad |
`endif
|
326 |
143 |
mihad |
|