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

Subversion Repositories or1k

[/] [or1k/] [branches/] [mp3_stable/] [or1200/] [rtl/] [verilog/] [generic_dpram_32x32.v] - Blame information for rev 317

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 218 lampret
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  Generic Double-Port Synchronous RAM                         ////
4
////                                                              ////
5
////  This file is part of memory library available from          ////
6
////  http://www.opencores.org/cvsweb.shtml/generic_memories/     ////
7
////                                                              ////
8
////  Description                                                 ////
9
////  This block is a wrapper with common double-port             ////
10
////  synchronous memory interface for different                  ////
11
////  types of ASIC and FPGA RAMs. Beside universal memory        ////
12
////  interface it also provides behavioral model of generic      ////
13
////  double-port synchronous RAM.                                ////
14
////  It should be used in all OPENCORES designs that want to be  ////
15
////  portable accross different target technologies and          ////
16
////  independent of target memory.                               ////
17
////                                                              ////
18
////  Supported ASIC RAMs are:                                    ////
19
////  - Artisan Double-Port Sync RAM                              ////
20
////  - Avant! Two-Port Sync RAM (*)                              ////
21
////  - Virage 2-port Sync RAM                                    ////
22
////                                                              ////
23
////  Supported FPGA RAMs are:                                    ////
24
////  - Xilinx Virtex RAMB4_S16_S16                               ////
25
////                                                              ////
26
////  To Do:                                                      ////
27
////   - fix Avant!                                               ////
28
////   - xilinx rams need external tri-state logic                ////
29
////   - add additional RAMs (Altera, VS etc)                     ////
30
////                                                              ////
31
////  Author(s):                                                  ////
32
////      - Damjan Lampret, lampret@opencores.org                 ////
33
////                                                              ////
34
//////////////////////////////////////////////////////////////////////
35
////                                                              ////
36
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
37
////                                                              ////
38
//// This source file may be used and distributed without         ////
39
//// restriction provided that this copyright statement is not    ////
40
//// removed from the file and that any derivative work contains  ////
41
//// the original copyright notice and the associated disclaimer. ////
42
////                                                              ////
43
//// This source file is free software; you can redistribute it   ////
44
//// and/or modify it under the terms of the GNU Lesser General   ////
45
//// Public License as published by the Free Software Foundation; ////
46
//// either version 2.1 of the License, or (at your option) any   ////
47
//// later version.                                               ////
48
////                                                              ////
49
//// This source is distributed in the hope that it will be       ////
50
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
51
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
52
//// PURPOSE.  See the GNU Lesser General Public License for more ////
53
//// details.                                                     ////
54
////                                                              ////
55
//// You should have received a copy of the GNU Lesser General    ////
56
//// Public License along with this source; if not, download it   ////
57
//// from http://www.opencores.org/lgpl.shtml                     ////
58
////                                                              ////
59
//////////////////////////////////////////////////////////////////////
60
//
61
// CVS Revision History
62
//
63
// $Log: not supported by cvs2svn $
64 271 lampret
// Revision 1.9  2001/11/02 18:57:14  lampret
65
// Modified virtual silicon instantiations.
66
//
67 265 lampret
// Revision 1.8  2001/10/22 19:39:56  lampret
68
// Fixed parameters in generic sprams.
69
//
70 220 lampret
// Revision 1.7  2001/10/21 17:57:16  lampret
71
// Removed params from generic_XX.v. Added translate_off/on in sprs.v and id.v. Removed spr_addr from dc.v and ic.v. Fixed CR+LF.
72
//
73 218 lampret
// Revision 1.6  2001/10/14 13:12:09  lampret
74
// MP3 version.
75
//
76
// Revision 1.1.1.1  2001/10/06 10:18:36  igorm
77
// no message
78
//
79
// Revision 1.1  2001/08/09 13:39:33  lampret
80
// Major clean-up.
81
//
82
// Revision 1.2  2001/07/30 05:38:02  lampret
83
// Adding empty directories required by HDL coding guidelines
84
//
85
//
86
 
87
// synopsys translate_off
88
`include "timescale.v"
89
// synopsys translate_on
90
`include "defines.v"
91
 
92
module generic_dpram_32x32(
93
        // Generic synchronous double-port RAM interface
94
        clk_a, rst_a, ce_a, oe_a, addr_a, do_a,
95
        clk_b, rst_b, ce_b, we_b, addr_b, di_b
96
);
97
 
98
//
99
// Default address and data buses width
100
//
101
parameter aw = 5;
102
parameter dw = 32;
103
 
104
//
105
// Generic synchronous double-port RAM interface
106
//
107
input                   clk_a;  // Clock
108
input                   rst_a;  // Reset
109
input                   ce_a;   // Chip enable input
110
input                   oe_a;   // Output enable input
111
input   [aw-1:0] addr_a; // address bus inputs
112
output  [dw-1:0] do_a;   // output data bus
113
input                   clk_b;  // Clock
114
input                   rst_b;  // Reset
115
input                   ce_b;   // Chip enable input
116
input                   we_b;   // Write enable input
117
input   [aw-1:0] addr_b; // address bus inputs
118
input   [dw-1:0] di_b;   // input data bus
119
 
120
//
121
// Internal wires and registers
122
//
123
 
124
`ifdef ARTISAN_SDP
125
 
126
//
127
// Instantiation of ASIC memory:
128
//
129
// Artisan Synchronous Double-Port RAM (ra2sh)
130
//
131
`ifdef UNUSED
132
art_hsdp_32x32 #(dw, 1<<aw, aw) artisan_sdp(
133
`else
134 220 lampret
art_hsdp_32x32 artisan_sdp(
135 218 lampret
`endif
136
        .qa(do_a),
137
        .clka(clk_a),
138
        .cena(~ce_a),
139
        .wena(1'b1),
140
        .aa(addr_a),
141
        .da(32'h00000000),
142
        .oena(~oe_a),
143
        .qb(),
144
        .clkb(clk_b),
145
        .cenb(~ce_b),
146
        .wenb(~we_b),
147
        .ab(addr_b),
148
        .db(di_b),
149
        .oenb(1'b1)
150
);
151
 
152
`else
153
 
154
`ifdef AVANT_ATP
155
 
156
//
157
// Instantiation of ASIC memory:
158
//
159
// Avant! Asynchronous Two-Port RAM
160
//
161
avant_atp avant_atp(
162
        .web(~we),
163
        .reb(),
164
        .oeb(~oe),
165
        .rcsb(),
166
        .wcsb(),
167
        .ra(addr),
168
        .wa(addr),
169
        .di(di),
170
        .do(do)
171
);
172
 
173
`else
174
 
175
`ifdef VIRAGE_STP
176
 
177
//
178
// Instantiation of ASIC memory:
179
//
180
// Virage Synchronous 2-port R/W RAM
181
//
182
virage_stp virage_stp(
183
        .QA(do_a),
184
        .QB(),
185
 
186
        .ADRA(addr_a),
187
        .DA(32'h00000000),
188
        .WEA(1'b0),
189
        .OEA(oe_a),
190
        .MEA(ce_a),
191
        .CLKA(clk_a),
192
 
193
        .ADRB(addr_b),
194
        .DB(di_b),
195
        .WEB(we_b),
196
        .OEB(1'b1),
197
        .MEB(ce_b),
198
        .CLKB(clk_b)
199
);
200
 
201
`else
202
 
203 265 lampret
`ifdef VIRTUALSILICON_STP
204
 
205
//
206
// Instantiation of ASIC memory:
207
//
208
// Virtual Silicon Two-port R/W SRAM
209
//
210
`ifdef UNUSED
211
vs_hdtp_32x32 #(1<<aw, aw-1, dw-1) vs_ssp(
212
`else
213
vs_hdtp_32x32 vs_ssp(
214
`endif
215
        .RCK(clk_a),
216
        .REN(~ce_a),
217
        .OEN(~oe_a),
218
        .RADR(addr_a),
219
        .DI(di_b),
220
        .WCK(clk_b),
221
        .WEN(~ce_b),
222
        .WADR(addr_b),
223
        .DOUT(do_a)
224
);
225
 
226
`else
227
 
228 218 lampret
`ifdef XILINX_RAM32X1D
229
 
230
//
231
// Instantiation of FPGA memory:
232
//
233
// Virtex/Spartan2
234
//
235
 
236
//
237
// Block 0
238
//
239
xcv_ram32x8d xcv_ram32x8d_0 (
240
        .DPO(do_a[7:0]),
241
        .SPO(),
242
        .A(addr_b),
243
        .D(di_b[7:0]),
244
        .DPRA(addr_a),
245
        .WCLK(clk_b),
246
        .WE(we_b)
247
);
248
 
249
//
250
// Block 1
251
//
252
xcv_ram32x8d xcv_ram32x8d_1 (
253
        .DPO(do_a[15:8]),
254
        .SPO(),
255
        .A(addr_b),
256
        .D(di_b[15:8]),
257
        .DPRA(addr_a),
258
        .WCLK(clk_b),
259
        .WE(we_b)
260
);
261
 
262
 
263
//
264
// Block 2
265
//
266
xcv_ram32x8d xcv_ram32x8d_2 (
267
        .DPO(do_a[23:16]),
268
        .SPO(),
269
        .A(addr_b),
270
        .D(di_b[23:16]),
271
        .DPRA(addr_a),
272
        .WCLK(clk_b),
273
        .WE(we_b)
274
);
275
 
276
//
277
// Block 3
278
//
279
xcv_ram32x8d xcv_ram32x8d_3 (
280
        .DPO(do_a[31:24]),
281
        .SPO(),
282
        .A(addr_b),
283
        .D(di_b[31:24]),
284
        .DPRA(addr_a),
285
        .WCLK(clk_b),
286
        .WE(we_b)
287
);
288
 
289
`else
290
 
291
`ifdef XILINX_RAMB4
292
 
293
//
294
// Instantiation of FPGA memory:
295
//
296
// Virtex/Spartan2
297
//
298
 
299
//
300
// Block 0
301
//
302
RAMB4_S16_S16 ramb4_s16_0(
303
        .CLKA(clk_a),
304
        .RSTA(rst_a),
305
        .ADDRA({3'b000, addr_a}),
306
        .DIA(16'h0000),
307
        .ENA(ce_a),
308
        .WEA(1'b0),
309
        .DOA(do_a[15:0]),
310
 
311
        .CLKB(clk_b),
312
        .RSTB(rst_b),
313
        .ADDRB({3'b000, addr_b}),
314
        .DIB(di_b[15:0]),
315
        .ENB(ce_b),
316
        .WEB(we_b),
317
        .DOB()
318
);
319
 
320
//
321
// Block 1
322
//
323
RAMB4_S16_S16 ramb4_s16_1(
324
        .CLKA(clk_a),
325
        .RSTA(rst_a),
326
        .ADDRA({3'b000, addr_a}),
327
        .DIA(16'h0000),
328
        .ENA(ce_a),
329
        .WEA(1'b0),
330
        .DOA(do_a[31:16]),
331
 
332
        .CLKB(clk_b),
333
        .RSTB(rst_b),
334
        .ADDRB({3'b000, addr_b}),
335
        .DIB(di_b[31:16]),
336
        .ENB(ce_b),
337
        .WEB(we_b),
338
        .DOB()
339
);
340
 
341
`else
342
 
343
//
344
// Generic double-port synchronous RAM model
345
//
346
 
347
//
348
// Generic RAM's registers and wires
349
//
350
reg     [dw-1:0] mem [(1<<aw)-1:0];       // RAM content
351
reg     [dw-1:0] do_reg;                 // RAM data output register
352
 
353
//
354
// Data output drivers
355
//
356
assign do_a = (oe_a) ? do_reg : {dw{1'bz}};
357
 
358
//
359
// RAM read
360
//
361
always @(posedge clk_a)
362
        if (ce_a)
363
                do_reg <= #1 mem[addr_a];
364
 
365
//
366
// RAM write
367
//
368
always @(posedge clk_b)
369
        if (ce_b && we_b)
370
                mem[addr_b] <= #1 di_b;
371
 
372
`endif  // !XILINX_RAMB4_S16_S16
373
`endif  // !XILINX_RAM32X1D
374 271 lampret
`endif  // !VIRTUALSILICON_SSP
375 218 lampret
`endif  // !VIRAGE_STP
376
`endif  // !AVANT_ATP
377
`endif  // !ARTISAN_SDP
378
 
379
endmodule

powered by: WebSVN 2.1.0

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