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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1200/] [rtl/] [verilog/] [or1200_spram.v] - Blame information for rev 443

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

Line No. Rev Author Line
1 142 marcus.erl
//////////////////////////////////////////////////////////////////////
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
////  Author(s):                                                  ////
19
////      - Michael Unneback, unneback@opencores.org              ////
20
////                                                              ////
21
//////////////////////////////////////////////////////////////////////
22
////                                                              ////
23
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
24
////                                                              ////
25
//// This source file may be used and distributed without         ////
26
//// restriction provided that this copyright statement is not    ////
27
//// removed from the file and that any derivative work contains  ////
28
//// the original copyright notice and the associated disclaimer. ////
29
////                                                              ////
30
//// This source file is free software; you can redistribute it   ////
31
//// and/or modify it under the terms of the GNU Lesser General   ////
32
//// Public License as published by the Free Software Foundation; ////
33
//// either version 2.1 of the License, or (at your option) any   ////
34
//// later version.                                               ////
35
////                                                              ////
36
//// This source is distributed in the hope that it will be       ////
37
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
38
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
39
//// PURPOSE.  See the GNU Lesser General Public License for more ////
40
//// details.                                                     ////
41
////                                                              ////
42
//// You should have received a copy of the GNU Lesser General    ////
43
//// Public License along with this source; if not, download it   ////
44
//// from http://www.opencores.org/lgpl.shtml                     ////
45
////                                                              ////
46
//////////////////////////////////////////////////////////////////////
47
//
48
// CVS Revision History
49
//
50
// $Log: or1200_dpram_32x32.v,v $
51
// Revision 2.0  2010/06/30 11:00:00  ORSoC
52
// New 
53
//
54
 
55
// synopsys translate_off
56
`include "timescale.v"
57
// synopsys translate_on
58
`include "or1200_defines.v"
59
 
60
module or1200_spram
61
  (
62
`ifdef OR1200_BIST
63
   // RAM BIST
64
   mbist_si_i, mbist_so_o, mbist_ctrl_i,
65
`endif
66
   // Generic synchronous single-port RAM interface
67
   clk, ce, we, addr, di, doq
68
   );
69
 
70
   //
71
   // Default address and data buses width
72
   //
73
   parameter aw = 10;
74
   parameter dw = 32;
75
 
76
`ifdef OR1200_BIST
77
   //
78
   // RAM BIST
79
   //
80
   input mbist_si_i;
81
   input [`OR1200_MBIST_CTRL_WIDTH - 1:0] mbist_ctrl_i;
82
   output                                 mbist_so_o;
83
`endif
84
 
85
   //
86
   // Generic synchronous single-port RAM interface
87
   //
88
   input                                  clk;  // Clock
89
   input                                  ce;   // Chip enable input
90
   input                                  we;   // Write enable input
91
   //input                                oe;   // Output enable input
92
   input [aw-1:0]                          addr; // address bus inputs
93
   input [dw-1:0]                          di;   // input data bus
94
   output [dw-1:0]                         doq;  // output data bus
95
 
96
   //
97
   // Internal wires and registers
98
   //
99
 
100
   //
101
   // Generic single-port synchronous RAM model
102
   //
103
 
104
   //
105
   // Generic RAM's registers and wires
106
   //
107 258 julius
`ifdef OR1200_GENERIC
108 142 marcus.erl
   reg [dw-1:0]                    mem [(1<<aw)-1:0] /*synthesis syn_ramstyle = "no_rw_check"*/;
109
`else
110
   reg [dw-1:0]                    mem [(1<<aw)-1:0];
111
`endif
112
   reg [aw-1:0]                    addr_reg;             // RAM address register
113
 
114
   //
115
   // Data output drivers
116
   //
117
   //assign doq = (oe) ? mem[addr_reg] : {dw{1'b0}};
118
   assign doq = mem[addr_reg];
119
 
120
   //
121
   // RAM read address register
122
   //
123
   always @(posedge clk)
124
     if (ce)
125 258 julius
       addr_reg <=  addr;
126 142 marcus.erl
 
127
   //
128
   // RAM write
129
   //
130
   always @(posedge clk)
131
     if (we && ce)
132 258 julius
       mem[addr] <=  di;
133 142 marcus.erl
 
134
endmodule // or1200_spram

powered by: WebSVN 2.1.0

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