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/] [ipcore_dir_ISE13.3/] [v6_pcie_v1_7_x4/] [source/] [pcie_bram_v6.v] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 barabba
//-----------------------------------------------------------------------------
2
//
3
// (c) Copyright 2009-2011 Xilinx, Inc. All rights reserved.
4
//
5
// This file contains confidential and proprietary information
6
// of Xilinx, Inc. and is protected under U.S. and
7
// international copyright and other intellectual property
8
// laws.
9
//
10
// DISCLAIMER
11
// This disclaimer is not a license and does not grant any
12
// rights to the materials distributed herewith. Except as
13
// otherwise provided in a valid license issued to you by
14
// Xilinx, and to the maximum extent permitted by applicable
15
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
16
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
17
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
18
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
19
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
20
// (2) Xilinx shall not be liable (whether in contract or tort,
21
// including negligence, or under any other theory of
22
// liability) for any loss or damage of any kind or nature
23
// related to, arising under or in connection with these
24
// materials, including for any direct, or any indirect,
25
// special, incidental, or consequential loss or damage
26
// (including loss of data, profits, goodwill, or any type of
27
// loss or damage suffered as a result of any action brought
28
// by a third party) even if such damage or loss was
29
// reasonably foreseeable or Xilinx had been advised of the
30
// possibility of the same.
31
//
32
// CRITICAL APPLICATIONS
33
// Xilinx products are not designed or intended to be fail-
34
// safe, or for use in any application requiring fail-safe
35
// performance, such as life-support or safety devices or
36
// systems, Class III medical devices, nuclear facilities,
37
// applications related to the deployment of airbags, or any
38
// other applications that could lead to death, personal
39
// injury, or severe property or environmental damage
40
// (individually and collectively, "Critical
41
// Applications"). Customer assumes the sole risk and
42
// liability of any use of Xilinx products in Critical
43
// Applications, subject only to applicable laws and
44
// regulations governing limitations on product liability.
45
//
46
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
47
// PART OF THIS FILE AT ALL TIMES.
48
//
49
//-----------------------------------------------------------------------------
50
// Project    : Virtex-6 Integrated Block for PCI Express
51
// File       : pcie_bram_v6.v
52
// Version    : 1.7
53
//--
54
//-- Description: BlockRAM module for Virtex6 PCIe Block
55
//--
56
//--
57
//--
58
//--------------------------------------------------------------------------------
59
 
60
`timescale 1ns/1ns
61
 
62
module pcie_bram_v6
63
  #(
64
    parameter DOB_REG = 0,// 1 use the output register 0 don't use the output register
65
    parameter WIDTH = 0   // supported WIDTH's are: 4, 9, 18, 36 (uses RAMB36) and 72 (uses RAMB36SDP)
66
    )
67
    (
68
     input               user_clk_i,// user clock
69
     input               reset_i,   // bram reset
70
 
71
     input               wen_i,     // write enable
72
     input [12:0]        waddr_i,   // write address
73
     input [WIDTH - 1:0] wdata_i,   // write data
74
 
75
     input               ren_i,     // read enable
76
     input               rce_i,     // output register clock enable
77
     input [12:0]        raddr_i,   // read address
78
 
79
     output [WIDTH - 1:0] rdata_o   // read data
80
     );
81
 
82
   // map the address bits
83
   localparam ADDR_MSB = ((WIDTH == 4)  ? 12 :
84
                          (WIDTH == 9)  ? 11 :
85
                          (WIDTH == 18) ? 10 :
86
                          (WIDTH == 36) ?  9 :
87
                                           8
88
                          );
89
 
90
   // set the width of the tied off low address bits
91
   localparam ADDR_LO_BITS = ((WIDTH == 4)  ? 2 :
92
                              (WIDTH == 9)  ? 3 :
93
                              (WIDTH == 18) ? 4 :
94
                              (WIDTH == 36) ? 5 :
95
 
96
                              );
97
 
98
   // map the data bits
99
   localparam D_MSB =  ((WIDTH == 4)  ?  3 :
100
                        (WIDTH == 9)  ?  7 :
101
                        (WIDTH == 18) ? 15 :
102
                        (WIDTH == 36) ? 31 :
103
                                        63
104
                        );
105
 
106
   // map the data parity bits
107
   localparam DP_LSB =  D_MSB + 1;
108
 
109
   localparam DP_MSB =  ((WIDTH == 4)  ? 4 :
110
                         (WIDTH == 9)  ? 8 :
111
                         (WIDTH == 18) ? 17 :
112
                         (WIDTH == 36) ? 35 :
113
                                         71
114
                        );
115
 
116
   localparam DPW = DP_MSB - DP_LSB + 1;
117
 
118
   localparam WRITE_MODE = "NO_CHANGE";
119
 
120
   //synthesis translate_off
121
   initial begin
122
      //$display("[%t] %m DOB_REG %0d WIDTH %0d ADDR_MSB %0d ADDR_LO_BITS %0d DP_MSB %0d DP_LSB %0d D_MSB %0d",
123
      //          $time, DOB_REG,   WIDTH,    ADDR_MSB,    ADDR_LO_BITS,    DP_MSB,    DP_LSB,    D_MSB);
124
 
125
      case (WIDTH)
126
        4,9,18,36,72:;
127
        default:
128
          begin
129
             $display("[%t] %m Error WIDTH %0d not supported", $time, WIDTH);
130
             $finish;
131
          end
132
      endcase // case (WIDTH)
133
   end
134
   //synthesis translate_on
135
 
136
   generate
137
   if (WIDTH == 72) begin : use_ramb36sdp
138
 
139
      // use RAMB36SDP if the width is 72
140
      RAMB36SDP #(
141
               .DO_REG        (DOB_REG)
142
               )
143
        ramb36sdp(
144
               .WRCLK          (user_clk_i),
145
               .SSR            (1'b0),
146
               .WRADDR         (waddr_i[ADDR_MSB:0]),
147
               .DI             (wdata_i[D_MSB:0]),
148
               .DIP            (wdata_i[DP_MSB:DP_LSB]),
149
               .WREN           (wen_i),
150
               .WE             ({8{wen_i}}),
151
               .DBITERR        (),
152
               .ECCPARITY      (),
153
               .SBITERR        (),
154
 
155
               .RDCLK          (user_clk_i),
156
               .RDADDR         (raddr_i[ADDR_MSB:0]),
157
               .DO             (rdata_o[D_MSB:0]),
158
               .DOP            (rdata_o[DP_MSB:DP_LSB]),
159
               .RDEN           (ren_i),
160
               .REGCE          (rce_i)
161
               );
162
 
163
    // use RAMB36's if the width is 4, 9, 18, or 36   
164
    end else if (WIDTH == 36) begin : use_ramb36
165
 
166
      RAMB36 #(
167
               .DOA_REG       (0),
168
               .DOB_REG       (DOB_REG),
169
               .READ_WIDTH_A  (0),
170
               .READ_WIDTH_B  (WIDTH),
171
               .WRITE_WIDTH_A (WIDTH),
172
               .WRITE_WIDTH_B (0),
173
               .WRITE_MODE_A  (WRITE_MODE)
174
               )
175
        ramb36(
176
               .CLKA           (user_clk_i),
177
               .SSRA           (1'b0),
178
               .REGCEA         (1'b0),
179
               .CASCADEINLATA  (1'b0),
180
               .CASCADEINREGA  (1'b0),
181
               .CASCADEOUTLATA (),
182
               .CASCADEOUTREGA (),
183
               .DOA            (),
184
               .DOPA           (),
185
               .ADDRA          ({1'b1, waddr_i[ADDR_MSB:0], {ADDR_LO_BITS{1'b1}}}),
186
               .DIA            (wdata_i[D_MSB:0]),
187
               .DIPA           (wdata_i[DP_MSB:DP_LSB]),
188
               .ENA            (wen_i),
189
               .WEA            ({4{wen_i}}),
190
 
191
               .CLKB           (user_clk_i),
192
               .SSRB           (1'b0),
193
               .WEB            (4'b0),
194
               .CASCADEINLATB  (1'b0),
195
               .CASCADEINREGB  (1'b0),
196
               .CASCADEOUTLATB (),
197
               .CASCADEOUTREGB (),
198
               .DIB            (32'b0),
199
               .DIPB           ( 4'b0),
200
               .ADDRB          ({1'b1, raddr_i[ADDR_MSB:0], {ADDR_LO_BITS{1'b1}}}),
201
               .DOB            (rdata_o[D_MSB:0]),
202
               .DOPB           (rdata_o[DP_MSB:DP_LSB]),
203
               .ENB            (ren_i),
204
               .REGCEB         (rce_i)
205
               );
206
 
207
   end else if (WIDTH < 36 && WIDTH > 4) begin : use_ramb36
208
 
209
      wire [31 - D_MSB - 1 : 0] dob_unused;
210
      wire [ 4 - DPW   - 1 : 0] dopb_unused;
211
 
212
      RAMB36 #(
213
               .DOA_REG       (0),
214
               .DOB_REG       (DOB_REG),
215
               .READ_WIDTH_A  (0),
216
               .READ_WIDTH_B  (WIDTH),
217
               .WRITE_WIDTH_A (WIDTH),
218
               .WRITE_WIDTH_B (0),
219
               .WRITE_MODE_A  (WRITE_MODE)
220
               )
221
        ramb36(
222
               .CLKA           (user_clk_i),
223
               .SSRA           (1'b0),
224
               .REGCEA         (1'b0),
225
               .CASCADEINLATA  (1'b0),
226
               .CASCADEINREGA  (1'b0),
227
               .CASCADEOUTLATA (),
228
               .CASCADEOUTREGA (),
229
               .DOA            (),
230
               .DOPA           (),
231
               .ADDRA          ({1'b1, waddr_i[ADDR_MSB:0], {ADDR_LO_BITS{1'b1}}}),
232
               .DIA            ({{31 - D_MSB{1'b0}},wdata_i[D_MSB:0]}),
233
               .DIPA           ({{ 4 - DPW  {1'b0}},wdata_i[DP_MSB:DP_LSB]}),
234
               .ENA            (wen_i),
235
               .WEA            ({4{wen_i}}),
236
 
237
               .CLKB           (user_clk_i),
238
               .SSRB           (1'b0),
239
               .WEB            (4'b0),
240
               .CASCADEINLATB  (1'b0),
241
               .CASCADEINREGB  (1'b0),
242
               .CASCADEOUTLATB (),
243
               .CASCADEOUTREGB (),
244
               .DIB            (32'b0),
245
               .DIPB           ( 4'b0),
246
               .ADDRB          ({1'b1, raddr_i[ADDR_MSB:0], {ADDR_LO_BITS{1'b1}}}),
247
               .DOB            ({dob_unused,  rdata_o[D_MSB:0]}),
248
               .DOPB           ({dopb_unused, rdata_o[DP_MSB:DP_LSB]}),
249
               .ENB            (ren_i),
250
               .REGCEB         (rce_i)
251
               );
252
 
253
   end else if (WIDTH ==  4) begin : use_ramb36
254
 
255
      wire [31 - D_MSB - 1 : 0] dob_unused;
256
 
257
      RAMB36 #(
258
               .DOB_REG       (DOB_REG),
259
               .READ_WIDTH_A  (0),
260
               .READ_WIDTH_B  (WIDTH),
261
               .WRITE_WIDTH_A (WIDTH),
262
               .WRITE_WIDTH_B (0),
263
               .WRITE_MODE_A  (WRITE_MODE)
264
               )
265
        ramb36(
266
               .CLKA           (user_clk_i),
267
               .SSRA           (1'b0),
268
               .REGCEA         (1'b0),
269
               .CASCADEINLATA  (1'b0),
270
               .CASCADEINREGA  (1'b0),
271
               .CASCADEOUTLATA (),
272
               .CASCADEOUTREGA (),
273
               .DOA            (),
274
               .DOPA           (),
275
               .ADDRA          ({1'b1, waddr_i[ADDR_MSB:0], {ADDR_LO_BITS{1'b1}}}),
276
               .DIA            ({{31 - D_MSB{1'b0}},wdata_i[D_MSB:0]}),
277
               //.DIPA           (wdata_i[DP_MSB:DP_LSB]),
278
               .DIPA           (4'h0),
279
               .ENA            (wen_i),
280
               .WEA            ({4{wen_i}}),
281
 
282
               .CLKB           (user_clk_i),
283
               .SSRB           (1'b0),
284
               .WEB            (4'b0),
285
               .CASCADEINLATB  (1'b0),
286
               .CASCADEINREGB  (1'b0),
287
               .CASCADEOUTLATB (),
288
               .CASCADEOUTREGB (),
289
               .ADDRB          ({1'b1, raddr_i[ADDR_MSB:0], {ADDR_LO_BITS{1'b1}}}),
290
               .DIB            (0),
291
               .DIPB           (0),
292
               .DOB            ({dob_unused,rdata_o[D_MSB:0]}),
293
               //.DOPB           (rdata_o[DP_MSB:DP_LSB]),
294
               .ENB            (ren_i),
295
               .REGCEB         (rce_i)
296
               );
297
 
298
   end // block: use_ramb36
299
   endgenerate
300
 
301
endmodule // pcie_bram_v6

powered by: WebSVN 2.1.0

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