1 |
746 |
lampret |
//////////////////////////////////////////////////////////////////////
|
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 |
|
|
// Revision 1.1 2002/02/22 20:14:13 tadej
|
43 |
|
|
// User defined constants used for Test Application
|
44 |
|
|
//
|
45 |
|
|
//
|
46 |
|
|
|
47 |
|
|
// Fifo implementation defines:
|
48 |
|
|
// If FPGA and XILINX are defined, Xilinx's BlockSelectRAM+ is instantiated for Fifo storage.
|
49 |
|
|
// 16 bit width is used, so 8 bits of address ( 256 ) locations are available. If RAM_DONT_SHARE is not defined (commented out),
|
50 |
|
|
// 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
|
51 |
|
|
// 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 )
|
52 |
|
|
// 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
|
53 |
|
|
// 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
|
54 |
|
|
// in one clock domain, read in other ), otherwise it must be two port RAM ( read and write ports in both clock domains ).
|
55 |
|
|
// 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
|
56 |
|
|
// WB_FIFO_RAM_ADDR_LENGTH.
|
57 |
|
|
|
58 |
|
|
`define WBW_ADDR_LENGTH 3
|
59 |
|
|
`define WBR_ADDR_LENGTH 6
|
60 |
|
|
`define PCIW_ADDR_LENGTH 4
|
61 |
|
|
`define PCIR_ADDR_LENGTH 4
|
62 |
|
|
|
63 |
|
|
`define FPGA
|
64 |
|
|
`define XILINX
|
65 |
|
|
|
66 |
|
|
//`define WB_RAM_DONT_SHARE
|
67 |
|
|
`define PCI_RAM_DONT_SHARE
|
68 |
|
|
|
69 |
|
|
`ifdef FPGA
|
70 |
|
|
`ifdef XILINX
|
71 |
|
|
`define PCI_FIFO_RAM_ADDR_LENGTH 4 // PCI target unit fifo storage definition
|
72 |
|
|
`define WB_FIFO_RAM_ADDR_LENGTH 8 // WB slave unit fifo storage definition
|
73 |
|
|
//`define PCI_XILINX_RAMB4
|
74 |
|
|
`define WB_XILINX_RAMB4
|
75 |
|
|
`define PCI_XILINX_DIST_RAM
|
76 |
|
|
//`define WB_XILINX_DIST_RAM
|
77 |
|
|
`endif
|
78 |
|
|
`else
|
79 |
|
|
`define PCI_FIFO_RAM_ADDR_LENGTH 8 // PCI target unit fifo storage definition when RAM sharing is used ( both pcir and pciw fifo use same instance of RAM )
|
80 |
|
|
`define WB_FIFO_RAM_ADDR_LENGTH 8 // WB slave unit fifo storage definition when RAM sharing is used ( both wbr and wbw fifo use same instance of RAM )
|
81 |
|
|
`define WB_ARTISAN_SDP
|
82 |
|
|
`define PCI_ARTISAN_SDP
|
83 |
|
|
`endif
|
84 |
|
|
|
85 |
|
|
// these two defines allow user to select active high or low output enables on PCI bus signals, depending on
|
86 |
|
|
// output buffers instantiated. Xilinx FPGAs use active low output enables.
|
87 |
|
|
`define ACTIVE_LOW_OE
|
88 |
|
|
//`define ACTIVE_HIGH_OE
|
89 |
|
|
|
90 |
|
|
// HOST/GUEST implementation selection - see design document and specification for description of each implementation
|
91 |
|
|
// only one can be defined at same time
|
92 |
|
|
`define GUEST
|
93 |
|
|
//`define HOST
|
94 |
|
|
|
95 |
|
|
// if NO_CNF_IMAGE is commented out, then READ-ONLY access to configuration space is ENABLED:
|
96 |
|
|
// - ENABLED Read-Only access from WISHBONE for GUEST bridges
|
97 |
|
|
// - ENABLED Read-Only access from PCI for HOST bridges
|
98 |
|
|
// with defining NO_CNF_IMAGE, one decoder and one multiplexer are saved
|
99 |
|
|
`define NO_CNF_IMAGE
|
100 |
|
|
|
101 |
|
|
// number defined here specifies how many MS bits in PCI address are compared with base address, to decode
|
102 |
|
|
// accesses. Maximum number allows for minimum image size ( number = 20, image size = 4KB ), minimum number
|
103 |
|
|
// allows for maximum image size ( number = 1, image size = 2GB ). If you intend on using different sizes of PCI images,
|
104 |
|
|
// you have to define a number of minimum sized image and enlarge others by specifying different address mask.
|
105 |
|
|
// smaller the number here, faster the decoder operation
|
106 |
|
|
`define PCI_NUM_OF_DEC_ADDR_LINES 8
|
107 |
|
|
|
108 |
|
|
// no. of PCI Target IMAGES
|
109 |
|
|
// - PCI provides 6 base address registers for image implementation.
|
110 |
|
|
// PCI_IMAGE1 definition is not required and has no effect, since PCI image 1 is always implemented
|
111 |
|
|
// If GUEST is defined, PCI Image 0 is also always implemented and is used for configuration space
|
112 |
|
|
// access.
|
113 |
|
|
// If HOST is defined and NO_CNF_IMAGE is not, then PCI Image 0 is used for Read Only access to configuration
|
114 |
|
|
// space. If HOST is defined and NO_CNF_IMAGE is defined, then user can define PCI_IMAGE0 as normal image, and there
|
115 |
|
|
// is no access to Configuration space possible from PCI bus.
|
116 |
|
|
// Implementation of all other PCI images is selected by defining PCI_IMAGE2 through PCI_IMAGE5 regardles of HOST
|
117 |
|
|
// or GUEST implementation.
|
118 |
|
|
`ifdef HOST
|
119 |
|
|
`ifdef NO_CNF_IMAGE
|
120 |
|
|
//`define PCI_IMAGE0
|
121 |
|
|
`endif
|
122 |
|
|
`endif
|
123 |
|
|
|
124 |
|
|
//`define PCI_IMAGE2
|
125 |
|
|
//`define PCI_IMAGE3
|
126 |
|
|
//`define PCI_IMAGE4
|
127 |
|
|
//`define PCI_IMAGE5
|
128 |
|
|
|
129 |
|
|
// initial value for PCI image address masks. Address masks can be defined in enabled state,
|
130 |
|
|
// to allow device independent software to detect size of image and map base addresses to
|
131 |
|
|
// memory space. If initial mask for an image is defined as 0, then device independent software
|
132 |
|
|
// won't detect base address implemented and device dependent software will have to configure
|
133 |
|
|
// address masks as well as base addresses!
|
134 |
|
|
`define PCI_AM0 20'hffff_f
|
135 |
|
|
`define PCI_AM1 20'hffff_f
|
136 |
|
|
`define PCI_AM2 20'hffff_f
|
137 |
|
|
`define PCI_AM3 20'hffff_f
|
138 |
|
|
`define PCI_AM4 20'hffff_f
|
139 |
|
|
`define PCI_AM5 20'hffff_f
|
140 |
|
|
|
141 |
|
|
// initial value for PCI image maping to MEMORY or IO spaces. If initial define is set to 0,
|
142 |
|
|
// then IMAGE with that base address points to MEMORY space, othervise it points ti IO space. D
|
143 |
|
|
// Device independent software sets the base addresses acording to MEMORY or IO maping!
|
144 |
|
|
`define PCI_BA0_MEM_IO 1'b0 // considered only when PCI_IMAGE0 is used as general PCI-WB image!
|
145 |
|
|
`define PCI_BA1_MEM_IO 1'b0
|
146 |
|
|
`define PCI_BA2_MEM_IO 1'b0
|
147 |
|
|
`define PCI_BA3_MEM_IO 1'b0
|
148 |
|
|
`define PCI_BA4_MEM_IO 1'b0
|
149 |
|
|
`define PCI_BA5_MEM_IO 1'b0
|
150 |
|
|
|
151 |
|
|
// number defined here specifies how many MS bits in WB address are compared with base address, to decode
|
152 |
|
|
// accesses. Maximum number allows for minimum image size ( number = 20, image size = 4KB ), minimum number
|
153 |
|
|
// allows for maximum image size ( number = 1, image size = 2GB ). If you intend on using different sizes of WB images,
|
154 |
|
|
// you have to define a number of minimum sized image and enlarge others by specifying different address mask.
|
155 |
|
|
// smaller the number here, faster the decoder operation
|
156 |
|
|
`define WB_NUM_OF_DEC_ADDR_LINES 1
|
157 |
|
|
|
158 |
|
|
// no. of WISHBONE Slave IMAGES
|
159 |
|
|
// WB image 0 is always used for access to configuration space. In case configuration space access is not implemented,
|
160 |
|
|
// ( both GUEST and NO_CNF_IMAGE defined ), then WB image 0 is not implemented. User doesn't need to define image 0.
|
161 |
|
|
// WB Image 1 is always implemented and user doesnt need to specify its definition
|
162 |
|
|
// WB images' 2 through 5 implementation by defining each one.
|
163 |
|
|
//`define WB_IMAGE2
|
164 |
|
|
//`define WB_IMAGE3
|
165 |
|
|
//`define WB_IMAGE4
|
166 |
|
|
//`define WB_IMAGE5
|
167 |
|
|
|
168 |
|
|
// If this define is commented out, then address translation will not be implemented.
|
169 |
|
|
// addresses will pass through bridge unchanged, regardles of address translation enable bits.
|
170 |
|
|
// Address translation also slows down the decoding
|
171 |
|
|
//`define ADDR_TRAN_IMPL
|
172 |
|
|
|
173 |
|
|
// 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.
|
174 |
|
|
// slower decode speed can be used, to provide enough time for address to be decoded.
|
175 |
|
|
`define WB_DECODE_FAST
|
176 |
|
|
//`define WB_DECODE_MEDIUM
|
177 |
|
|
//`define WB_DECODE_SLOW
|
178 |
|
|
|
179 |
|
|
// Base address for Configuration space access from WB bus. This value cannot be changed during runtime
|
180 |
|
|
`define WB_CONFIGURATION_BASE 20'h0000_0
|
181 |
|
|
|
182 |
|
|
// Turn registered WISHBONE slave outputs on or off
|
183 |
|
|
// all outputs from WB Slave state machine are registered, if this is defined - WB bus outputs as well as
|
184 |
|
|
// outputs to internals of the core.
|
185 |
|
|
//`define REGISTER_WBS_OUTPUTS
|
186 |
|
|
|
187 |
|
|
/*-----------------------------------------------------------------------------------------------------------
|
188 |
|
|
Core speed definition - used for simulation and 66MHz Capable bit value in status register indicating 66MHz
|
189 |
|
|
capable device
|
190 |
|
|
-----------------------------------------------------------------------------------------------------------*/
|
191 |
|
|
`define PCI33
|
192 |
|
|
//`define PCI66
|
193 |
|
|
|
194 |
|
|
/*-----------------------------------------------------------------------------------------------------------
|
195 |
|
|
[000h-00Ch] First 4 DWORDs (32-bit) of PCI configuration header - the same regardless of the HEADER type !
|
196 |
|
|
Vendor_ID is an ID for a specific vendor defined by PCI_SIG - 2321h does not belong to anyone (e.g.
|
197 |
|
|
Xilinx's Vendor_ID is 10EEh and Altera's Vendor_ID is 1172h). Device_ID and Revision_ID should be used
|
198 |
|
|
together by application.
|
199 |
|
|
-----------------------------------------------------------------------------------------------------------*/
|
200 |
|
|
`define HEADER_VENDOR_ID 16'h2321
|
201 |
|
|
`define HEADER_DEVICE_ID 16'h0001
|
202 |
|
|
`define HEADER_REVISION_ID 8'h01
|
203 |
|
|
|
204 |
|
|
// Turn registered WISHBONE master outputs on or off
|
205 |
|
|
// all outputs from WB Master state machine are registered, if this is defined - WB bus outputs as well as
|
206 |
|
|
// outputs to internals of the core.
|
207 |
|
|
//`define REGISTER_WBM_OUTPUTS
|
208 |
|
|
|
209 |
|
|
// MAX Retry counter value for WISHBONE Master state-machine
|
210 |
|
|
// This value is 8-bit because of 8-bit retry counter !!!
|
211 |
|
|
`define WB_RTY_CNT_MAX 8'hff
|