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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [orp/] [orp_soc/] [rtl/] [verilog/] [or1200.old/] [or1200_tpram_32x32.v] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 746 lampret
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  Generic Two-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 two-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
////  two-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 Double-Port Sync RAM                              ////
20
////  - Avant! Two-Port Sync RAM (*)                              ////
21
////  - Virage 2-port Sync RAM                                    ////
22
////                                                              ////
23
////  Supported FPGA RAMs are:                                    ////
24
////  - Xilinx Virtex RAMB4_S16_S16                               ////
25
////                                                              ////
26
////  To Do:                                                      ////
27
////   - fix Avant!                                               ////
28
////   - xilinx rams need external tri-state logic                ////
29
////   - add additional RAMs (Altera, VS etc)                     ////
30
////                                                              ////
31
////  Author(s):                                                  ////
32
////      - Damjan Lampret, lampret@opencores.org                 ////
33
////                                                              ////
34
//////////////////////////////////////////////////////////////////////
35
////                                                              ////
36
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
37
////                                                              ////
38
//// This source file may be used and distributed without         ////
39
//// restriction provided that this copyright statement is not    ////
40
//// removed from the file and that any derivative work contains  ////
41
//// the original copyright notice and the associated disclaimer. ////
42
////                                                              ////
43
//// This source file is free software; you can redistribute it   ////
44
//// and/or modify it under the terms of the GNU Lesser General   ////
45
//// Public License as published by the Free Software Foundation; ////
46
//// either version 2.1 of the License, or (at your option) any   ////
47
//// later version.                                               ////
48
////                                                              ////
49
//// This source is distributed in the hope that it will be       ////
50
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
51
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
52
//// PURPOSE.  See the GNU Lesser General Public License for more ////
53
//// details.                                                     ////
54
////                                                              ////
55
//// You should have received a copy of the GNU Lesser General    ////
56
//// Public License along with this source; if not, download it   ////
57
//// from http://www.opencores.org/lgpl.shtml                     ////
58
////                                                              ////
59
//////////////////////////////////////////////////////////////////////
60
//
61
// CVS Revision History
62
//
63
// $Log: not supported by cvs2svn $
64
// Revision 1.1  2002/01/03 08:16:15  lampret
65
// New prefixes for RTL files, prefixed module names. Updated cache controllers and MMUs.
66
//
67
// Revision 1.7  2001/10/21 17:57:16  lampret
68
// 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.
69
//
70
// Revision 1.6  2001/10/14 13:12:09  lampret
71
// MP3 version.
72
//
73
// Revision 1.1.1.1  2001/10/06 10:18:36  igorm
74
// no message
75
//
76
// Revision 1.1  2001/08/09 13:39:33  lampret
77
// Major clean-up.
78
//
79
// Revision 1.2  2001/07/30 05:38:02  lampret
80
// Adding empty directories required by HDL coding guidelines
81
//
82
//
83
 
84
// synopsys translate_off
85
`include "timescale.v"
86
// synopsys translate_on
87
`include "or1200_defines.v"
88
 
89
module or1200_tpram_32x32(
90
        // Generic synchronous two-port RAM interface
91
        clk_a, rst_a, ce_a, we_a, oe_a, addr_a, di_a, do_a,
92
        clk_b, rst_b, ce_b, we_b, oe_b, addr_b, di_b, do_b
93
);
94
 
95
//
96
// Default address and data buses width
97
//
98
parameter aw = 5;
99
parameter dw = 32;
100
 
101
//
102
// Generic synchronous two-port RAM interface
103
//
104
input                   clk_a;  // Clock
105
input                   rst_a;  // Reset
106
input                   ce_a;   // Chip enable input
107
input                   we_a;   // Write enable input
108
input                   oe_a;   // Output enable input
109
input   [aw-1:0] addr_a; // address bus inputs
110
input   [dw-1:0] di_a;   // input data bus
111
output  [dw-1:0] do_a;   // output data bus
112
input                   clk_b;  // Clock
113
input                   rst_b;  // Reset
114
input                   ce_b;   // Chip enable input
115
input                   we_b;   // Write enable input
116
input                   oe_b;   // Output enable input
117
input   [aw-1:0] addr_b; // address bus inputs
118
input   [dw-1:0] di_b;   // input data bus
119
output  [dw-1:0] do_b;   // output data bus
120
 
121
//
122
// Internal wires and registers
123
//
124
 
125
 
126
`ifdef OR1200_ARTISAN_SDP
127
 
128
//
129
// Instantiation of ASIC memory:
130
//
131
// Artisan Synchronous Double-Port RAM (ra2sh)
132
//
133
`ifdef UNUSED
134
art_hsdp_32x32 #(dw, 1<<aw, aw) artisan_sdp(
135
`else
136
art_hsdp_32x32 artisan_sdp(
137
`endif
138
        .qa(do_a),
139
        .clka(clk_a),
140
        .cena(~ce_a),
141
        .wena(~we_a),
142
        .aa(addr_a),
143
        .da(di_a),
144
        .oena(~oe_a),
145
        .qb(do_b),
146
        .clkb(clk_b),
147
        .cenb(~ce_b),
148
        .wenb(~we_b),
149
        .ab(addr_b),
150
        .db(di_b),
151
        .oenb(~oe_b)
152
);
153
 
154
`else
155
 
156
`ifdef OR1200_AVANT_ATP
157
 
158
//
159
// Instantiation of ASIC memory:
160
//
161
// Avant! Asynchronous Two-Port RAM
162
//
163
avant_atp avant_atp(
164
        .web(~we),
165
        .reb(),
166
        .oeb(~oe),
167
        .rcsb(),
168
        .wcsb(),
169
        .ra(addr),
170
        .wa(addr),
171
        .di(di),
172
        .do(do)
173
);
174
 
175
`else
176
 
177
`ifdef OR1200_VIRAGE_STP
178
 
179
//
180
// Instantiation of ASIC memory:
181
//
182
// Virage Synchronous 2-port R/W RAM
183
//
184
virage_stp virage_stp(
185
        .QA(do_a),
186
        .QB(do_b),
187
 
188
        .ADRA(addr_a),
189
        .DA(di_a),
190
        .WEA(we_a),
191
        .OEA(oe_a),
192
        .MEA(ce_a),
193
        .CLKA(clk_a),
194
 
195
        .ADRB(adr_b),
196
        .DB(di_b),
197
        .WEB(we_b),
198
        .OEB(oe_b),
199
        .MEB(ce_b),
200
        .CLKB(clk_b)
201
);
202
 
203
`else
204
 
205
`ifdef OR1200_XILINX_RAMB4
206
 
207
//
208
// Instantiation of FPGA memory:
209
//
210
// Virtex/Spartan2
211
//
212
 
213
//
214
// Block 0
215
//
216
RAMB4_S16_S16 ramb4_s16_s16_0(
217
        .CLKA(clk_a),
218
        .RSTA(rst_a),
219
        .ADDRA(addr_a),
220
        .DIA(di_a[15:0]),
221
        .ENA(ce_a),
222
        .WEA(we_a),
223
        .DOA(do_a[15:0]),
224
 
225
        .CLKB(clk_b),
226
        .RSTB(rst_b),
227
        .ADDRB(addr_b),
228
        .DIB(di_b[15:0]),
229
        .ENB(ce_b),
230
        .WEB(we_b),
231
        .DOB(do_b[15:0])
232
);
233
 
234
//
235
// Block 1
236
//
237
RAMB4_S16_S16 ramb4_s16_s16_1(
238
        .CLKA(clk_a),
239
        .RSTA(rst_a),
240
        .ADDRA(addr_a),
241
        .DIA(di_a[31:16]),
242
        .ENA(ce_a),
243
        .WEA(we_a),
244
        .DOA(do_a[31:16]),
245
 
246
        .CLKB(clk_b),
247
        .RSTB(rst_b),
248
        .ADDRB(addr_b),
249
        .DIB(di_b[31:16]),
250
        .ENB(ce_b),
251
        .WEB(we_b),
252
        .DOB(do_b[31:16])
253
);
254
 
255
`else
256
 
257
//
258
// Generic two-port synchronous RAM model
259
//
260
 
261
//
262
// Generic RAM's registers and wires
263
//
264
reg     [dw-1:0] mem [(1<<aw)-1:0];       // RAM content
265
reg     [dw-1:0] do_reg_a;               // RAM data output register
266
reg     [dw-1:0] do_reg_b;               // RAM data output register
267
 
268
//
269
// Data output drivers
270
//
271
assign do_a = (oe_a) ? do_reg_a : {dw{1'bz}};
272
assign do_b = (oe_b) ? do_reg_b : {dw{1'bz}};
273
 
274
//
275
// RAM read and write
276
//
277
always @(posedge clk_a)
278
        if (ce_a && !we_a)
279
                do_reg_a <= #1 mem[addr_a];
280
        else if (ce_a && we_a)
281
                mem[addr_a] <= #1 di_a;
282
 
283
//
284
// RAM read and write
285
//
286
always @(posedge clk_b)
287
        if (ce_b && !we_b)
288
                do_reg_b <= #1 mem[addr_b];
289
        else if (ce_b && we_b)
290
                mem[addr_b] <= #1 di_b;
291
 
292
`endif  // !OR1200_XILINX_RAMB4_S16_S16
293
`endif  // !OR1200_VIRAGE_STP
294
`endif  // !OR1200_AVANT_ATP
295
`endif  // !OR1200_ARTISAN_SDP
296
 
297
endmodule

powered by: WebSVN 2.1.0

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