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

Subversion Repositories or1k

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

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

Line No. Rev Author Line
1 168 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 203 lampret
// Revision 1.1  2001/08/09 13:39:33  lampret
66
// Major clean-up.
67
//
68 168 lampret
// Revision 1.2  2001/07/30 05:38:02  lampret
69
// Adding empty directories required by HDL coding guidelines
70
//
71
//
72
 
73 203 lampret
// synopsys translate_off
74 168 lampret
`include "timescale.v"
75 203 lampret
// synopsys translate_on
76
`include "defines.v"
77 168 lampret
 
78
module generic_spram_2048x8(
79
        // Generic synchronous single-port RAM interface
80
        clk, rst, ce, we, oe, addr, di, do
81
);
82
 
83
//
84
// Default address and data buses width
85
//
86
parameter aw = 11;
87
parameter dw = 8;
88
 
89
//
90
// Generic synchronous single-port RAM interface
91
//
92
input                   clk;    // Clock
93
input                   rst;    // Reset
94
input                   ce;     // Chip enable input
95
input                   we;     // Write enable input
96
input                   oe;     // Output enable input
97
input   [aw-1:0] addr;   // address bus inputs
98
input   [dw-1:0] di;     // input data bus
99
output  [dw-1:0] do;     // output data bus
100
 
101
//
102
// Internal wires and registers
103
//
104
 
105
 
106
`ifdef ARTISAN_SSP
107
 
108
//
109
// Instantiation of ASIC memory:
110
//
111
// Artisan Synchronous Single-Port RAM (ra1sh)
112
//
113 203 lampret
art_hssp_2048x8 #(dw, 1<<aw, aw) artisan_ssp(
114 168 lampret
        .clk(clk),
115
        .cen(~ce),
116
        .wen(~we),
117
        .a(addr),
118
        .d(di),
119
        .oen(~oe),
120
        .q(do)
121
);
122
 
123
`else
124
 
125
`ifdef AVANT_ATP
126
 
127
//
128
// Instantiation of ASIC memory:
129
//
130
// Avant! Asynchronous Two-Port RAM
131
//
132
avant_atp avant_atp(
133
        .web(~we),
134
        .reb(),
135
        .oeb(~oe),
136
        .rcsb(),
137
        .wcsb(),
138
        .ra(addr),
139
        .wa(addr),
140
        .di(di),
141
        .do(do)
142
);
143
 
144
`else
145
 
146
`ifdef VIRAGE_SSP
147
 
148
//
149
// Instantiation of ASIC memory:
150
//
151
// Virage Synchronous 1-port R/W RAM
152
//
153
virage_ssp virage_ssp(
154
        .clk(clk),
155
        .adr(addr),
156
        .d(di),
157
        .we(we),
158
        .oe(oe),
159
        .me(ce),
160
        .q(do)
161
);
162
 
163
`else
164
 
165
`ifdef VIRTUALSILICON_SSP
166
 
167
//
168
// Instantiation of ASIC memory:
169
//
170
// Virtual Silicon Single-Port Synchronous SRAM
171
//
172 203 lampret
virtualsilicon_ssp #(1<<aw, aw-1, dw-1) virtualsilicon_ssp(
173 168 lampret
        .CK(clk),
174
        .ADR(addr),
175
        .DI(di),
176
        .WEN(~we),
177
        .CEN(~ce),
178
        .OEN(~oe),
179
        .DOUT(do)
180
);
181
 
182
`else
183
 
184
`ifdef XILINX_RAMB4
185
 
186
//
187
// Instantiation of FPGA memory:
188
//
189
// Virtex/Spartan2
190
//
191
 
192
//
193
// Block 0
194
//
195
RAMB4_S2 ramb4_s2_0(
196
        .CLK(clk),
197
        .RST(rst),
198
        .ADDR(addr),
199
        .DI(di[1:0]),
200
        .EN(ce),
201
        .WE(we),
202
        .DO(do[1:0])
203
);
204
 
205
//
206
// Block 1
207
//
208
RAMB4_S2 ramb4_s2_1(
209
        .CLK(clk),
210
        .RST(rst),
211
        .ADDR(addr),
212
        .DI(di[3:2]),
213
        .EN(ce),
214
        .WE(we),
215
        .DO(do[3:2])
216
);
217
 
218
//
219
// Block 2
220
//
221
RAMB4_S2 ramb4_s2_2(
222
        .CLK(clk),
223
        .RST(rst),
224
        .ADDR(addr),
225
        .DI(di[5:4]),
226
        .EN(ce),
227
        .WE(we),
228
        .DO(do[5:4])
229
);
230
 
231
//
232
// Block 3
233
//
234
RAMB4_S2 ramb4_s2_3(
235
        .CLK(clk),
236
        .RST(rst),
237
        .ADDR(addr),
238
        .DI(di[7:6]),
239
        .EN(ce),
240
        .WE(we),
241
        .DO(do[7:6])
242
);
243
 
244
`else
245
 
246
//
247
// Generic single-port synchronous RAM model
248
//
249
 
250
//
251
// Generic RAM's registers and wires
252
//
253 203 lampret
reg     [dw-1:0] mem [(1<<aw)-1:0];       // RAM content
254 168 lampret
reg     [dw-1:0] do_reg;                 // RAM data output register
255
 
256
//
257
// Data output drivers
258
//
259
assign do = (oe) ? do_reg : {dw{1'bz}};
260
 
261
//
262
// RAM read and write
263
//
264
always @(posedge clk)
265
        if (ce && !we)
266
                do_reg <= #1 mem[addr];
267
        else if (ce && we)
268
                mem[addr] <= #1 di;
269
 
270
`endif  // !XILINX_RAMB4_S16
271
`endif  // !VIRTUALSILICON_SSP
272
`endif  // !VIRAGE_SSP
273
`endif  // !AVANT_ATP
274
`endif  // !ARTISAN_SSP
275
 
276
endmodule

powered by: WebSVN 2.1.0

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