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

Subversion Repositories or1k

[/] [or1k/] [tags/] [rel_13/] [or1200/] [rtl/] [verilog/] [or1200_spram_2048x32.v] - Blame information for rev 1063

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

Line No. Rev Author Line
1 504 lampret
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  Generic Single-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 single-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
////  single-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 Single-Port Sync RAM                              ////
20
////  - Avant! Two-Port Sync RAM (*)                              ////
21
////  - Virage Single-Port Sync RAM                               ////
22
////  - Virtual Silicon Single-Port Sync RAM                      ////
23
////                                                              ////
24
////  Supported FPGA RAMs are:                                    ////
25
////  - Xilinx Virtex RAMB4_S16                                   ////
26
////                                                              ////
27
////  To Do:                                                      ////
28
////   - xilinx rams need external tri-state logic                ////
29
////   - fix avant! two-port ram                                  ////
30
////   - add additional RAMs (Altera etc)                         ////
31
////                                                              ////
32
////  Author(s):                                                  ////
33
////      - Damjan Lampret, lampret@opencores.org                 ////
34
////                                                              ////
35
//////////////////////////////////////////////////////////////////////
36
////                                                              ////
37
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
38
////                                                              ////
39
//// This source file may be used and distributed without         ////
40
//// restriction provided that this copyright statement is not    ////
41
//// removed from the file and that any derivative work contains  ////
42
//// the original copyright notice and the associated disclaimer. ////
43
////                                                              ////
44
//// This source file is free software; you can redistribute it   ////
45
//// and/or modify it under the terms of the GNU Lesser General   ////
46
//// Public License as published by the Free Software Foundation; ////
47
//// either version 2.1 of the License, or (at your option) any   ////
48
//// later version.                                               ////
49
////                                                              ////
50
//// This source is distributed in the hope that it will be       ////
51
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
52
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
53
//// PURPOSE.  See the GNU Lesser General Public License for more ////
54
//// details.                                                     ////
55
////                                                              ////
56
//// You should have received a copy of the GNU Lesser General    ////
57
//// Public License along with this source; if not, download it   ////
58
//// from http://www.opencores.org/lgpl.shtml                     ////
59
////                                                              ////
60
//////////////////////////////////////////////////////////////////////
61
//
62
// CVS Revision History
63
//
64
// $Log: not supported by cvs2svn $
65 1063 lampret
// Revision 1.1  2002/01/03 08:16:15  lampret
66
// New prefixes for RTL files, prefixed module names. Updated cache controllers and MMUs.
67
//
68 504 lampret
// Revision 1.8  2001/11/02 18:57:14  lampret
69
// Modified virtual silicon instantiations.
70
//
71
// Revision 1.7  2001/10/21 17:57:16  lampret
72
// 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.
73
//
74
// Revision 1.6  2001/10/14 13:12:09  lampret
75
// MP3 version.
76
//
77
// Revision 1.1.1.1  2001/10/06 10:18:36  igorm
78
// no message
79
//
80
// Revision 1.1  2001/08/09 13:39:33  lampret
81
// Major clean-up.
82
//
83
// Revision 1.2  2001/07/30 05:38:02  lampret
84
// Adding empty directories required by HDL coding guidelines
85
//
86
//
87
 
88
// synopsys translate_off
89
`include "timescale.v"
90
// synopsys translate_on
91
`include "or1200_defines.v"
92
 
93
module or1200_spram_2048x32(
94 1063 lampret
`ifdef OR1200_BIST
95
        // RAM BIST
96
        scanb_rst, scanb_si, scanb_so, scanb_en, scanb_clk,
97
`endif
98 504 lampret
        // Generic synchronous single-port RAM interface
99
        clk, rst, ce, we, oe, addr, di, do
100
);
101
 
102
//
103
// Default address and data buses width
104
//
105
parameter aw = 11;
106
parameter dw = 32;
107
 
108 1063 lampret
`ifdef OR1200_BIST
109 504 lampret
//
110 1063 lampret
// RAM BIST
111
//
112
input                   scanb_rst,
113
                        scanb_si,
114
                        scanb_en,
115
                        scanb_clk;
116
output                  scanb_so;
117
`endif
118
 
119
//
120 504 lampret
// Generic synchronous single-port RAM interface
121
//
122
input                   clk;    // Clock
123
input                   rst;    // Reset
124
input                   ce;     // Chip enable input
125
input                   we;     // Write enable input
126
input                   oe;     // Output enable input
127
input   [aw-1:0] addr;   // address bus inputs
128
input   [dw-1:0] di;     // input data bus
129
output  [dw-1:0] do;     // output data bus
130
 
131
//
132
// Internal wires and registers
133
//
134
 
135 1063 lampret
`ifdef OR1200_VIRTUALSILICON_SSP
136
`else
137
`ifdef OR1200_BIST
138
assign scanb_so = scanb_si;
139
`endif
140
`endif
141 504 lampret
 
142
`ifdef OR1200_ARTISAN_SSP
143
 
144
//
145
// Instantiation of ASIC memory:
146
//
147
// Artisan Synchronous Single-Port RAM (ra1sh)
148
//
149
`ifdef UNUSED
150
art_hdsp_2048x32 #(dw, 1<<aw, aw) artisan_ssp(
151
`else
152
art_hdsp_2048x32 artisan_ssp(
153
`endif
154
        .clk(clk),
155
        .cen(~ce),
156
        .wen(~we),
157
        .a(addr),
158
        .d(di),
159
        .oen(~oe),
160
        .q(do)
161
);
162
 
163
`else
164
 
165
`ifdef OR1200_AVANT_ATP
166
 
167
//
168
// Instantiation of ASIC memory:
169
//
170
// Avant! Asynchronous Two-Port RAM
171
//
172
avant_atp avant_atp(
173
        .web(~we),
174
        .reb(),
175
        .oeb(~oe),
176
        .rcsb(),
177
        .wcsb(),
178
        .ra(addr),
179
        .wa(addr),
180
        .di(di),
181
        .do(do)
182
);
183
 
184
`else
185
 
186
`ifdef OR1200_VIRAGE_SSP
187
 
188
//
189
// Instantiation of ASIC memory:
190
//
191
// Virage Synchronous 1-port R/W RAM
192
//
193
virage_ssp virage_ssp(
194
        .clk(clk),
195
        .adr(addr),
196
        .d(di),
197
        .we(we),
198
        .oe(oe),
199
        .me(ce),
200
        .q(do)
201
);
202
 
203
`else
204
 
205
`ifdef OR1200_VIRTUALSILICON_SSP
206
 
207
//
208
// Instantiation of ASIC memory:
209
//
210
// Virtual Silicon Single-Port Synchronous SRAM
211
//
212
`ifdef UNUSED
213
vs_hdsp_2048x32 #(1<<aw, aw-1, dw-1) vs_ssp(
214
`else
215 1063 lampret
`ifdef OR1200_BIST
216
vs_hdsp_2048x32_bist vs_ssp(
217
`else
218 504 lampret
vs_hdsp_2048x32 vs_ssp(
219
`endif
220 1063 lampret
`endif
221
`ifdef OR1200_BIST
222
        // RAM BIST
223
        .scanb_rst(scanb_rst),
224
        .scanb_si(scanb_si),
225
        .scanb_so(scanb_so),
226
        .scanb_en(scanb_en),
227
        .canb_clk(scanb_clk),
228
`endif
229 504 lampret
        .CK(clk),
230
        .ADR(addr),
231
        .DI(di),
232
        .WEN(~we),
233
        .CEN(~ce),
234
        .OEN(~oe),
235
        .DOUT(do)
236
);
237
 
238
`else
239
 
240
`ifdef OR1200_XILINX_RAMB4
241
 
242
//
243
// Instantiation of FPGA memory:
244
//
245
// Virtex/Spartan2
246
//
247
 
248
//
249
// Block 0
250
//
251
RAMB4_S2 ramb4_s2_0(
252
        .CLK(clk),
253
        .RST(rst),
254
        .ADDR(addr),
255
        .DI(di[1:0]),
256
        .EN(ce),
257
        .WE(we),
258
        .DO(do[1:0])
259
);
260
 
261
//
262
// Block 1
263
//
264
RAMB4_S2 ramb4_s2_1(
265
        .CLK(clk),
266
        .RST(rst),
267
        .ADDR(addr),
268
        .DI(di[3:2]),
269
        .EN(ce),
270
        .WE(we),
271
        .DO(do[3:2])
272
);
273
 
274
//
275
// Block 2
276
//
277
RAMB4_S2 ramb4_s2_2(
278
        .CLK(clk),
279
        .RST(rst),
280
        .ADDR(addr),
281
        .DI(di[5:4]),
282
        .EN(ce),
283
        .WE(we),
284
        .DO(do[5:4])
285
);
286
 
287
//
288
// Block 3
289
//
290
RAMB4_S2 ramb4_s2_3(
291
        .CLK(clk),
292
        .RST(rst),
293
        .ADDR(addr),
294
        .DI(di[7:6]),
295
        .EN(ce),
296
        .WE(we),
297
        .DO(do[7:6])
298
);
299
 
300
//
301
// Block 4
302
//
303
RAMB4_S2 ramb4_s2_4(
304
        .CLK(clk),
305
        .RST(rst),
306
        .ADDR(addr),
307
        .DI(di[9:8]),
308
        .EN(ce),
309
        .WE(we),
310
        .DO(do[9:8])
311
);
312
 
313
//
314
// Block 5
315
//
316
RAMB4_S2 ramb4_s2_5(
317
        .CLK(clk),
318
        .RST(rst),
319
        .ADDR(addr),
320
        .DI(di[11:10]),
321
        .EN(ce),
322
        .WE(we),
323
        .DO(do[11:10])
324
);
325
 
326
//
327
// Block 6
328
//
329
RAMB4_S2 ramb4_s2_6(
330
        .CLK(clk),
331
        .RST(rst),
332
        .ADDR(addr),
333
        .DI(di[13:12]),
334
        .EN(ce),
335
        .WE(we),
336
        .DO(do[13:12])
337
);
338
 
339
//
340
// Block 7
341
//
342
RAMB4_S2 ramb4_s2_7(
343
        .CLK(clk),
344
        .RST(rst),
345
        .ADDR(addr),
346
        .DI(di[15:14]),
347
        .EN(ce),
348
        .WE(we),
349
        .DO(do[15:14])
350
);
351
 
352
//
353
// Block 8
354
//
355
RAMB4_S2 ramb4_s2_8(
356
        .CLK(clk),
357
        .RST(rst),
358
        .ADDR(addr),
359
        .DI(di[17:16]),
360
        .EN(ce),
361
        .WE(we),
362
        .DO(do[17:16])
363
);
364
 
365
//
366
// Block 9
367
//
368
RAMB4_S2 ramb4_s2_9(
369
        .CLK(clk),
370
        .RST(rst),
371
        .ADDR(addr),
372
        .DI(di[19:18]),
373
        .EN(ce),
374
        .WE(we),
375
        .DO(do[19:18])
376
);
377
 
378
//
379
// Block 10
380
//
381
RAMB4_S2 ramb4_s2_10(
382
        .CLK(clk),
383
        .RST(rst),
384
        .ADDR(addr),
385
        .DI(di[21:20]),
386
        .EN(ce),
387
        .WE(we),
388
        .DO(do[21:20])
389
);
390
 
391
//
392
// Block 11
393
//
394
RAMB4_S2 ramb4_s2_11(
395
        .CLK(clk),
396
        .RST(rst),
397
        .ADDR(addr),
398
        .DI(di[23:22]),
399
        .EN(ce),
400
        .WE(we),
401
        .DO(do[23:22])
402
);
403
 
404
//
405
// Block 12
406
//
407
RAMB4_S2 ramb4_s2_12(
408
        .CLK(clk),
409
        .RST(rst),
410
        .ADDR(addr),
411
        .DI(di[25:24]),
412
        .EN(ce),
413
        .WE(we),
414
        .DO(do[25:24])
415
);
416
 
417
//
418
// Block 13
419
//
420
RAMB4_S2 ramb4_s2_13(
421
        .CLK(clk),
422
        .RST(rst),
423
        .ADDR(addr),
424
        .DI(di[27:26]),
425
        .EN(ce),
426
        .WE(we),
427
        .DO(do[27:26])
428
);
429
 
430
//
431
// Block 14
432
//
433
RAMB4_S2 ramb4_s2_14(
434
        .CLK(clk),
435
        .RST(rst),
436
        .ADDR(addr),
437
        .DI(di[29:28]),
438
        .EN(ce),
439
        .WE(we),
440
        .DO(do[29:28])
441
);
442
 
443
//
444
// Block 15
445
//
446
RAMB4_S2 ramb4_s2_15(
447
        .CLK(clk),
448
        .RST(rst),
449
        .ADDR(addr),
450
        .DI(di[31:30]),
451
        .EN(ce),
452
        .WE(we),
453
        .DO(do[31:30])
454
);
455
 
456
`else
457
 
458
//
459
// Generic single-port synchronous RAM model
460
//
461
 
462
//
463
// Generic RAM's registers and wires
464
//
465
reg     [dw-1:0] mem [(1<<aw)-1:0];       // RAM content
466
reg     [dw-1:0] do_reg;                 // RAM data output register
467
 
468
//
469
// Data output drivers
470
//
471
assign do = (oe) ? do_reg : {dw{1'bz}};
472
 
473
//
474
// RAM read and write
475
//
476
always @(posedge clk)
477
        if (ce && !we)
478
                do_reg <= #1 mem[addr];
479
        else if (ce && we)
480
                mem[addr] <= #1 di;
481
 
482
`endif  // !OR1200_XILINX_RAMB4_S16
483
`endif  // !OR1200_VIRTUALSILICON_SSP
484
`endif  // !OR1200_VIRAGE_SSP
485
`endif  // !OR1200_AVANT_ATP
486
`endif  // !OR1200_ARTISAN_SSP
487
 
488
endmodule

powered by: WebSVN 2.1.0

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