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

Subversion Repositories or1k

[/] [or1k/] [tags/] [rel_26/] [or1200/] [rtl/] [verilog/] [or1200_spram_64x22.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.7  2001/11/02 18:57:14  lampret
69
// Modified virtual silicon instantiations.
70
//
71
// Revision 1.6  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.5  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_64x22(
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 = 6;
106
parameter dw = 22;
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
wire    [9:0]            unconnected;
135
 
136 1063 lampret
`ifdef OR1200_VIRTUALSILICON_SSP
137
`else
138
`ifdef OR1200_BIST
139
assign scanb_so = scanb_si;
140
`endif
141
`endif
142
 
143 504 lampret
`ifdef OR1200_ARTISAN_SSP
144
 
145
//
146
// Instantiation of ASIC memory:
147
//
148
// Artisan Synchronous Single-Port RAM (ra1sh)
149
//
150
`ifdef UNUSED
151
art_hssp_64x22 #(dw, 1<<aw, aw) artisan_ssp(
152
`else
153
art_hssp_64x22 artisan_ssp(
154
`endif
155
        .clk(clk),
156
        .cen(~ce),
157
        .wen(~we),
158
        .a(addr),
159
        .d(di),
160
        .oen(~oe),
161
        .q(do)
162
);
163
 
164
`else
165
 
166
`ifdef OR1200_AVANT_ATP
167
 
168
//
169
// Instantiation of ASIC memory:
170
//
171
// Avant! Asynchronous Two-Port RAM
172
//
173
avant_atp avant_atp(
174
        .web(~we),
175
        .reb(),
176
        .oeb(~oe),
177
        .rcsb(),
178
        .wcsb(),
179
        .ra(addr),
180
        .wa(addr),
181
        .di(di),
182
        .do(do)
183
);
184
 
185
`else
186
 
187
`ifdef OR1200_VIRAGE_SSP
188
 
189
//
190
// Instantiation of ASIC memory:
191
//
192
// Virage Synchronous 1-port R/W RAM
193
//
194
virage_ssp virage_ssp(
195
        .clk(clk),
196
        .adr(addr),
197
        .d(di),
198
        .we(we),
199
        .oe(oe),
200
        .me(ce),
201
        .q(do)
202
);
203
 
204
`else
205
 
206
`ifdef OR1200_VIRTUALSILICON_SSP
207
 
208
//
209
// Instantiation of ASIC memory:
210
//
211
// Virtual Silicon Single-Port Synchronous SRAM
212
//
213
`ifdef UNUSED
214
vs_hdsp_64x22 #(1<<aw, aw-1, dw-1) vs_ssp(
215
`else
216 1063 lampret
`ifdef OR1200_BIST
217
vs_hdsp_64x22_bist vs_ssp(
218
`else
219 504 lampret
vs_hdsp_64x22 vs_ssp(
220
`endif
221 1063 lampret
`endif
222
`ifdef OR1200_BIST
223
        // RAM BIST
224
        .scanb_rst(scanb_rst),
225
        .scanb_si(scanb_si),
226
        .scanb_so(scanb_so),
227
        .scanb_en(scanb_en),
228
        .scanb_clk(scanb_clk),
229
`endif
230 504 lampret
        .CK(clk),
231
        .ADR(addr),
232
        .DI(di),
233
        .WEN(~we),
234
        .CEN(~ce),
235
        .OEN(~oe),
236
        .DOUT(do)
237
);
238
 
239
`else
240
 
241
`ifdef OR1200_XILINX_RAMB4
242
 
243
//
244
// Instantiation of FPGA memory:
245
//
246
// Virtex/Spartan2
247
//
248
 
249
//
250
// Block 0
251
//
252
RAMB4_S16 ramb4_s16_0(
253
        .CLK(clk),
254
        .RST(rst),
255
        .ADDR({2'b00, addr}),
256
        .DI(di[15:0]),
257
        .EN(ce),
258
        .WE(we),
259
        .DO(do[15:0])
260
);
261
 
262
//
263
// Block 1
264
//
265
RAMB4_S16 ramb4_s16_1(
266
        .CLK(clk),
267
        .RST(rst),
268
        .ADDR({2'b00, addr}),
269
        .DI({unconnected, di[21:16]}),
270
        .EN(ce),
271
        .WE(we),
272
        .DO({unconnected, do[21:16]})
273
);
274
 
275
`else
276
 
277
//
278
// Generic single-port synchronous RAM model
279
//
280
 
281
//
282
// Generic RAM's registers and wires
283
//
284
reg     [dw-1:0] mem [(1<<aw)-1:0];       // RAM content
285
reg     [dw-1:0] do_reg;                 // RAM data output register
286
 
287
//
288
// Data output drivers
289
//
290
assign do = (oe) ? do_reg : {dw{1'bz}};
291
 
292
//
293
// RAM read and write
294
//
295
always @(posedge clk)
296
        if (ce && !we)
297
                do_reg <= #1 mem[addr];
298
        else if (ce && we)
299
                mem[addr] <= #1 di;
300
 
301
`endif  // !OR1200_XILINX_RAMB4_S16
302
`endif  // !OR1200_VIRTUALSILICON_SSP
303
`endif  // !OR1200_VIRAGE_SSP
304
`endif  // !OR1200_AVANT_ATP
305
`endif  // !OR1200_ARTISAN_SSP
306
 
307
endmodule

powered by: WebSVN 2.1.0

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