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

Subversion Repositories or1k

[/] [or1k/] [tags/] [rel_26/] [or1200/] [rtl/] [verilog/] [or1200_dpram_32x32.v] - Blame information for rev 573

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

Line No. Rev Author Line
1 504 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 573 lampret
// Revision 1.1  2002/01/03 08:16:15  lampret
65
// New prefixes for RTL files, prefixed module names. Updated cache controllers and MMUs.
66
//
67 504 lampret
// Revision 1.10  2001/11/05 14:48:00  lampret
68
// Added missing endif
69
//
70
// Revision 1.9  2001/11/02 18:57:14  lampret
71
// Modified virtual silicon instantiations.
72
//
73
// Revision 1.8  2001/10/22 19:39:56  lampret
74
// Fixed parameters in generic sprams.
75
//
76
// Revision 1.7  2001/10/21 17:57:16  lampret
77
// 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.
78
//
79
// Revision 1.6  2001/10/14 13:12:09  lampret
80
// MP3 version.
81
//
82
// Revision 1.1.1.1  2001/10/06 10:18:36  igorm
83
// no message
84
//
85
// Revision 1.1  2001/08/09 13:39:33  lampret
86
// Major clean-up.
87
//
88
// Revision 1.2  2001/07/30 05:38:02  lampret
89
// Adding empty directories required by HDL coding guidelines
90
//
91
//
92
 
93
// synopsys translate_off
94
`include "timescale.v"
95
// synopsys translate_on
96
`include "or1200_defines.v"
97
 
98
module or1200_dpram_32x32(
99
        // Generic synchronous double-port RAM interface
100
        clk_a, rst_a, ce_a, oe_a, addr_a, do_a,
101
        clk_b, rst_b, ce_b, we_b, addr_b, di_b
102
);
103
 
104
//
105
// Default address and data buses width
106
//
107
parameter aw = 5;
108
parameter dw = 32;
109
 
110
//
111
// Generic synchronous double-port RAM interface
112
//
113
input                   clk_a;  // Clock
114
input                   rst_a;  // Reset
115
input                   ce_a;   // Chip enable input
116
input                   oe_a;   // Output enable input
117
input   [aw-1:0] addr_a; // address bus inputs
118
output  [dw-1:0] do_a;   // output data bus
119
input                   clk_b;  // Clock
120
input                   rst_b;  // Reset
121
input                   ce_b;   // Chip enable input
122
input                   we_b;   // Write enable input
123
input   [aw-1:0] addr_b; // address bus inputs
124
input   [dw-1:0] di_b;   // input data bus
125
 
126
//
127
// Internal wires and registers
128
//
129
 
130
`ifdef OR1200_ARTISAN_SDP
131
 
132
//
133
// Instantiation of ASIC memory:
134
//
135
// Artisan Synchronous Double-Port RAM (ra2sh)
136
//
137
`ifdef UNUSED
138
art_hsdp_32x32 #(dw, 1<<aw, aw) artisan_sdp(
139
`else
140
art_hsdp_32x32 artisan_sdp(
141
`endif
142
        .qa(do_a),
143
        .clka(clk_a),
144
        .cena(~ce_a),
145
        .wena(1'b1),
146
        .aa(addr_a),
147
        .da(32'h00000000),
148
        .oena(~oe_a),
149
        .qb(),
150
        .clkb(clk_b),
151
        .cenb(~ce_b),
152
        .wenb(~we_b),
153
        .ab(addr_b),
154
        .db(di_b),
155
        .oenb(1'b1)
156
);
157
 
158
`else
159
 
160
`ifdef OR1200_AVANT_ATP
161
 
162
//
163
// Instantiation of ASIC memory:
164
//
165
// Avant! Asynchronous Two-Port RAM
166
//
167
avant_atp avant_atp(
168
        .web(~we),
169
        .reb(),
170
        .oeb(~oe),
171
        .rcsb(),
172
        .wcsb(),
173
        .ra(addr),
174
        .wa(addr),
175
        .di(di),
176
        .do(do)
177
);
178
 
179
`else
180
 
181
`ifdef OR1200_VIRAGE_STP
182
 
183
//
184
// Instantiation of ASIC memory:
185
//
186
// Virage Synchronous 2-port R/W RAM
187
//
188
virage_stp virage_stp(
189
        .QA(do_a),
190
        .QB(),
191
 
192
        .ADRA(addr_a),
193
        .DA(32'h00000000),
194
        .WEA(1'b0),
195
        .OEA(oe_a),
196
        .MEA(ce_a),
197
        .CLKA(clk_a),
198
 
199
        .ADRB(addr_b),
200
        .DB(di_b),
201
        .WEB(we_b),
202
        .OEB(1'b1),
203
        .MEB(ce_b),
204
        .CLKB(clk_b)
205
);
206
 
207
`else
208
 
209
`ifdef OR1200_VIRTUALSILICON_STP
210
 
211
//
212
// Instantiation of ASIC memory:
213
//
214
// Virtual Silicon Two-port R/W SRAM
215
//
216
`ifdef UNUSED
217
vs_hdtp_32x32 #(1<<aw, aw-1, dw-1) vs_ssp(
218
`else
219
vs_hdtp_32x32 vs_ssp(
220
`endif
221
        .RCK(clk_a),
222
        .REN(~ce_a),
223
        .OEN(~oe_a),
224
        .RADR(addr_a),
225
        .DI(di_b),
226
        .WCK(clk_b),
227
        .WEN(~ce_b),
228
        .WADR(addr_b),
229
        .DOUT(do_a)
230
);
231
 
232
`else
233
 
234
`ifdef OR1200_XILINX_RAM32X1D
235
 
236
//
237
// Instantiation of FPGA memory:
238
//
239
// Virtex/Spartan2
240
//
241
 
242
//
243
// Block 0
244
//
245 573 lampret
or1200_xcv_ram32x8d xcv_ram32x8d_0 (
246 504 lampret
        .DPO(do_a[7:0]),
247
        .SPO(),
248
        .A(addr_b),
249
        .D(di_b[7:0]),
250
        .DPRA(addr_a),
251
        .WCLK(clk_b),
252
        .WE(we_b)
253
);
254
 
255
//
256
// Block 1
257
//
258 573 lampret
or1200_xcv_ram32x8d xcv_ram32x8d_1 (
259 504 lampret
        .DPO(do_a[15:8]),
260
        .SPO(),
261
        .A(addr_b),
262
        .D(di_b[15:8]),
263
        .DPRA(addr_a),
264
        .WCLK(clk_b),
265
        .WE(we_b)
266
);
267
 
268
 
269
//
270
// Block 2
271
//
272 573 lampret
or1200_xcv_ram32x8d xcv_ram32x8d_2 (
273 504 lampret
        .DPO(do_a[23:16]),
274
        .SPO(),
275
        .A(addr_b),
276
        .D(di_b[23:16]),
277
        .DPRA(addr_a),
278
        .WCLK(clk_b),
279
        .WE(we_b)
280
);
281
 
282
//
283
// Block 3
284
//
285 573 lampret
or1200_xcv_ram32x8d xcv_ram32x8d_3 (
286 504 lampret
        .DPO(do_a[31:24]),
287
        .SPO(),
288
        .A(addr_b),
289
        .D(di_b[31:24]),
290
        .DPRA(addr_a),
291
        .WCLK(clk_b),
292
        .WE(we_b)
293
);
294
 
295
`else
296
 
297
`ifdef OR1200_XILINX_RAMB4
298
 
299
//
300
// Instantiation of FPGA memory:
301
//
302
// Virtex/Spartan2
303
//
304
 
305
//
306
// Block 0
307
//
308
RAMB4_S16_S16 ramb4_s16_0(
309
        .CLKA(clk_a),
310
        .RSTA(rst_a),
311
        .ADDRA({3'b000, addr_a}),
312
        .DIA(16'h0000),
313
        .ENA(ce_a),
314
        .WEA(1'b0),
315
        .DOA(do_a[15:0]),
316
 
317
        .CLKB(clk_b),
318
        .RSTB(rst_b),
319
        .ADDRB({3'b000, addr_b}),
320
        .DIB(di_b[15:0]),
321
        .ENB(ce_b),
322
        .WEB(we_b),
323
        .DOB()
324
);
325
 
326
//
327
// Block 1
328
//
329
RAMB4_S16_S16 ramb4_s16_1(
330
        .CLKA(clk_a),
331
        .RSTA(rst_a),
332
        .ADDRA({3'b000, addr_a}),
333
        .DIA(16'h0000),
334
        .ENA(ce_a),
335
        .WEA(1'b0),
336
        .DOA(do_a[31:16]),
337
 
338
        .CLKB(clk_b),
339
        .RSTB(rst_b),
340
        .ADDRB({3'b000, addr_b}),
341
        .DIB(di_b[31:16]),
342
        .ENB(ce_b),
343
        .WEB(we_b),
344
        .DOB()
345
);
346
 
347
`else
348
 
349
//
350
// Generic double-port synchronous RAM model
351
//
352
 
353
//
354
// Generic RAM's registers and wires
355
//
356
reg     [dw-1:0] mem [(1<<aw)-1:0];       // RAM content
357
reg     [dw-1:0] do_reg;                 // RAM data output register
358
 
359
//
360
// Data output drivers
361
//
362
assign do_a = (oe_a) ? do_reg : {dw{1'bz}};
363
 
364
//
365
// RAM read
366
//
367
always @(posedge clk_a)
368
        if (ce_a)
369
                do_reg <= #1 mem[addr_a];
370
 
371
//
372
// RAM write
373
//
374
always @(posedge clk_b)
375
        if (ce_b && we_b)
376
                mem[addr_b] <= #1 di_b;
377
 
378
`endif  // !OR1200_XILINX_RAMB4_S16_S16
379
`endif  // !OR1200_XILINX_RAM32X1D
380
`endif  // !OR1200_VIRTUALSILICON_SSP
381
`endif  // !OR1200_VIRAGE_STP
382
`endif  // !OR1200_AVANT_ATP
383
`endif  // !OR1200_ARTISAN_SDP
384
 
385
endmodule

powered by: WebSVN 2.1.0

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