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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1200/] [rtl/] [verilog/] [or1200_spram_128x32.v] - Blame information for rev 67

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

Line No. Rev Author Line
1 10 unneback
//////////////////////////////////////////////////////////////////////
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
////                                                              ////
20
////  Supported FPGA RAMs are:                                    ////
21
////  - Xilinx Virtex RAMB16                                      ////
22
////  - Xilinx Virtex RAMB4                                       ////
23
////                                                              ////
24
////  To Do:                                                      ////
25
////   - add support for other RAM's                              ////
26
////   - xilinx rams need external tri-state logic                ////
27
////   - fix avant! two-port ram                                  ////
28
////   - add additional RAMs                                      ////
29
////                                                              ////
30
////  Author(s):                                                  ////
31
////      - Damjan Lampret, lampret@opencores.org                 ////
32
////                                                              ////
33
//////////////////////////////////////////////////////////////////////
34
////                                                              ////
35
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
36
////                                                              ////
37
//// This source file may be used and distributed without         ////
38
//// restriction provided that this copyright statement is not    ////
39
//// removed from the file and that any derivative work contains  ////
40
//// the original copyright notice and the associated disclaimer. ////
41
////                                                              ////
42
//// This source file is free software; you can redistribute it   ////
43
//// and/or modify it under the terms of the GNU Lesser General   ////
44
//// Public License as published by the Free Software Foundation; ////
45
//// either version 2.1 of the License, or (at your option) any   ////
46
//// later version.                                               ////
47
////                                                              ////
48
//// This source is distributed in the hope that it will be       ////
49
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
50
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
51
//// PURPOSE.  See the GNU Lesser General Public License for more ////
52
//// details.                                                     ////
53
////                                                              ////
54
//// You should have received a copy of the GNU Lesser General    ////
55
//// Public License along with this source; if not, download it   ////
56
//// from http://www.opencores.org/lgpl.shtml                     ////
57
////                                                              ////
58
//////////////////////////////////////////////////////////////////////
59
//
60
// CVS Revision History
61
//
62
// $Log: not supported by cvs2svn $
63
// Revision 1.2  2004/06/08 18:15:32  lampret
64
// Changed behavior of the simulation generic models
65
//
66
// Revision 1.1  2004/04/08 11:00:46  simont
67
// Add support for 512B instruction cache.
68
//
69
//
70
//
71
 
72
// synopsys translate_off
73
`include "timescale.v"
74
// synopsys translate_on
75
`include "or1200_defines.v"
76
 
77
module or1200_spram_128x32(
78
`ifdef OR1200_BIST
79
        // RAM BIST
80
        mbist_si_i, mbist_so_o, mbist_ctrl_i,
81
`endif
82
        // Generic synchronous single-port RAM interface
83
        clk, rst, ce, we, oe, addr, di, doq
84
);
85
 
86
//
87
// Default address and data buses width
88
//
89
parameter aw = 7;
90
parameter dw = 32;
91
 
92
`ifdef OR1200_BIST
93
//
94
// RAM BIST
95
//
96
input mbist_si_i;
97
input [`OR1200_MBIST_CTRL_WIDTH - 1:0] mbist_ctrl_i;
98
output mbist_so_o;
99
`endif
100
 
101
//
102
// Generic synchronous single-port RAM interface
103
//
104
input                   clk;    // Clock
105
input                   rst;    // Reset
106
input                   ce;     // Chip enable input
107
input                   we;     // Write enable input
108
input                   oe;     // Output enable input
109
input   [aw-1:0] addr;   // address bus inputs
110
input   [dw-1:0] di;     // input data bus
111
output  [dw-1:0] doq;    // output data bus
112
 
113
//
114
// Internal wires and registers
115
//
116
 
117
`ifdef OR1200_ARTISAN_SSP
118
`else
119
`ifdef OR1200_VIRTUALSILICON_SSP
120
`else
121
`ifdef OR1200_BIST
122
`endif
123
`endif
124
`endif
125
 
126
`ifdef OR1200_ARTISAN_SSP
127
 
128
//
129
// Instantiation of ASIC memory:
130
//
131
// Artisan Synchronous Single-Port RAM (ra1sh)
132
//
133
`ifdef UNUSED
134
`else
135
`ifdef OR1200_BIST
136
`else
137
`endif
138
`endif
139
`ifdef OR1200_BIST
140
`endif
141
`else
142
 
143
`ifdef OR1200_AVANT_ATP
144
 
145
//
146
// Instantiation of ASIC memory:
147
//
148
// Avant! Asynchronous Two-Port RAM
149
//
150
 
151
`else
152
 
153
`ifdef OR1200_VIRAGE_SSP
154
 
155
//
156
// Instantiation of ASIC memory:
157
//
158
// Virage Synchronous 1-port R/W RAM
159
//
160
 
161
`else
162
 
163
`ifdef OR1200_VIRTUALSILICON_SSP
164
 
165
//
166
// Instantiation of ASIC memory:
167
//
168
// Virtual Silicon Single-Port Synchronous SRAM
169
//
170
`ifdef UNUSED
171
`else
172
`ifdef OR1200_BIST
173
`else
174
`endif
175
`endif
176
`ifdef OR1200_BIST
177
        // RAM BIST
178
`endif
179
 
180
`else
181
 
182
`ifdef OR1200_XILINX_RAMB4
183
 
184
//
185
// Instantiation of FPGA memory:
186
//
187
// Virtex/Spartan2
188
//
189
 
190
//
191
// Block 0
192
//
193
RAMB4_S16 ramb4_s16_0(
194
        .CLK(clk),
195
        .RST(rst),
196
        .ADDR({1'b0, addr}),
197
        .DI(di[15:0]),
198
        .EN(ce),
199
        .WE(we),
200
        .DO(doq[15:0])
201
);
202
 
203
//
204
// Block 1
205
//
206
RAMB4_S16 ramb4_s16_1(
207
        .CLK(clk),
208
        .RST(rst),
209
        .ADDR({1'b0, addr}),
210
        .DI(di[31:16]),
211
        .EN(ce),
212
        .WE(we),
213
        .DO(doq[31:16])
214
);
215
 
216
`else
217
 
218
`ifdef OR1200_XILINX_RAMB16
219
 
220
//
221
// Instantiation of FPGA memory:
222
//
223
// Virtex4/Spartan3E
224
//
225
// Added By Nir Mor
226
//
227
 
228
RAMB16_S36 ramb16_s36(
229
        .CLK(clk),
230
        .SSR(rst),
231
        .ADDR({2'b00, addr}),
232
        .DI(di),
233
        .DIP(4'h0),
234
        .EN(ce),
235
        .WE(we),
236
        .DO(doq),
237
        .DOP()
238
);
239
 
240
`else
241
 
242
//
243
// Generic single-port synchronous RAM model
244
//
245
 
246
//
247
// Generic RAM's registers and wires
248
//
249
reg     [dw-1:0] mem [(1<<aw)-1:0];       // RAM content
250
reg     [aw-1:0] addr_reg;               // RAM address register
251
 
252
//
253
// Data output drivers
254
//
255
assign doq = (oe) ? mem[addr_reg] : {dw{1'b0}};
256
 
257
//
258
// RAM address register
259
//
260
always @(posedge clk or posedge rst)
261
        if (rst)
262
                addr_reg <= #1 {aw{1'b0}};
263
        else if (ce)
264
                addr_reg <= #1 addr;
265
 
266
//
267
// RAM write
268
//
269
always @(posedge clk)
270
        if (ce && we)
271
                mem[addr] <= #1 di;
272
 
273
`endif  // !OR1200_XILINX_RAMB16
274
`endif  // !OR1200_XILINX_RAMB4
275
`endif  // !OR1200_VIRTUALSILICON_SSP
276
`endif  // !OR1200_VIRAGE_SSP
277
`endif  // !OR1200_AVANT_ATP
278
`endif  // !OR1200_ARTISAN_SSP
279
 
280
endmodule

powered by: WebSVN 2.1.0

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