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

Subversion Repositories or1k

[/] [or1k/] [tags/] [rel_21/] [or1200/] [rtl/] [verilog/] [or1200_spram_256x21.v] - Blame information for rev 1129

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 1129 lampret
////  - Altera LPM                                                ////
27 504 lampret
////                                                              ////
28
////  To Do:                                                      ////
29
////   - xilinx rams need external tri-state logic                ////
30
////   - fix avant! two-port ram                                  ////
31 1129 lampret
////   - add additional RAMs                                      ////
32 504 lampret
////                                                              ////
33
////  Author(s):                                                  ////
34
////      - Damjan Lampret, lampret@opencores.org                 ////
35
////                                                              ////
36
//////////////////////////////////////////////////////////////////////
37
////                                                              ////
38
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
39
////                                                              ////
40
//// This source file may be used and distributed without         ////
41
//// restriction provided that this copyright statement is not    ////
42
//// removed from the file and that any derivative work contains  ////
43
//// the original copyright notice and the associated disclaimer. ////
44
////                                                              ////
45
//// This source file is free software; you can redistribute it   ////
46
//// and/or modify it under the terms of the GNU Lesser General   ////
47
//// Public License as published by the Free Software Foundation; ////
48
//// either version 2.1 of the License, or (at your option) any   ////
49
//// later version.                                               ////
50
////                                                              ////
51
//// This source is distributed in the hope that it will be       ////
52
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
53
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
54
//// PURPOSE.  See the GNU Lesser General Public License for more ////
55
//// details.                                                     ////
56
////                                                              ////
57
//// You should have received a copy of the GNU Lesser General    ////
58
//// Public License along with this source; if not, download it   ////
59
//// from http://www.opencores.org/lgpl.shtml                     ////
60
////                                                              ////
61
//////////////////////////////////////////////////////////////////////
62
//
63
// CVS Revision History
64
//
65
// $Log: not supported by cvs2svn $
66 1129 lampret
// Revision 1.2  2002/10/17 20:04:40  lampret
67
// Added BIST scan. Special VS RAMs need to be used to implement BIST.
68
//
69 1063 lampret
// Revision 1.1  2002/01/03 08:16:15  lampret
70
// New prefixes for RTL files, prefixed module names. Updated cache controllers and MMUs.
71
//
72 504 lampret
// Revision 1.10  2001/11/27 21:24:04  lampret
73
// Changed instantiation name of VS RAMs.
74
//
75
// Revision 1.9  2001/11/27 19:45:04  lampret
76
// Fixed VS RAM instantiation - again.
77
//
78
// Revision 1.8  2001/11/23 21:42:31  simons
79
// Program counter divided to PPC and NPC.
80
//
81
// Revision 1.6  2001/10/21 17:57:16  lampret
82
// 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.
83
//
84
// Revision 1.5  2001/10/14 13:12:09  lampret
85
// MP3 version.
86
//
87
// Revision 1.1.1.1  2001/10/06 10:18:36  igorm
88
// no message
89
//
90
// Revision 1.1  2001/08/09 13:39:33  lampret
91
// Major clean-up.
92
//
93
// Revision 1.2  2001/07/30 05:38:02  lampret
94
// Adding empty directories required by HDL coding guidelines
95
//
96
//
97
 
98
// synopsys translate_off
99
`include "timescale.v"
100
// synopsys translate_on
101
`include "or1200_defines.v"
102
 
103
module or1200_spram_256x21(
104 1063 lampret
`ifdef OR1200_BIST
105
        // RAM BIST
106
        scanb_rst, scanb_si, scanb_so, scanb_en, scanb_clk,
107
`endif
108 504 lampret
        // Generic synchronous single-port RAM interface
109
        clk, rst, ce, we, oe, addr, di, do
110
);
111
 
112
//
113
// Default address and data buses width
114
//
115
parameter aw = 8;
116
parameter dw = 21;
117
 
118 1063 lampret
`ifdef OR1200_BIST
119 504 lampret
//
120 1063 lampret
// RAM BIST
121
//
122
input                   scanb_rst,
123
                        scanb_si,
124
                        scanb_en,
125
                        scanb_clk;
126
output                  scanb_so;
127
`endif
128
 
129
//
130 504 lampret
// Generic synchronous single-port RAM interface
131
//
132
input                   clk;    // Clock
133
input                   rst;    // Reset
134
input                   ce;     // Chip enable input
135
input                   we;     // Write enable input
136
input                   oe;     // Output enable input
137
input   [aw-1:0] addr;   // address bus inputs
138
input   [dw-1:0] di;     // input data bus
139
output  [dw-1:0] do;     // output data bus
140
 
141
//
142
// Internal wires and registers
143
//
144
wire    [10:0]           unconnected;
145
 
146 1063 lampret
`ifdef OR1200_VIRTUALSILICON_SSP
147
`else
148
`ifdef OR1200_BIST
149
assign scanb_so = scanb_si;
150
`endif
151
`endif
152
 
153 504 lampret
`ifdef OR1200_ARTISAN_SSP
154
 
155
//
156
// Instantiation of ASIC memory:
157
//
158
// Artisan Synchronous Single-Port RAM (ra1sh)
159
//
160
`ifdef UNUSED
161
art_hssp_256x21 #(dw, 1<<aw, aw) artisan_ssp(
162
`else
163
art_hssp_256x21 artisan_ssp(
164
`endif
165
        .clk(clk),
166
        .cen(~ce),
167
        .wen(~we),
168
        .a(addr),
169
        .d(di),
170
        .oen(~oe),
171
        .q(do)
172
);
173
 
174
`else
175
 
176
`ifdef OR1200_AVANT_ATP
177
 
178
//
179
// Instantiation of ASIC memory:
180
//
181
// Avant! Asynchronous Two-Port RAM
182
//
183
avant_atp avant_atp(
184
        .web(~we),
185
        .reb(),
186
        .oeb(~oe),
187
        .rcsb(),
188
        .wcsb(),
189
        .ra(addr),
190
        .wa(addr),
191
        .di(di),
192
        .do(do)
193
);
194
 
195
`else
196
 
197
`ifdef OR1200_VIRAGE_SSP
198
 
199
//
200
// Instantiation of ASIC memory:
201
//
202
// Virage Synchronous 1-port R/W RAM
203
//
204
virage_ssp virage_ssp(
205
        .clk(clk),
206
        .adr(addr),
207
        .d(di),
208
        .we(we),
209
        .oe(oe),
210
        .me(ce),
211
        .q(do)
212
);
213
 
214
`else
215
 
216
`ifdef OR1200_VIRTUALSILICON_SSP
217
 
218
//
219
// Instantiation of ASIC memory:
220
//
221
// Virtual Silicon Single-Port Synchronous SRAM
222
//
223
`ifdef UNUSED
224
vs_hdsp_256x21 #(1<<aw, aw-1, dw-1) vs_ssp(
225
`else
226 1063 lampret
`ifdef OR1200_BIST
227
vs_hdsp_256x21_bist vs_ssp(
228
`else
229 504 lampret
vs_hdsp_256x21 vs_ssp(
230
`endif
231 1063 lampret
`endif
232
`ifdef OR1200_BIST
233
        // RAM BIST
234
        .scanb_rst(scanb_rst),
235
        .scanb_si(scanb_si),
236
        .scanb_so(scanb_so),
237
        .scanb_en(scanb_en),
238
        .scanb_clk(scanb_clk),
239
`endif
240 504 lampret
        .CK(clk),
241
        .ADR(addr),
242
        .DI(di),
243
        .WEN(~we),
244
        .CEN(~ce),
245
        .OEN(~oe),
246
        .DOUT(do)
247
);
248
 
249
`else
250
 
251
`ifdef OR1200_XILINX_RAMB4
252
 
253
//
254
// Instantiation of FPGA memory:
255
//
256
// Virtex/Spartan2
257
//
258
 
259
//
260
// Block 0
261
//
262
RAMB4_S16 ramb4_s16_0(
263
        .CLK(clk),
264
        .RST(rst),
265
        .ADDR(addr),
266
        .DI(di[15:0]),
267
        .EN(ce),
268
        .WE(we),
269
        .DO(do[15:0])
270
);
271
 
272
//
273
// Block 1
274
//
275
RAMB4_S16 ramb4_s16_1(
276
        .CLK(clk),
277
        .RST(rst),
278
        .ADDR(addr),
279
        .DI({11'b00000000000, di[20:16]}),
280
        .EN(ce),
281
        .WE(we),
282
        .DO({unconnected, do[20:16]})
283
);
284
 
285
`else
286
 
287 1129 lampret
`ifdef OR1200_ALTERA_LPM
288
 
289 504 lampret
//
290 1129 lampret
// Instantiation of FPGA memory:
291
//
292
// Altera LPM
293
//
294
// Added By Jamil Khatib
295
//
296
 
297
wire    wr;
298
 
299
assign  wr = ce & we;
300
 
301
initial $display("Using Altera LPM.");
302
 
303
lpm_ram_dq lpm_ram_dq_component (
304
        .address(addr),
305
        .inclock(clk),
306
        .outclock(clk),
307
        .data(di),
308
        .we(wr),
309
        .q(do)
310
);
311
 
312
defparam lpm_ram_dq_component.lpm_width = dw,
313
        lpm_ram_dq_component.lpm_widthad = aw,
314
        lpm_ram_dq_component.lpm_indata = "REGISTERED",
315
        lpm_ram_dq_component.lpm_address_control = "REGISTERED",
316
        lpm_ram_dq_component.lpm_outdata = "UNREGISTERED",
317
        lpm_ram_dq_component.lpm_hint = "USE_EAB=ON";
318
        // examplar attribute lpm_ram_dq_component NOOPT TRUE
319
 
320
`else
321
 
322
//
323 504 lampret
// Generic single-port synchronous RAM model
324
//
325
 
326
//
327
// Generic RAM's registers and wires
328
//
329
reg     [dw-1:0] mem [(1<<aw)-1:0];       // RAM content
330
reg     [dw-1:0] do_reg;                 // RAM data output register
331
 
332
//
333
// Data output drivers
334
//
335 1129 lampret
assign do = (oe) ? do_reg : {dw{1'b0}};
336 504 lampret
 
337
//
338
// RAM read and write
339
//
340
always @(posedge clk)
341
        if (ce && !we)
342
                do_reg <= #1 mem[addr];
343
        else if (ce && we)
344
                mem[addr] <= #1 di;
345
 
346 1129 lampret
`endif  // !OR1200_ALTERA_LPM
347 504 lampret
`endif  // !OR1200_XILINX_RAMB4_S16
348
`endif  // !OR1200_VIRTUALSILICON_SSP
349
`endif  // !OR1200_VIRAGE_SSP
350
`endif  // !OR1200_AVANT_ATP
351
`endif  // !OR1200_ARTISAN_SSP
352
 
353
endmodule

powered by: WebSVN 2.1.0

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