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_brams_v6.v] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 barabba
 
2
//-----------------------------------------------------------------------------
3
//
4
// (c) Copyright 2009-2011 Xilinx, Inc. All rights reserved.
5
//
6
// This file contains confidential and proprietary information
7
// of Xilinx, Inc. and is protected under U.S. and
8
// international copyright and other intellectual property
9
// laws.
10
//
11
// DISCLAIMER
12
// This disclaimer is not a license and does not grant any
13
// rights to the materials distributed herewith. Except as
14
// otherwise provided in a valid license issued to you by
15
// Xilinx, and to the maximum extent permitted by applicable
16
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
17
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
18
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
19
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
20
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
21
// (2) Xilinx shall not be liable (whether in contract or tort,
22
// including negligence, or under any other theory of
23
// liability) for any loss or damage of any kind or nature
24
// related to, arising under or in connection with these
25
// materials, including for any direct, or any indirect,
26
// special, incidental, or consequential loss or damage
27
// (including loss of data, profits, goodwill, or any type of
28
// loss or damage suffered as a result of any action brought
29
// by a third party) even if such damage or loss was
30
// reasonably foreseeable or Xilinx had been advised of the
31
// possibility of the same.
32
//
33
// CRITICAL APPLICATIONS
34
// Xilinx products are not designed or intended to be fail-
35
// safe, or for use in any application requiring fail-safe
36
// performance, such as life-support or safety devices or
37
// systems, Class III medical devices, nuclear facilities,
38
// applications related to the deployment of airbags, or any
39
// other applications that could lead to death, personal
40
// injury, or severe property or environmental damage
41
// (individually and collectively, "Critical
42
// Applications"). Customer assumes the sole risk and
43
// liability of any use of Xilinx products in Critical
44
// Applications, subject only to applicable laws and
45
// regulations governing limitations on product liability.
46
//
47
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
48
// PART OF THIS FILE AT ALL TIMES.
49
//
50
//-----------------------------------------------------------------------------
51
// Project    : Virtex-6 Integrated Block for PCI Express
52
// File       : pcie_brams_v6.v
53
// Version    : 1.7
54
//--
55
//-- Description: BlockRAM module for Virtex6 PCIe Block
56
//--
57
//--
58
//--
59
//--------------------------------------------------------------------------------
60
 
61
`timescale 1ns/1ns
62
 
63
module pcie_brams_v6
64
#(
65
   // the number of BRAMs to use
66
   // supported values are:
67
   // 1,2,4,8,18
68
   parameter NUM_BRAMS               = 0,
69
 
70
   // BRAM read address latency
71
   //
72
   // value     meaning
73
   // ====================================================
74
   //   0       BRAM read address port sample
75
   //   1       BRAM read address port sample and a pipeline stage on the address port
76
   parameter RAM_RADDR_LATENCY   = 1,
77
 
78
   // BRAM read data latency
79
   //
80
   // value     meaning
81
   // ====================================================
82
   //   1       no BRAM OREG
83
   //   2       use BRAM OREG
84
   //   3       use BRAM OREG and a pipeline stage on the data port
85
   parameter RAM_RDATA_LATENCY   = 1,
86
 
87
   // BRAM write latency
88
   // The BRAM write port is synchronous
89
   //
90
   // value     meaning
91
   // ====================================================
92
   //   0       BRAM write port sample
93
   //   1       BRAM write port sample plus pipeline stage
94
   parameter RAM_WRITE_LATENCY       = 1
95
 )
96
  (
97
   input          user_clk_i,
98
   input          reset_i,
99
 
100
   input          wen,
101
   input  [12:0]  waddr,
102
   input  [71:0]  wdata,
103
   input          ren,
104
   input          rce,
105
   input  [12:0]  raddr,
106
   output [71:0]  rdata
107
   );
108
 
109
   // turn on the bram output register
110
   localparam DOB_REG = (RAM_RDATA_LATENCY > 1) ? 1 : 0;
111
 
112
   // calculate the data width of the individual brams
113
   localparam [6:0] WIDTH = ((NUM_BRAMS == 1) ? 72 :
114
                             (NUM_BRAMS == 2) ? 36 :
115
                             (NUM_BRAMS == 4) ? 18 :
116
                             (NUM_BRAMS == 8) ?  9 :
117
                                                 4
118
                            );
119
 
120
   parameter TCQ           = 1;
121
 
122
   //synthesis translate_off
123
   initial begin
124
      $display("[%t] %m NUM_BRAMS %0d  DOB_REG %0d WIDTH %0d RAM_WRITE_LATENCY %0d RAM_RADDR_LATENCY %0d RAM_RDATA_LATENCY %0d",
125
                $time, NUM_BRAMS, DOB_REG, WIDTH, RAM_WRITE_LATENCY, RAM_RADDR_LATENCY, RAM_RDATA_LATENCY);
126
 
127
      case (NUM_BRAMS)
128
        1,2,4,8,18:;
129
        default:
130
          begin
131
             $display("[%t] %m Error NUM_BRAMS %0d not supported", $time, NUM_BRAMS);
132
             $finish;
133
          end
134
      endcase // case(NUM_BRAMS)
135
 
136
      case (RAM_RADDR_LATENCY)
137
        0,1:;
138
        default:
139
          begin
140
             $display("[%t] %m Error RAM_READ_LATENCY %0d not supported", $time, RAM_RADDR_LATENCY);
141
             $finish;
142
          end
143
      endcase // case (RAM_RADDR_LATENCY)
144
 
145
      case (RAM_RDATA_LATENCY)
146
        1,2,3:;
147
        default:
148
          begin
149
             $display("[%t] %m Error RAM_READ_LATENCY %0d not supported", $time, RAM_RDATA_LATENCY);
150
             $finish;
151
          end
152
      endcase // case (RAM_RDATA_LATENCY)
153
 
154
      case (RAM_WRITE_LATENCY)
155
        0,1:;
156
        default:
157
          begin
158
             $display("[%t] %m Error RAM_WRITE_LATENCY %0d not supported", $time, RAM_WRITE_LATENCY);
159
             $finish;
160
          end
161
      endcase // case(RAM_WRITE_LATENCY)
162
 
163
   end
164
   //synthesis translate_on
165
 
166
   // model the delays for ram write latency
167
 
168
   wire        wen_int;
169
   wire [12:0] waddr_int;
170
   wire [71:0] wdata_int;
171
 
172
   generate if (RAM_WRITE_LATENCY == 1) begin : wr_lat_2
173
      reg        wen_dly;
174
      reg [12:0] waddr_dly;
175
      reg [71:0] wdata_dly;
176
 
177
      always @(posedge user_clk_i) begin
178
         if (reset_i) begin
179
            wen_dly   <= #TCQ 1'b0;
180
            waddr_dly <= #TCQ 13'b0;
181
            wdata_dly <= #TCQ 72'b0;
182
         end else begin
183
            wen_dly   <= #TCQ wen;
184
            waddr_dly <= #TCQ waddr;
185
            wdata_dly <= #TCQ wdata;
186
         end
187
      end
188
 
189
      assign wen_int   = wen_dly;
190
      assign waddr_int = waddr_dly;
191
      assign wdata_int = wdata_dly;
192
   end // if (RAM_WRITE_LATENCY == 1)
193
 
194
   else if (RAM_WRITE_LATENCY == 0) begin : wr_lat_1
195
      assign wen_int   = wen;
196
      assign waddr_int = waddr;
197
      assign wdata_int = wdata;
198
   end
199
   endgenerate
200
 
201
   // model the delays for ram read latency
202
 
203
   wire        ren_int;
204
   wire [12:0] raddr_int;
205
   wire [71:0] rdata_int;
206
 
207
   generate if (RAM_RADDR_LATENCY == 1) begin : raddr_lat_2
208
      reg        ren_dly;
209
      reg [12:0] raddr_dly;
210
 
211
      always @(posedge user_clk_i) begin
212
         if (reset_i) begin
213
            ren_dly   <= #TCQ 1'b0;
214
            raddr_dly <= #TCQ 13'b0;
215
         end else begin
216
            ren_dly   <= #TCQ ren;
217
            raddr_dly <= #TCQ raddr;
218
         end // else: !if(reset_i)
219
      end
220
 
221
      assign ren_int   = ren_dly;
222
      assign raddr_int = raddr_dly;
223
   end // block: rd_lat_addr_2
224
 
225
   else begin : raddr_lat_1
226
      assign ren_int   = ren;
227
      assign raddr_int = raddr;
228
   end
229
   endgenerate
230
 
231
   generate if (RAM_RDATA_LATENCY == 3) begin : rdata_lat_3
232
      reg [71:0] rdata_dly;
233
 
234
      always @(posedge user_clk_i) begin
235
         if (reset_i) begin
236
            rdata_dly <= #TCQ 72'b0;
237
         end else begin
238
            rdata_dly <= #TCQ rdata_int;
239
         end // else: !if(reset_i)
240
      end
241
 
242
      assign rdata     = rdata_dly;
243
 
244
   end // block: rd_lat_data_3
245
 
246
   else begin : rdata_lat_1_2
247
      assign #TCQ rdata     = rdata_int;
248
   end
249
   endgenerate
250
 
251
   // instantiate the brams
252
   generate
253
      genvar i;
254
      for (i = 0; i < NUM_BRAMS; i = i + 1) begin : brams
255
         pcie_bram_v6 #(.DOB_REG(DOB_REG), .WIDTH(WIDTH))
256
           ram (.user_clk_i(user_clk_i), .reset_i(reset_i),
257
                .wen_i(wen_int), .waddr_i(waddr_int), .wdata_i(wdata_int[(((i + 1) * WIDTH) - 1): (i * WIDTH)]),
258
                .ren_i(ren_int), .raddr_i(raddr_int), .rdata_o(rdata_int[(((i + 1) * WIDTH) - 1): (i * WIDTH)]), .rce_i(rce));
259
      end
260
   endgenerate
261
endmodule // pcie_brams_v6

powered by: WebSVN 2.1.0

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