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

Subversion Repositories or1k

[/] [or1k/] [branches/] [mp3_stable/] [mp3/] [rtl/] [verilog/] [or1200.xcv/] [generic_spram_64x37.v] - Blame information for rev 1765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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