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

Subversion Repositories test_project

[/] [test_project/] [trunk/] [rtl/] [verilog/] [components/] [or1200r2/] [or1200_spram.v] - Blame information for rev 43

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

Line No. Rev Author Line
1 18 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
////  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
// synopsys translate_off
48
`include "timescale.v"
49
// synopsys translate_on
50
`include "or1200_defines.v"
51
 
52
module or1200_spram
53
  (
54
`ifdef OR1200_BIST
55
   // RAM BIST
56
   mbist_si_i, mbist_so_o, mbist_ctrl_i,
57
`endif
58
   // Generic synchronous single-port RAM interface
59
   clk, ce, we, addr, di, doq
60
   );
61
 
62
   //
63
   // Default address and data buses width
64
   //
65
   parameter aw = 10;
66
   parameter dw = 32;
67
 
68
`ifdef OR1200_BIST
69
   //
70
   // RAM BIST
71
   //
72
   input mbist_si_i;
73
   input [`OR1200_MBIST_CTRL_WIDTH - 1:0] mbist_ctrl_i;
74
   output                                 mbist_so_o;
75
`endif
76
 
77
   //
78
   // Generic synchronous single-port RAM interface
79
   //
80
   input                                  clk;  // Clock
81
   input                                  ce;   // Chip enable input
82
   input                                  we;   // Write enable input
83
   //input                                oe;   // Output enable input
84
   input [aw-1:0]                          addr; // address bus inputs
85
   input [dw-1:0]                          di;   // input data bus
86
   output [dw-1:0]                         doq;  // output data bus
87
 
88
   //
89
   // Internal wires and registers
90
   //
91
 
92
   //
93
   // Generic single-port synchronous RAM model
94
   //
95
 
96
   //
97
   // Generic RAM's registers and wires
98
   //
99
`ifdef OR1200_ACTEL
100
   reg [dw-1:0]                    mem [(1<<aw)-1:0] /*synthesis syn_ramstyle = "no_rw_check"*/;
101
`else
102
   reg [dw-1:0]                    mem [(1<<aw)-1:0];
103
`endif
104
   reg [aw-1:0]                    addr_reg;             // RAM address register
105
 
106
   //
107
   // Data output drivers
108
   //
109
   //assign doq = (oe) ? mem[addr_reg] : {dw{1'b0}};
110
   assign doq = mem[addr_reg];
111
 
112
   //
113
   // RAM read address register
114
   //
115
   always @(posedge clk)
116
     if (ce)
117
       addr_reg <= #1 addr;
118
 
119
   //
120
   // RAM write
121
   //
122
   always @(posedge clk)
123
     if (we && ce)
124
       mem[addr] <= #1 di;
125
 
126
endmodule // or1200_spram

powered by: WebSVN 2.1.0

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