1 //////////////////////////////////////////////////////////////////////
3 //// Generic Single-Port Synchronous RAM ////
5 //// This file is part of memory library available from ////
6 //// http://www.opencores.org/cvsweb.shtml/generic_memories/ ////
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. ////
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 ////
24 //// Supported FPGA RAMs are: ////
25 //// - Xilinx Virtex RAMB4_S16 ////
26 //// - Altera LPM ////
29 //// - xilinx rams need external tri-state logic ////
30 //// - fix avant! two-port ram ////
31 //// - add additional RAMs ////
34 //// - Damjan Lampret, lampret@opencores.org ////
36 //////////////////////////////////////////////////////////////////////
38 //// Copyright (C) 2000 Authors and OPENCORES.ORG ////
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. ////
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. ////
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 ////
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 ////
61 //////////////////////////////////////////////////////////////////////
63 // CVS Revision History
66 // Revision 1.2 2004/06/08 18:15:32 lampret
67 // Changed behavior of the simulation generic models
69 // Revision 1.1 2004/04/08 11:00:46 simont
70 // Add support for 512B instruction cache.
75 // synopsys translate_off
76 `include "timescale.v"
77 // synopsys translate_on
78 `include "or1200_defines.v"
80 module or1200_spram_32x24(
83 mbist_si_i
, mbist_so_o
, mbist_ctrl_i
,
85 // Generic synchronous single-port RAM interface
86 clk
, rst
, ce
, we
, oe
, addr
, di
, doq
90 // Default address and data buses width
100 input [`OR1200_MBIST_CTRL_WIDTH - 1:0] mbist_ctrl_i;
105 // Generic synchronous single-port RAM interface
109 input ce
; // Chip enable input
110 input we
; // Write enable input
111 input oe
; // Output enable input
112 input [aw
-1:0] addr
; // address bus inputs
113 input [dw
-1:0] di
; // input data bus
114 output [dw
-1:0] doq
; // output data bus
117 // Internal wires and registers
119 wire [31:24] unconnected
;
121 `ifdef OR1200_ARTISAN_SSP
123 `ifdef OR1200_VIRTUALSILICON_SSP
130 `ifdef OR1200_ARTISAN_SSP
133 // Instantiation of ASIC memory:
135 // Artisan Synchronous Single-Port RAM (ra1sh)
149 `ifdef OR1200_AVANT_ATP
152 // Instantiation of ASIC memory:
154 // Avant! Asynchronous Two-Port RAM
159 `ifdef OR1200_VIRAGE_SSP
162 // Instantiation of ASIC memory:
164 // Virage Synchronous 1-port R/W RAM
169 `ifdef OR1200_VIRTUALSILICON_SSP
172 // Instantiation of ASIC memory:
174 // Virtual Silicon Single-Port Synchronous SRAM
188 `ifdef OR1200_XILINX_RAMB4
191 // Instantiation of FPGA memory:
199 RAMB4_S16
ramb4_s16_0(
212 RAMB4_S16
ramb4_s16_1(
216 .
DI({8'h00
, di
[23:16]}),
219 .
DO({unconnected
, doq
[23:16]})
224 `ifdef OR1200_ALTERA_LPM
227 // Instantiation of FPGA memory:
231 // Added By Jamil Khatib
238 // Generic single-port synchronous RAM model
242 // Generic RAM's registers and wires
244 reg [dw
-1:0] mem
[(1<<aw
)-1:0]; // RAM content
245 reg [aw
-1:0] addr_reg
; // RAM address register
248 // Data output drivers
250 assign doq
= (oe
) ? mem
[addr_reg
] : {dw
{1'b0}};
253 // RAM address register
255 always @(posedge clk
or posedge rst
)
257 addr_reg
<= #1 {aw
{1'b0}};
264 always @(posedge clk
)
268 `endif // !OR1200_ALTERA_LPM
269 `endif // !OR1200_XILINX_RAMB4_S16
270 `endif // !OR1200_VIRTUALSILICON_SSP
271 `endif // !OR1200_VIRAGE_SSP
272 `endif // !OR1200_AVANT_ATP
273 `endif // !OR1200_ARTISAN_SSP