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

Subversion Repositories pcie_sg_dma

[/] [pcie_sg_dma/] [branches/] [Virtex6/] [ML605_ISE12.3/] [ipcore_dir_ISE12.1/] [v6_pcie_v1_3/] [source/] [pcie_bram_v6.v] - Blame information for rev 11

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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