OpenCores
URL https://opencores.org/ocsvn/pcie_sg_dma/pcie_sg_dma/trunk

Subversion Repositories pcie_sg_dma

[/] [pcie_sg_dma/] [branches/] [Virtex6/] [ML605_ISE13.3/] [MySource/] [v6abb64Package_efifo_elink.vhd] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 barabba
--      -------------------------------------------------------------
2
--
3
--      Purpose: This package defines supplemental types, subtypes, 
4
--               constants, and functions 
5
--     
6
--     Nov 2008 --> 64-bit
7
-- 
8
 
9
library IEEE;
10
use IEEE.STD_LOGIC_1164.ALL;
11
use IEEE.STD_LOGIC_ARITH.ALL;
12
 
13
package abb64Package is
14
 
15
 
16
  -- Implemet a design with only one FIFO and only one BRAM Module: For Loopback Test!!
17
  constant USE_LOOPBACK_TEST       : boolean   := FALSE;
18
 
19
 
20
-- Declare constants
21
 
22
  -- ----------------------------------------------------------------------
23
  -- Address definitions
24
 
25
  --  The 2 MSB's are for Addressing, i.e.
26
  --
27
  --  0x0000         : Design ID
28
  --  0x0008         : Interrupt status
29
  --  0x0010         : Interrupt enable
30
  --  0x0018         : General error
31
  --  0x0020         : General status
32
  --  0x0028         : General control
33
 
34
  --  0x002C ~ 0x004C: DMA upstream registers
35
  --  0x0050 ~ 0x0070: DMA upstream registers
36
 
37
  --  0x0074         : MRd channel control
38
  --  0x0078         : CplD channel control
39
  --  0x007C         : ICAP input/output
40
 
41
  --  0x0080 ~ 0x008C: Interrupt Generator (IG) registers
42
 
43
  --  0x4010         : TxFIFO write port
44
  --  0x4018         : W - TxFIFO Reset
45
  --                 : R - TxFIFO Vacancy status
46
 
47
  --  0x4020         : RxFIFO read port
48
  --  0x4028         : W - RxFIFO Reset
49
  --                 : R - RxFIFO Occupancy status
50
 
51
  --  0x8000 ~ 0xBFFF: BRAM space (BAR1)
52
 
53
  --  Others         : Reserved
54
 
55
 
56
  ------------------------------------------------------------------------
57
  --  Global Constants
58
  --
59
 
60
  ---       Number of Lanes for PCIe, 1, 4 or 8
61
  Constant  C_NUM_PCIE_LANES      : integer      :=   4;
62
 
63
  ---       Data bus width
64
  Constant  C_DBUS_WIDTH          : integer      :=   64;
65
 
66
  ---       Event Buffer: FIFO Data Count width
67
  Constant  C_FIFO_DC_WIDTH       : integer      :=   26;
68
  ---       Small BRAM FIFO for emulation
69
  Constant  C_EMU_FIFO_DC_WIDTH   : integer      :=   15; --S 14 x fifo originale ; 15 x fifo grande!!
70
 
71
  ---       Address width for endpoint device/peripheral
72
            -- 
73
  Constant  C_EP_AWIDTH           : integer  range 10 to 30
74
                                  :=   16;
75
 
76
  ---       Buffer width from the PCIe Core
77
  Constant  C_TBUF_AWIDTH         : integer      :=   6;  -- 4;  -- 5;
78
 
79
  ---       Width for Tx output Arbitration
80
  Constant  C_ARBITRATE_WIDTH     : integer      :=   4;
81
 
82
  ---       Number of BAR spaces
83
  Constant  CINT_BAR_SPACES       : integer      :=   4;
84
 
85
  ---       Max BAR number, 7
86
  Constant  C_BAR_NUMBER          : integer      :=   7;
87
  ---       Encoded BAR number takes 3 bits to represent 0~6.  7 means invalid or don't care
88
  Constant  C_ENCODE_BAR_NUMBER   : integer      :=   3;
89
 
90
  ---       Number of Channels, currently 4: Interrupt, PIO MRd, upstream DMA, downstream DMA
91
  Constant  C_CHANNEL_NUMBER      : integer      :=   4;
92
 
93
  ---       Data width of the channel buffers (FIFOs)
94
  Constant  C_CHANNEL_BUF_WIDTH   : integer      :=   128;
95
 
96
  ---       Higher 4 bits are for tag decoding
97
  Constant  C_TAG_DECODE_BITS     : integer      :=   4;
98
 
99
  ---       DDR SDRAM bank address pin number
100
  Constant  C_DDR_BANK_AWIDTH     : integer      :=   2;
101
 
102
  ---       DDR SDRAM address pin number
103
  Constant  C_DDR_AWIDTH          : integer      :=   13;
104
 
105
  ---       DDR SDRAM data pin number
106
  Constant  C_DDR_DWIDTH          : integer      :=   16;
107
 
108
  ---       DDR SDRAM module address width, dependent on total DDR memory capacity.
109
            --  128 Mb=  16MB : 24
110
            --  256 Mb=  32MB : 25
111
            --  512 Mb=  64MB : 26
112
            -- 1024 Mb= 128MB : 27
113
            -- 2048 Mb= 256MB : 28
114
  Constant  C_DDR_IAWIDTH         : integer  range 24 to 28
115
                                  :=   26;
116
 
117
 
118
  ---       Block RAM address bus width.  Variation requires BRAM core regeneration.
119
  Constant  C_PRAM_AWIDTH         : integer  range 8 to 28
120
                                  :=   12;
121
 
122
  ---       Width for Interrupt generation counter
123
  Constant  C_CNT_GINT_WIDTH      : integer      :=  30;
124
 
125
 
126
--  ---       Emulation FIFOs' address width
127
--  Constant  C_FIFO_AWIDTH         : integer      :=   5;
128
 
129
  ---       Tag RAM data bus width, 1 bit for AInc information and 3 bits for BAR number
130
  Constant  C_TAGRAM_DWIDTH       : integer      :=   36;
131
 
132
  ---       Configuration command width, e.g. cfg_dcommand, cfg_lcommand.
133
  Constant  C_CFG_COMMAND_DWIDTH  : integer      :=   16;
134
 
135
  ---       Tag RAM address bus width, only 6 bits (of 8) are used for MRd from DMA Write Channel
136
  Constant  C_TAGRAM_AWIDTH       : integer      :=   6;
137
  Constant  C_TAG_MAP_WIDTH       : integer      :=  64;  -- 2^C_TAGRAM_AWIDTH
138
  --        TAG map are partitioned into sub-parts
139
  Constant  C_SUB_TAG_MAP_WIDTH   : integer      :=   8;
140
 
141
  ---       Address_Increment bit is put in tag RAM
142
  Constant  CBIT_AINC_IN_TAGRAM   : integer      :=   C_TAGRAM_DWIDTH-1;
143
 
144
  -- Bit range of BAR field in TAG ram
145
  Constant  C_TAGBAR_BIT_TOP      : integer      :=   CBIT_AINC_IN_TAGRAM-1;
146
  Constant  C_TAGBAR_BIT_BOT      : integer      :=   C_TAGBAR_BIT_TOP-C_ENCODE_BAR_NUMBER+1;
147
 
148
 
149
  ---       Number of bits for Last DW BE and 1st DW BE in the header of a TLP
150
  Constant  C_BE_WIDTH            : integer      :=   4;
151
 
152
 
153
  ---       ICAP width: 8 or 32.
154
  Constant  C_ICAP_WIDTH          : integer      :=   32;
155
 
156
  ---       Feature Bits width
157
  Constant  C_FEAT_BITS_WIDTH     : integer      :=   8;
158
 
159
  ---       Channel lables
160
  Constant  C_CHAN_INDEX_IRPT     : integer      :=   3;
161
  Constant  C_CHAN_INDEX_MRD      : integer      :=   2;
162
  Constant  C_CHAN_INDEX_DMA_DS   : integer      :=   1;
163
  Constant  C_CHAN_INDEX_DMA_US   : integer      :=   0;
164
 
165
  ------------------------------------------------------------------------
166
  --  Bit ranges
167
 
168
  --        Bits range for Max_Read_Request_Size in cfg_dcommand
169
  Constant  C_CFG_MRS_BIT_TOP     : integer      :=   14;
170
  Constant  C_CFG_MRS_BIT_BOT     : integer      :=   12;
171
 
172
  --        Bits range for Max_Payload_Size in cfg_dcommand
173
  Constant  C_CFG_MPS_BIT_TOP     : integer      :=    7;
174
  Constant  C_CFG_MPS_BIT_BOT     : integer      :=    5;
175
 
176
  --        The bit in minimum Max_Read_Request_Size/Max_Payload_Size that is one
177
            --  i.e. 0x80 Bytes = 0x20 DW = "000000100000"
178
  Constant  CBIT_SENSE_OF_MAXSIZE : integer      :=    5;
179
 
180
 
181
-- ------------------------------------------------------------------------
182
--
183
--  Section for TLP headers' bit definition
184
--         ( not shown in user header file)
185
--
186
-- ------------------------------------------------------------------------
187
 
188
--  -- The bit in TLP header #0 that means whether the TLP comes with data
189
--  Constant  CBIT_TLP_HAS_PAYLOAD  : integer      :=   30;
190
 
191
--  -- The bit in TLP header #0 that means whether the TLP has 4-DW header
192
--  Constant  CBIT_TLP_HAS_4DW_HEAD : integer      :=   29;
193
 
194
--  -- The bit in TLP header #0 that means Cpl/CplD
195
--  Constant  C_TLP_CPLD_BIT        : integer      :=   27;
196
 
197
  -- The bit in TLP header #0 that means TLP Digest
198
  Constant  C_TLP_TD_BIT          : integer      :=   15 +32;
199
 
200
  -- The bit in TLP header #0 that means Error Poison
201
  Constant  C_TLP_EP_BIT          : integer      :=   14 +32;
202
 
203
  -- Bit range of Format field in TLP header #0
204
  Constant  C_TLP_FMT_BIT_TOP     : integer      :=   30 +32;    -- TLP has payload
205
  Constant  C_TLP_FMT_BIT_BOT     : integer      :=   29 +32;    -- TLP header has 4 DW
206
 
207
  -- Bit range of Type field in TLP header #0
208
  Constant  C_TLP_TYPE_BIT_TOP    : integer      :=   28 +32;
209
  Constant  C_TLP_TYPE_BIT_BOT    : integer      :=   24 +32;
210
 
211
  -- Bit range of TC field in TLP header #0
212
  Constant  C_TLP_TC_BIT_TOP      : integer      :=   22 +32;
213
  Constant  C_TLP_TC_BIT_BOT      : integer      :=   20 +32;
214
 
215
  -- Bit range of Attribute field in TLP header #0
216
  Constant  C_TLP_ATTR_BIT_TOP    : integer      :=   13 +32;
217
  Constant  C_TLP_ATTR_BIT_BOT    : integer      :=   12 +32;
218
 
219
  -- Bit range of Length field in TLP header #0
220
  Constant  C_TLP_LENG_BIT_TOP    : integer      :=    9 +32;
221
  Constant  C_TLP_LENG_BIT_BOT    : integer      :=    0 +32;
222
 
223
  -- Bit range of Requester ID field in header #1 of non-Cpl/D TLP
224
  Constant  C_TLP_REQID_BIT_TOP   : integer      :=   31;
225
  Constant  C_TLP_REQID_BIT_BOT   : integer      :=   16;
226
 
227
  -- Bit range of Tag field in header #1 of non-Cpl/D TLP
228
  Constant  C_TLP_TAG_BIT_TOP     : integer      :=   15;
229
  Constant  C_TLP_TAG_BIT_BOT     : integer      :=    8;
230
 
231
  -- Bit range of Last BE field in TLP header #1
232
  Constant  C_TLP_LAST_BE_BIT_TOP : integer      :=    7;
233
  Constant  C_TLP_LAST_BE_BIT_BOT : integer      :=    4;
234
 
235
  -- Bit range of 1st BE field in TLP header #1
236
  Constant  C_TLP_1ST_BE_BIT_TOP  : integer      :=    3;
237
  Constant  C_TLP_1ST_BE_BIT_BOT  : integer      :=    0;
238
 
239
  -- Bit range of Completion Status field in Cpl/D TLP header #1
240
  Constant  C_CPLD_CS_BIT_TOP     : integer      :=   15;
241
  Constant  C_CPLD_CS_BIT_BOT     : integer      :=   13;
242
 
243
  -- Bit range of Completion Byte Count field in Cpl/D TLP header #1
244
  Constant  C_CPLD_BC_BIT_TOP     : integer      :=   11;
245
  Constant  C_CPLD_BC_BIT_BOT     : integer      :=    0;
246
 
247
  -- Bit range of Completer ID field in header#1 of Cpl/D TLP
248
  Constant  C_CPLD_CPLT_ID_BIT_TOP : integer      :=   C_TLP_REQID_BIT_TOP;
249
  Constant  C_CPLD_CPLT_ID_BIT_BOT : integer      :=   C_TLP_REQID_BIT_BOT;
250
 
251
  -- Bit range of Requester ID field in header#2 of Cpl/D TLP
252
  Constant  C_CPLD_REQID_BIT_TOP  : integer      :=   31 +32;
253
  Constant  C_CPLD_REQID_BIT_BOT  : integer      :=   16 +32;
254
 
255
  -- Bit range of Completion Tag field in Cpl/D TLP 3rd header
256
  Constant  C_CPLD_TAG_BIT_TOP    : integer      :=   C_TLP_TAG_BIT_TOP +32;
257
  Constant  C_CPLD_TAG_BIT_BOT    : integer      :=   C_TLP_TAG_BIT_BOT +32;
258
 
259
  -- Bit range of Completion Lower Address field in Cpl/D TLP 3rd header
260
  Constant  C_CPLD_LA_BIT_TOP     : integer      :=    6 +32;
261
  Constant  C_CPLD_LA_BIT_BOT     : integer      :=    0 +32;
262
 
263
 
264
  -- Bit range of Message Code field in Msg 2nd header
265
  Constant  C_MSG_CODE_BIT_TOP    : integer      :=    7;
266
  Constant  C_MSG_CODE_BIT_BOT    : integer      :=    0;
267
 
268
 
269
 
270
  -- ----------------------------------------------------------------------
271
  -- TLP field widths
272
  -- For PCIe, the length field is 10 bits wide.
273
  Constant  C_TLP_FLD_WIDTH_OF_LENG      : integer
274
                                         := C_TLP_LENG_BIT_TOP-C_TLP_LENG_BIT_BOT+1;
275
 
276
  ------------------------------------------------------------------------
277
  ---       Tag width in TLP
278
  Constant  C_TAG_WIDTH                  : integer
279
                                         := C_TLP_TAG_BIT_TOP-C_TLP_TAG_BIT_BOT+1;
280
 
281
  ------------------------------------------------------------------------
282
  ---       Width for Local ID
283
  Constant  C_ID_WIDTH                   : integer
284
                                         := C_TLP_REQID_BIT_TOP-C_TLP_REQID_BIT_BOT+1;
285
 
286
  ------------------------------------------------------------------------
287
  ---       Width for Requester ID
288
  Constant  C_REQID_WIDTH                : integer
289
                                         := C_TLP_REQID_BIT_TOP-C_TLP_REQID_BIT_BOT+1;
290
 
291
-- ------------------------------------------------------------------------
292
-- Section for Channel Buffer bit definition, referenced to TLP header definition
293
--         ( not shown in user header file)
294
--
295
-- ------------------------------------------------------------------------
296
 
297
 
298
  -- Bit range of Length field in Channel Buffer word
299
  Constant  C_CHBUF_LENG_BIT_BOT       : integer      :=    0;
300
  Constant  C_CHBUF_LENG_BIT_TOP       : integer      :=    C_CHBUF_LENG_BIT_BOT+C_TLP_FLD_WIDTH_OF_LENG-1;  -- 9
301
 
302
  -- Bit range of Attribute field in Channel Buffer word
303
  Constant  C_CHBUF_ATTR_BIT_BOT       : integer      :=   C_CHBUF_LENG_BIT_TOP+1; --10;
304
  Constant  C_CHBUF_ATTR_BIT_TOP       : integer      :=   C_CHBUF_ATTR_BIT_BOT+C_TLP_ATTR_BIT_TOP-C_TLP_ATTR_BIT_BOT; --11;
305
 
306
  -- The bit in Channel Buffer word that means Error Poison
307
  Constant  C_CHBUF_EP_BIT             : integer      :=   C_CHBUF_ATTR_BIT_TOP+1; --12;
308
 
309
  -- The bit in Channel Buffer word that means TLP Digest
310
  Constant  C_CHBUF_TD_BIT             : integer      :=   C_CHBUF_EP_BIT+1; --13;
311
 
312
  -- Bit range of TC field in Channel Buffer word
313
  Constant  C_CHBUF_TC_BIT_BOT         : integer      :=   C_CHBUF_TD_BIT+1; --14;
314
  Constant  C_CHBUF_TC_BIT_TOP         : integer      :=   C_CHBUF_TC_BIT_BOT+C_TLP_TC_BIT_TOP-C_TLP_TC_BIT_BOT; --16;
315
 
316
  -- Bit range of Format field in Channel Buffer word
317
  Constant  C_CHBUF_FMT_BIT_BOT        : integer      :=   C_CHBUF_TC_BIT_TOP+1; --17;
318
  Constant  C_CHBUF_FMT_BIT_TOP        : integer      :=   C_CHBUF_FMT_BIT_BOT+C_TLP_FMT_BIT_TOP-C_TLP_FMT_BIT_BOT; --18;
319
 
320
 
321
  -- Bit range of Tag field in Channel Buffer word except Cpl/D
322
  Constant  C_CHBUF_TAG_BIT_BOT        : integer      :=   C_CHBUF_FMT_BIT_TOP+1; --19;
323
  Constant  C_CHBUF_TAG_BIT_TOP        : integer      :=   C_CHBUF_TAG_BIT_BOT+C_TLP_TAG_BIT_TOP-C_TLP_TAG_BIT_BOT; --26;
324
 
325
  -- Bit range of BAR Index field in upstream DMA Channel Buffer word
326
  Constant  C_CHBUF_DMA_BAR_BIT_BOT    : integer      :=   C_CHBUF_TAG_BIT_TOP+1; --27;
327
  Constant  C_CHBUF_DMA_BAR_BIT_TOP    : integer      :=   C_CHBUF_DMA_BAR_BIT_BOT+C_ENCODE_BAR_NUMBER-1; --29;
328
 
329
  -- Bit range of Message Code field in Channel Buffer word for Msg
330
  Constant  C_CHBUF_MSG_CODE_BIT_BOT   : integer      :=   C_CHBUF_TAG_BIT_TOP+1; --27;
331
  Constant  C_CHBUF_MSG_CODE_BIT_TOP   : integer      :=   C_CHBUF_MSG_CODE_BIT_BOT+C_MSG_CODE_BIT_TOP-C_MSG_CODE_BIT_BOT; --34;
332
 
333
 
334
  -- Bit range of remaining Byte Count field in Cpl/D Channel Buffer word
335
  Constant  C_CHBUF_CPLD_BC_BIT_BOT    : integer      :=   C_CHBUF_FMT_BIT_TOP+1; --19;
336
  Constant  C_CHBUF_CPLD_BC_BIT_TOP    : integer      :=   C_CHBUF_CPLD_BC_BIT_BOT+C_TLP_FLD_WIDTH_OF_LENG-1+2;  --30;
337
 
338
  -- Bit range of Completion Status field in Cpl/D Channel Buffer word
339
  Constant  C_CHBUF_CPLD_CS_BIT_BOT    : integer      :=   C_CHBUF_CPLD_BC_BIT_TOP+1; --31;
340
  Constant  C_CHBUF_CPLD_CS_BIT_TOP    : integer      :=   C_CHBUF_CPLD_CS_BIT_BOT+C_CPLD_CS_BIT_TOP-C_CPLD_CS_BIT_BOT;  --33;
341
 
342
  -- Bit range of Lower Address field in Cpl/D Channel Buffer word
343
  Constant  C_CHBUF_CPLD_LA_BIT_BOT    : integer      :=   C_CHBUF_CPLD_CS_BIT_TOP+1; --34;
344
  Constant  C_CHBUF_CPLD_LA_BIT_TOP    : integer      :=   C_CHBUF_CPLD_LA_BIT_BOT+C_CPLD_LA_BIT_TOP-C_CPLD_LA_BIT_BOT; --40;
345
 
346
  -- Bit range of Tag field in Cpl/D Channel Buffer word
347
  Constant  C_CHBUF_CPLD_TAG_BIT_BOT   : integer      :=   C_CHBUF_CPLD_LA_BIT_TOP+1;  --41;
348
  Constant  C_CHBUF_CPLD_TAG_BIT_TOP   : integer      :=   C_CHBUF_CPLD_TAG_BIT_BOT+C_CPLD_TAG_BIT_TOP-C_CPLD_TAG_BIT_BOT; --48;
349
 
350
  -- Bit range of Requester ID field in Cpl/D Channel Buffer word
351
  Constant  C_CHBUF_CPLD_REQID_BIT_BOT : integer      :=   C_CHBUF_CPLD_TAG_BIT_TOP+1; --49;
352
  Constant  C_CHBUF_CPLD_REQID_BIT_TOP : integer      :=   C_CHBUF_CPLD_REQID_BIT_BOT+C_CPLD_REQID_BIT_TOP-C_CPLD_REQID_BIT_BOT;  --64;
353
 
354
 
355
 
356
  -- Bit range of BAR Index field in Cpl/D Channel Buffer word
357
  Constant  C_CHBUF_CPLD_BAR_BIT_BOT   : integer      :=   C_CHBUF_CPLD_REQID_BIT_TOP+1; --65;
358
  Constant  C_CHBUF_CPLD_BAR_BIT_TOP   : integer      :=   C_CHBUF_CPLD_BAR_BIT_BOT+C_ENCODE_BAR_NUMBER-1; --67;
359
 
360
 
361
  -- Bit range of host address in Channel Buffer word
362
  Constant  C_CHBUF_HA_BIT_BOT         : integer      :=   C_CHBUF_DMA_BAR_BIT_TOP+1;  --30;
363
--  Constant  C_CHBUF_HA_BIT_TOP         : integer      :=   C_CHBUF_HA_BIT_BOT+2*C_DBUS_WIDTH-1;  --93;
364
  Constant  C_CHBUF_HA_BIT_TOP         : integer      :=   C_CHBUF_HA_BIT_BOT+C_DBUS_WIDTH-1;  --93;
365
 
366
 
367
  -- The bit in Channel Buffer word that means whether this TLP is valid for output arbitration
368
  --        (against channel buffer reset during arbitration)
369
  Constant  C_CHBUF_QVALID_BIT         : integer      :=   C_CHBUF_HA_BIT_TOP+1; --94;
370
 
371
  -- The bit in Channel Buffer word that means address increment
372
  Constant  C_CHBUF_AINC_BIT           : integer      :=   C_CHBUF_QVALID_BIT+1; --95;
373
 
374
  -- The bit in Channel Buffer word that means zero-length
375
  Constant  C_CHBUF_0LENG_BIT          : integer      :=   C_CHBUF_AINC_BIT+1;   --96;
376
 
377
 
378
 
379
  -- Bit range of peripheral address in Channel Buffer word
380
  Constant  C_CHBUF_PA_BIT_BOT         : integer      :=  C_CHANNEL_BUF_WIDTH-C_EP_AWIDTH;  --112;
381
  Constant  C_CHBUF_PA_BIT_TOP         : integer      :=  C_CHANNEL_BUF_WIDTH-1; --127;
382
 
383
 
384
  -- Bit range of BRAM address in Channel Buffer word
385
  Constant  C_CHBUF_MA_BIT_BOT         : integer      :=  C_CHANNEL_BUF_WIDTH-C_PRAM_AWIDTH-2;  --114;
386
  Constant  C_CHBUF_MA_BIT_TOP         : integer      :=  C_CHANNEL_BUF_WIDTH-1; --127;
387
 
388
  -- Bit range of DDR address in Channel Buffer word
389
  Constant  C_CHBUF_DDA_BIT_BOT         : integer      :=  C_CHANNEL_BUF_WIDTH-C_DDR_IAWIDTH;  --102;
390
  Constant  C_CHBUF_DDA_BIT_TOP         : integer      :=  C_CHANNEL_BUF_WIDTH-1; --127;
391
 
392
 
393
 
394
  ------------------------------------------------------------------------
395
  -- The Relaxed Ordering bit constant in TLP
396
  Constant  C_RELAXED_ORDERING           : std_logic
397
                                         := '0';
398
 
399
  -- The NO SNOOP bit constant in TLP
400
  Constant  C_NO_SNOOP                   : std_logic
401
                                         := '0'; -- '1';
402
 
403
  -- AK, 2007-11-07: SNOOP-bit corrupts DMA, if set on INTEL platform. Seems to be don't care on AMD
404
 
405
  ------------------------------------------------------------------------
406
  -- TLP resolution concerning Format
407
  Constant  C_FMT3_NO_DATA               : std_logic_vector(C_TLP_FMT_BIT_TOP downto C_TLP_FMT_BIT_BOT)
408
                                         := "00";
409
  Constant  C_FMT3_WITH_DATA             : std_logic_vector(C_TLP_FMT_BIT_TOP downto C_TLP_FMT_BIT_BOT)
410
                                         := "10";
411
 
412
  Constant  C_FMT4_NO_DATA               : std_logic_vector(C_TLP_FMT_BIT_TOP downto C_TLP_FMT_BIT_BOT)
413
                                         := "01";
414
  Constant  C_FMT4_WITH_DATA             : std_logic_vector(C_TLP_FMT_BIT_TOP downto C_TLP_FMT_BIT_BOT)
415
                                         := "11";
416
 
417
  -- TLP resolution concerning Type
418
  Constant  C_TYPE_MEM_REQ               : std_logic_vector(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT)
419
                                         := "00000";
420
  Constant  C_TYPE_IO_REQ                : std_logic_vector(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT)
421
                                         := "00010";
422
 
423
  Constant  C_TYPE_MEM_REQ_LK            : std_logic_vector(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT)
424
                                         := "00001";
425
  Constant  C_TYPE_COMPLETION            : std_logic_vector(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT)
426
                                         := "01010";
427
  Constant  C_TYPE_COMPLETION_LK         : std_logic_vector(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT)
428
                                         := "01011";
429
 
430
  Constant  C_TYPE_MSG_TO_ROOT           : std_logic_vector(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT)
431
                                         := "10000";
432
  Constant  C_TYPE_MSG_BY_ADDRESS        : std_logic_vector(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT)
433
                                         := "10001";
434
  Constant  C_TYPE_MSG_BY_ID             : std_logic_vector(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT)
435
                                         := "10010";
436
  Constant  C_TYPE_MSG_FROM_ROOT         : std_logic_vector(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT)
437
                                         := "10011";
438
  Constant  C_TYPE_MSG_LOCAL             : std_logic_vector(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT)
439
                                         := "10100";
440
  Constant  C_TYPE_MSG_GATHER_TO_ROOT    : std_logic_vector(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT)
441
                                         := "10101";
442
 
443
  --  Select this constant to test system response
444
  Constant  C_TYPE_OF_MSG                : std_logic_vector(C_TLP_TYPE_BIT_TOP downto C_TLP_TYPE_BIT_BOT)
445
                                         := C_TYPE_MSG_LOCAL;   -- C_TYPE_MSG_TO_ROOT;
446
 
447
  ------------------------------------------------------------------------
448
  -- Lowest priority for Tx_Output_Arbitration module
449
  Constant  C_LOWEST_PRIORITY            :  std_logic_vector (C_ARBITRATE_WIDTH-1 downto 0)
450
                                         := (0=>'1', OTHERS=>'0');
451
 
452
  ------------------------------------------------------------------------
453
  Constant  C_DECODE_BIT_TOP             : integer      :=   C_EP_AWIDTH-1;       -- 15;
454
  Constant  C_DECODE_BIT_BOT             : integer      :=   C_DECODE_BIT_TOP-1;  -- 14;
455
 
456
 
457
  ------------------------------------------------------------------------
458
  -- Current buffer descriptor length is 8 DW.
459
  Constant  C_NEXT_BD_LENGTH             : std_logic_vector(C_TLP_FLD_WIDTH_OF_LENG+1 downto 0)
460
                                         := CONV_STD_LOGIC_VECTOR(8*4, C_TLP_FLD_WIDTH_OF_LENG+2);
461
 
462
  --  Maximum 8 DW for the CplD carrying next BDA
463
  Constant  C_NEXT_BD_LENG_MSB           : integer      := 3;
464
 
465
  ------------------------------------------------------------------------
466
  --  To determine the max.size parameters, 6 bits are used.
467
  Constant  C_MAXSIZE_FLD_BIT_TOP        : integer      := C_TLP_FLD_WIDTH_OF_LENG +2;
468
  Constant  C_MAXSIZE_FLD_BIT_BOT        : integer      := 7;
469
 
470
 
471
  -- DDR commands: RASn-CASn-WEn
472
  Constant  CMD_NOP             : std_logic_vector(2 downto 0)  :=  "111";
473
  Constant  CMD_LMR             : std_logic_vector(2 downto 0)  :=  "000";
474
  Constant  CMD_ACT             : std_logic_vector(2 downto 0)  :=  "011";
475
  Constant  CMD_READ            : std_logic_vector(2 downto 0)  :=  "101";
476
  Constant  CMD_WRITE           : std_logic_vector(2 downto 0)  :=  "100";
477
  Constant  CMD_PRECH           : std_logic_vector(2 downto 0)  :=  "010";
478
  Constant  CMD_BTERM           : std_logic_vector(2 downto 0)  :=  "110";
479
  Constant  CMD_AREF            : std_logic_vector(2 downto 0)  :=  "001";
480
 
481
 
482
  ------------------------------------------------------------------------
483
  --  Time-out counter width
484
  Constant  C_TOUT_WIDTH                 : integer      := 32;
485
 
486
  --  Bottom bit for determining time-out
487
  Constant  CBIT_TOUT_BOT                : integer      := 16;
488
 
489
  --  Time-out value
490
  Constant  C_TIME_OUT_VALUE             : std_logic_vector(C_TOUT_WIDTH-1 downto CBIT_TOUT_BOT)
491
--                                         := (OTHERS=>'1' );  -- Maximum value (-1)
492
                                         := (24=>'1', OTHERS=>'0' );
493
 
494
  ----------------------------------------------------------------------------------
495
  Constant  C_REGS_BASE_ADDR             : std_logic_vector(C_EP_AWIDTH-1 downto 0)
496
                                                        := (C_DECODE_BIT_TOP => '0'
497
                                                          , C_DECODE_BIT_BOT => '0'
498
                                                          , OTHERS => '0' );
499
 
500
  Constant  C_BRAM_BASE_ADDR             : std_logic_vector(C_EP_AWIDTH-1 downto 0)
501
                                                        := (C_DECODE_BIT_TOP => '1'
502
                                                          , C_DECODE_BIT_BOT => '0'
503
                                                          , OTHERS => '0' );
504
 
505
  Constant  C_FIFO_BASE_ADDR             : std_logic_vector(C_EP_AWIDTH-1 downto 0)
506
                                                        := (C_DECODE_BIT_TOP => '0'
507
                                                          , C_DECODE_BIT_BOT => '0'
508
                                                          , OTHERS => '0' );
509
 
510
 
511
  ----------------------------------------------------------------------------------
512
--  Constant  CINT_ADDR_TXFIFO_DATA  : integer  := 4;
513
--  Constant  CINT_ADDR_TXFIFO_CTRL  : integer  := 6;
514
--  Constant  CINT_ADDR_TXFIFO_STA   : integer  := 6;
515
--
516
--  Constant  CINT_ADDR_RXFIFO_DATA  : integer  := 8;
517
--  Constant  CINT_ADDR_RXFIFO_CTRL  : integer  := 10;
518
--  Constant  CINT_ADDR_RXFIFO_STA   : integer  := 10;
519
 
520
  Constant  CINT_REGS_SPACE_BAR    : integer  := 0;
521
  Constant  CINT_FIFO_SPACE_BAR    : integer  := 2;
522
  Constant  CINT_BRAM_SPACE_BAR    : integer  := 3;
523
  Constant  CINT_DDR_SPACE_BAR     : integer  := 1;
524
  ------------------------------------------------------------------------
525
 
526
 
527
--  -- Default channel buffer word for CplD
528
--  Constant  C_DEF_CPLD_WORD        : std_logic_vector(C_DBUS_WIDTH-1 downto 0)
529
--                                   :=X"CA000000";
530
 
531
  ----------------------------------------------------------------------------------
532
  --  1st word of MRd, for requesting the next descriptor
533
--  Constant  C_MRD_HEAD0_WORD       : std_logic_vector(C_DBUS_WIDTH-1 downto 0)
534
--                                   := X"80000000";
535
  Constant  C_TLP_HAS_DATA         : std_logic
536
                                   := '1';
537
  Constant  C_TLP_HAS_NO_DATA      : std_logic
538
                                   := '0';
539
  Constant  C_TLP_3DW_HEADER       : std_logic
540
                                   := '0';
541
  Constant  C_TLP_4DW_HEADER       : std_logic
542
                                   := '1';
543
 
544
  ------------------------------------------------------------------------
545
  Constant  C_TLP_TYPE_IS_MRD_H3   : std_logic_vector(3 downto 0)
546
                                   := "1000";
547
  Constant  C_TLP_TYPE_IS_MRDLK_H3 : std_logic_vector(3 downto 0)
548
                                   := "0100";
549
  Constant  C_TLP_TYPE_IS_MRD_H4   : std_logic_vector(3 downto 0)
550
                                   := "0010";
551
  Constant  C_TLP_TYPE_IS_MRDLK_H4 : std_logic_vector(3 downto 0)
552
                                   := "0001";
553
 
554
  Constant  C_TLP_TYPE_IS_MWR_H3   : std_logic_vector(1 downto 0)
555
                                   := "10";
556
  Constant  C_TLP_TYPE_IS_MWR_H4   : std_logic_vector(1 downto 0)
557
                                   := "01";
558
 
559
  Constant  C_TLP_TYPE_IS_CPLD     : std_logic_vector(3 downto 0)
560
                                   := "1000";
561
  Constant  C_TLP_TYPE_IS_CPL      : std_logic_vector(3 downto 0)
562
                                   := "0100";
563
  Constant  C_TLP_TYPE_IS_CPLDLK   : std_logic_vector(3 downto 0)
564
                                   := "0010";
565
  Constant  C_TLP_TYPE_IS_CPLLK    : std_logic_vector(3 downto 0)
566
                                   := "0001";
567
 
568
  ------------------------------------------------------------------------
569
  --        Maximal number of Interrupts
570
  Constant  C_NUM_OF_INTERRUPTS    : integer  := 16;
571
 
572
 
573
  ------------------------------------------------------------------------
574
    -- Minimal register set 
575
  Constant  CINT_ADDR_VERSION      : integer  := 0;
576
 
577
  Constant  CINT_ADDR_IRQ_STAT     : integer  := 2;
578
 
579
  -- IRQ Enable. Write '1' turns on the interrupt, '0' masks.
580
 
581
  Constant  CINT_ADDR_IRQ_EN       : integer  := 4;
582
 
583
  Constant  CINT_ADDR_ERROR        : integer  := 6;   -- unused
584
 
585
  Constant  CINT_ADDR_STATUS       : integer  := 8;
586
 
587
  Constant  CINT_ADDR_CONTROL      : integer  := 10;
588
 
589
  -- Upstream DMA channel Constants
590
  Constant  CINT_ADDR_DMA_US_PAH   : integer  := 11;
591
 
592
  Constant  CINT_ADDR_DMA_US_PAL   : integer  := 12;
593
 
594
  Constant  CINT_ADDR_DMA_US_HAH   : integer  := 13;
595
 
596
  Constant  CINT_ADDR_DMA_US_HAL   : integer  := 14;
597
 
598
  Constant  CINT_ADDR_DMA_US_BDAH  : integer  := 15;
599
 
600
  Constant  CINT_ADDR_DMA_US_BDAL  : integer  := 16;
601
 
602
  Constant  CINT_ADDR_DMA_US_LENG  : integer  := 17;
603
 
604
  Constant  CINT_ADDR_DMA_US_CTRL  : integer  := 18;
605
 
606
  Constant  CINT_ADDR_DMA_US_STA   : integer  := 19;
607
 
608
 
609
  -- Downstream DMA channel Constants
610
  Constant  CINT_ADDR_DMA_DS_PAH   : integer  := 20;
611
 
612
  Constant  CINT_ADDR_DMA_DS_PAL   : integer  := 21;
613
 
614
  Constant  CINT_ADDR_DMA_DS_HAH   : integer  := 22;
615
 
616
  Constant  CINT_ADDR_DMA_DS_HAL   : integer  := 23;
617
 
618
  Constant  CINT_ADDR_DMA_DS_BDAH  : integer  := 24;
619
 
620
  Constant  CINT_ADDR_DMA_DS_BDAL  : integer  := 25;
621
 
622
  Constant  CINT_ADDR_DMA_DS_LENG  : integer  := 26;
623
 
624
  Constant  CINT_ADDR_DMA_DS_CTRL  : integer  := 27;
625
 
626
  Constant  CINT_ADDR_DMA_DS_STA   : integer  := 28;
627
 
628
 
629
  --------  Address for MRd channel control
630
  Constant  CINT_ADDR_MRD_CTRL     : integer  := 29;
631
 
632
  --------  Address for Tx module control
633
  Constant  CINT_ADDR_TX_CTRL      : integer  := 30;
634
 
635
  --------  Address for ICAP access
636
  Constant  CINT_ADDR_ICAP         : integer  := 31;
637
 
638
 
639
 
640
  --------  Address of Interrupt Generator Control (W)
641
  Constant  CINT_ADDR_IG_CONTROL      : integer  := 32;
642
 
643
  --------  Address of Interrupt Generator Latency (W+R)
644
  Constant  CINT_ADDR_IG_LATENCY      : integer  := 33;
645
 
646
  --------  Address of Interrupt Generator Assert Number (R)
647
  Constant  CINT_ADDR_IG_NUM_ASSERT   : integer  := 34;
648
 
649
  --------  Address of Interrupt Generator Deassert Number (R)
650
  Constant  CINT_ADDR_IG_NUM_DEASSERT : integer  := 35;
651
 
652
 
653
  --------  Event Buffer FIFO status (R) + control (W)
654
  Constant  CINT_ADDR_EB_STACON       : integer  := 36;
655
 
656
  --------  Upstream DMA transferred byte count (R)
657
  Constant  CINT_ADDR_US_TRANSF_BC       : integer  := 37;
658
  --------  Downstream DMA transferred byte count (R)
659
  Constant  CINT_ADDR_DS_TRANSF_BC       : integer  := 38;
660
 
661
  --------  DCB protocol link status (R) + control (W)
662
  Constant  CINT_ADDR_PROTOCOL_STACON    : integer  := 39;
663
 
664
  --------  CTL class register rx(R) + tx (W)
665
  Constant  CINT_ADDR_CTL_CLASS          : integer  := 40;
666
 
667
  --------  DLM class register rx(R) + tx (W)
668
  Constant  CINT_ADDR_DLM_CLASS          : integer  := 41;
669
 
670
  --------  Data generator control register (W)
671
  Constant  CINT_ADDR_DG_CTRL            : integer  := 42;
672
 
673
  --------  Traffice classes status (R)
674
  Constant  CINT_ADDR_TC_STATUS          : integer  := 43;
675
 
676
  --------  SIMONE USER REGISTER 01 rx(R) + tx (W)
677
  Constant  CINT_ADDR_REG01              : integer  := 44;
678
 
679
  --------  SIMONE USER REGISTER 02 rx(R) + tx (W)
680
  Constant  CINT_ADDR_REG02              : integer  := 45;
681
 
682
  --------  SIMONE USER REGISTER 03 rx(R) + tx (W)
683
  Constant  CINT_ADDR_REG03              : integer  := 46;
684
 
685
  --------  SIMONE USER REGISTER 04 rx(R) + tx (W)
686
  Constant  CINT_ADDR_REG04              : integer  := 47;
687
 
688
  --------  SIMONE USER REGISTER 05 rx(R) + tx (W)
689
  Constant  CINT_ADDR_REG05              : integer  := 48;
690
 
691
  --------  SIMONE USER REGISTER 06 rx(R) + tx (W)
692
  Constant  CINT_ADDR_REG06              : integer  := 49;
693
 
694
  --------  SIMONE USER REGISTER 07 rx(R) + tx (W)
695
  Constant  CINT_ADDR_REG07              : integer  := 50;
696
 
697
  --------  SIMONE USER REGISTER 08 rx(R) + tx (W)
698
  Constant  CINT_ADDR_REG08              : integer  := 51;
699
 
700
  --------  SIMONE USER REGISTER 09 rx(R) + tx (W)
701
  Constant  CINT_ADDR_REG09              : integer  := 52;
702
 
703
  --------  SIMONE USER REGISTER 10 rx(R) + tx (W)
704
  Constant  CINT_ADDR_REG10              : integer  := 53;
705
 
706
  --------  Host2Board FIFO status (R) 
707
  Constant  CINT_ADDR_H2B_STACON       : integer  := 54;
708
 
709
  --------  Board2Host FIFO status (R) 
710
  Constant  CINT_ADDR_B2H_STACON       : integer  := 55;
711
 
712
  --------  SIMONE USER REGISTER 11 rx(R) + tx (W)
713
  Constant  CINT_ADDR_REG11              : integer  := 56;
714
 
715
  --------  SIMONE USER REGISTER 12 rx(R) + tx (W)
716
  Constant  CINT_ADDR_REG12              : integer  := 57;
717
 
718
  --------  SIMONE USER REGISTER 13 rx(R) + tx (W)
719
  Constant  CINT_ADDR_REG13              : integer  := 58;
720
 
721
  --------  SIMONE USER REGISTER 14 rx(R) + tx (W)
722
  Constant  CINT_ADDR_REG14              : integer  := 59;
723
 
724
  ------------------------------------------------------------------------
725
  --        Number of registers
726
  Constant  C_NUM_OF_ADDRESSES           : integer  := 60;
727
  -- 
728
  ------------------------------------------------------------------------
729
 
730
 
731
  -- ----------------------------------------------------------------------
732
  -- Bit definitions of the Control register for DMA channels
733
  --
734
  Constant  CINT_BIT_DMA_CTRL_VALID        : integer      :=   25;
735
  Constant  CINT_BIT_DMA_CTRL_LAST         : integer      :=   24;
736
  Constant  CINT_BIT_DMA_CTRL_UPA          : integer      :=   20;
737
  Constant  CINT_BIT_DMA_CTRL_AINC         : integer      :=   15;
738
  Constant  CINT_BIT_DMA_CTRL_END          : integer      :=   08;
739
 
740
  -- Bit range of BAR field in DMA Control register
741
  Constant  CINT_BIT_DMA_CTRL_BAR_TOP      : integer      :=   18;
742
  Constant  CINT_BIT_DMA_CTRL_BAR_BOT      : integer      :=   16;
743
 
744
 
745
  --  Default DMA Control register value
746
--  Constant  C_DEF_DMA_CTRL_WORD    : std_logic_vector(C_DBUS_WIDTH-1 downto 0)
747
  Constant  C_DEF_DMA_CTRL_WORD    : std_logic_vector(C_DBUS_WIDTH-1 downto 0)
748
                                   := (CINT_BIT_DMA_CTRL_VALID => '1' ,
749
                                       CINT_BIT_DMA_CTRL_END   => '1' ,
750
                                       OTHERS                  => '0'
751
                                      );
752
 
753
  ------------------------------------------------------------------------
754
  Constant  C_CHANNEL_RST_BITS     : std_logic_vector(C_FEAT_BITS_WIDTH-1 downto 0)
755
                                   := X"0A";
756
 
757
  ------------------------------------------------------------------------
758
  Constant  C_HOST_ICLR_BITS       : std_logic_vector(C_FEAT_BITS_WIDTH-1 downto 0)
759
                                   := X"F0";
760
 
761
  ----------------------------------------------------------------------------------
762
  -- Initial MWr Tag for upstream DMA
763
  Constant  C_TAG0_DMA_US_MWR      : std_logic_vector(C_TAG_WIDTH-1 downto 0)
764
                                   := X"D0";
765
 
766
  -- Initial MRd Tag for upstream DMA descriptor
767
  Constant  C_TAG0_DMA_USB         : std_logic_vector(C_TAG_WIDTH-1 downto 0)
768
                                   := X"E0";
769
 
770
  -- Initial MRd Tag for downstream DMA descriptor
771
  Constant  C_TAG0_DMA_DSB         : std_logic_vector(C_TAG_WIDTH-1 downto  0)
772
                                   := X"C0";
773
 
774
  -- Initial Msg Tag Hihger 4 bits for interrupt
775
  Constant  C_MSG_TAG_HI           : std_logic_vector( 3 downto 0)
776
                                   := X"F";
777
  -- Msg code for IntA (fixed by PCIe)
778
  Constant  C_MSGCODE_INTA         : std_logic_vector( 7 downto 0)
779
                                   := X"20";
780
  -- Msg code for #IntA  (fixed by PCIe)
781
  Constant  C_MSGCODE_INTA_N       : std_logic_vector( 7 downto 0)
782
                                   := X"24";
783
 
784
  ----------------------------------------------------------------------------------
785
  -- DMA status bit definition
786
  Constant  CINT_BIT_DMA_STAT_NALIGN   : integer  := 7;
787
  Constant  CINT_BIT_DMA_STAT_TIMEOUT  : integer  := 4;
788
  Constant  CINT_BIT_DMA_STAT_BDANULL  : integer  := 3;
789
  Constant  CINT_BIT_DMA_STAT_BUSY     : integer  := 1;
790
  Constant  CINT_BIT_DMA_STAT_DONE     : integer  := 0;
791
 
792
  -- Bit definition in interrup status register (ISR)
793
  Constant  CINT_BIT_US_DONE_IN_ISR    : integer  := 0;
794
  Constant  CINT_BIT_DS_DONE_IN_ISR    : integer  := 1;
795
 
796
  Constant  CINT_BIT_INTGEN_IN_ISR     : integer  := 2;
797
  Constant  CINT_BIT_DGEN_IN_ISR       : integer  := 3;
798
 
799
  Constant  CINT_BIT_USTOUT_IN_ISR     : integer  := 4;
800
  Constant  CINT_BIT_DSTOUT_IN_ISR     : integer  := 5;
801
 
802
  Constant  CINT_BIT_DAQ_IN_ISR        : integer  := 6;
803
  Constant  CINT_BIT_CTL_IN_ISR        : integer  := 7;
804
  Constant  CINT_BIT_DLM_IN_ISR        : integer  := 8;
805
 
806
  -- The Time-out bits in System Error Register (SER)
807
  Constant  CINT_BIT_TX_TOUT_IN_SER    : integer  := 18;
808
  Constant  CINT_BIT_EB_TOUT_IN_SER    : integer  := 19;
809
  Constant  CINT_BIT_EB_OVERWRITTEN    : integer  := 20;
810
 
811
  -- The separate RST bit in DG_CTRL register
812
  Constant  CINT_BIT_DG_RST            : integer  := 12;
813
 
814
  -- The MASK bit in DG_CTRL register
815
  Constant  CINT_BIT_DG_MASK           : integer  := 8;
816
 
817
  -- The BUSY bit in DG_CTRL register
818
  Constant  CINT_BIT_DG_BUSY           : integer  := 1;
819
 
820
  -- The AVAIL bit in DG_CTRL register
821
  Constant  CINT_BIT_DG_AVAIL          : integer  := 0;
822
 
823
  -- Bit definition of msg routing method in General Control Register (GCR)
824
  Constant  C_GCR_MSG_ROUT_BIT_BOT     : integer  := 0;
825
  Constant  C_GCR_MSG_ROUT_BIT_TOP     : integer  := 2;
826
 
827
  -- Bit definition of ICAP Busy in global status register (GSR)
828
  Constant  CINT_BIT_ICAP_BUSY_IN_GSR  : integer  := 4;
829
 
830
  -- Bit definition of Data Generator available in global status register (GSR)
831
  Constant  CINT_BIT_DG_AVAIL_IN_GSR   : integer  := 5;
832
 
833
  -- Bit definition of DCB link_active in global status register (GSR)
834
  Constant  CINT_BIT_LINK_ACT_IN_GSR   : integer  := 6;
835
 
836
 
837
  -- Bit range of link width in GSR
838
  Constant  CINT_BIT_LWIDTH_IN_GSR_BOT : integer  := 10;  -- 16;
839
  Constant  CINT_BIT_LWIDTH_IN_GSR_TOP : integer  := 15;  -- 21;
840
 
841
 
842
  ----------------------------------------------------------------------------------
843
  -- Carry bit, only for better timing, used to divide 32-bit add into 2 stages
844
  Constant  CBIT_CARRY                 : integer  := 16;
845
 
846
  ----------------------------------------------------------------------------------
847
  --   Zero and -1 constants for different dimensions
848
  -- 
849
  Constant  C_ALL_ZEROS            : std_logic_vector(255 downto 0)
850
                                   := (OTHERS=>'0');
851
  Constant  C_ALL_ONES             : std_logic_vector(255 downto 0)
852
                                   := (OTHERS=>'1');
853
 
854
 
855
  ----------------------------------------------------------------------------------
856
  -- Implement date generator (DG)
857
  constant IMP_DATA_GENERATOR      : boolean   := FALSE;
858
 
859
  -- DDR2 SODIMM module as the event buffer kernel
860
  -- !! remember to replace the UCF accordingly
861
  constant USE_DDR2_MODULE         : boolean   := FALSE;
862
 
863
  -- For simplified verification, emulated loop-backed links be used if FALSE
864
  constant USE_OPTO_LINKS          : boolean   := FALSE;
865
 
866
  -- Implement interrupt generator (IG)
867
  constant IMP_INT_GENERATOR       : boolean   := FALSE;
868
 
869
  -- interrupt type: cfg(aka legacy) or MSI
870
  constant USE_CFG_INTERRUPT       : boolean   := FALSE;
871
 
872
  -- Busmacro insertion for partial reconfigurability
873
  constant INSERT_BUSMACRO         : boolean   := FALSE;
874
 
875
------------------------------------------------------------------------------------
876
----  ------------ Author ID
877
  constant AUTHOR_UNKNOWN          : std_logic_vector(4-1 downto 0)  := X"0";
878
  constant AUTHOR_AKUGEL           : std_logic_vector(4-1 downto 0)  := X"1";
879
  constant AUTHOR_WGAO             : std_logic_vector(4-1 downto 0)  := X"2";
880
  ----------------------------------------------------------------------------------
881
 
882
----  ------------ design ID              ---------------------
883
---- design id now contains a version: upper 8 bits, a major revision: next 8 bits, 
884
---- and author code: next 4 bits and a minor revision: lower 12 bits
885
---- keep the autor file seperate and don't submit to CVS
886
----
887
  constant DESIGN_VERSION          : std_logic_vector( 8-1 downto 0)  := X"01";
888
  constant DESIGN_MAJOR_REVISION   : std_logic_vector( 8-1 downto 0)  := X"04";
889
  constant DESIGN_MINOR_REVISION   : std_logic_vector(12-1 downto 0)  := X"001";
890
  constant C_DESIGN_ID             : std_logic_vector(64-1 downto 0)
891
                                   := X"00000000"
892
                                    & DESIGN_VERSION
893
                                    & DESIGN_MAJOR_REVISION
894
                                    & AUTHOR_WGAO
895
                                    & DESIGN_MINOR_REVISION
896
                                    ;
897
 
898
 
899
  ----------------------------------------------------------------------------------
900
  --       Function to invert endian for 32-bit data 
901
  --
902
  function Endian_Invert_32 (Word_in: std_logic_vector) return std_logic_vector;
903
  function Endian_Invert_64 (Word_in: std_logic_vector(64-1 downto 0)) return std_logic_vector;
904
 
905
 
906
  ----------------------------------------------------------------------------------
907
  ----------------------------------------------------------------------------------
908
  -- revision log
909
  -- 2007-05-30: AK - abbPackage added, address map changed
910
  -- 2007-06-12: WGao - C_DEF_DMA_CTRL_WORD added, 
911
  --                    DMA Control word bit definition added,
912
  --                    Function Endian_Invert_32 added.
913
  --                    CINT_ADDR_MRD_CTRL and CINT_ADDR_CPLD_CTRL changed,
914
  --                    CINT_ADDR_US_SAH and CINT_ADDR_DS_SAH removed.
915
  -- 2007-07-16: AK - dma status bits added
916
 
917
 
918
end abb64Package;
919
 
920
 
921
package body abb64Package is
922
 
923
  -- ------------------------------------------------------------------------------------------
924
  --   Function to invert bytewise endian for 32-bit data 
925
  -- ------------------------------------------------------------------------------------------
926
  function Endian_Invert_32 (Word_in: std_logic_vector) return std_logic_vector is
927
  begin
928
    return Word_in(7 downto 0)&Word_in(15 downto 8)&Word_in(23 downto 16)&Word_in(31 downto 24);
929
  end Endian_Invert_32;
930
 
931
  -- ------------------------------------------------------------------------------------------
932
  --   Function to invert bytewise endian for 64-bit data 
933
  -- ------------------------------------------------------------------------------------------
934
  function Endian_Invert_64 (Word_in: std_logic_vector(64-1 downto 0)) return std_logic_vector is
935
  begin
936
    return Word_in(39 downto 32)&Word_in(47 downto 40)&Word_in(55 downto 48)&Word_in(63 downto 56)
937
         & Word_in(7 downto 0)&Word_in(15 downto 8)&Word_in(23 downto 16)&Word_in(31 downto 24);
938
  end Endian_Invert_64;
939
 
940
end abb64Package;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.