OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [or1200/] [rtl/] [verilog/] [or1200_dpram.v] - Blame information for rev 164

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

Line No. Rev Author Line
1 142 marcus.erl
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  Generic Double-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 double-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
////  double-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_dpram
61
  (
62
   // Generic synchronous double-port RAM interface
63
   clk_a, ce_a, addr_a, do_a,
64
   clk_b, ce_b, we_b, addr_b, di_b
65
   );
66
 
67
   //
68
   // Default address and data buses width
69
   //
70
   parameter aw = 5;
71
   parameter dw = 32;
72
 
73
   //
74
   // Generic synchronous double-port RAM interface
75
   //
76
   input                        clk_a;  // Clock
77
   input                        ce_a;   // Chip enable input
78
   input [aw-1:0]                addr_a; // address bus inputs
79
   output [dw-1:0]               do_a;   // output data bus
80
   input                        clk_b;  // Clock
81
   input                        ce_b;   // Chip enable input
82
   input                        we_b;   // Write enable input
83
   input [aw-1:0]                addr_b; // address bus inputs
84
   input [dw-1:0]                di_b;   // input data bus
85
 
86
   //
87
   // Internal wires and registers
88
   //
89
 
90
   //
91
   // Generic double-port synchronous RAM model
92
   //
93
 
94
   //
95
   // Generic RAM's registers and wires
96
   //
97 151 marcus.erl
   reg [dw-1:0]          mem [(1<<aw)-1:0] /*synthesis syn_ramstyle = "no_rw_check"*/;    // RAM content
98 142 marcus.erl
   reg [aw-1:0]          addr_a_reg;             // RAM address registered
99
 
100
 
101
   // Function to access GPRs (for use by Verilator). No need to hide this one
102
   // from the simulator, since it has an input (as required by IEEE 1364-2001).
103
   function [31:0] get_gpr;
104
      // verilator public
105
      input [aw-1:0]             gpr_no;
106
 
107
      get_gpr = { mem[gpr_no*32 + 31], mem[gpr_no*32 + 30],
108
                  mem[gpr_no*32 + 29], mem[gpr_no*32 + 28],
109
                  mem[gpr_no*32 + 27], mem[gpr_no*32 + 26],
110
                  mem[gpr_no*32 + 25], mem[gpr_no*32 + 24],
111
                  mem[gpr_no*32 + 23], mem[gpr_no*32 + 22],
112
                  mem[gpr_no*32 + 21], mem[gpr_no*32 + 20],
113
                  mem[gpr_no*32 + 19], mem[gpr_no*32 + 18],
114
                  mem[gpr_no*32 + 17], mem[gpr_no*32 + 16],
115
                  mem[gpr_no*32 + 15], mem[gpr_no*32 + 14],
116
                  mem[gpr_no*32 + 13], mem[gpr_no*32 + 12],
117
                  mem[gpr_no*32 + 11], mem[gpr_no*32 + 10],
118
                  mem[gpr_no*32 +  9], mem[gpr_no*32 +  8],
119
                  mem[gpr_no*32 +  7], mem[gpr_no*32 +  6],
120
                  mem[gpr_no*32 +  5], mem[gpr_no*32 +  4],
121
                  mem[gpr_no*32 +  3], mem[gpr_no*32 +  2],
122
                  mem[gpr_no*32 +  1], mem[gpr_no*32 +  0] };
123
 
124
   endfunction // get_gpr
125
 
126
   //
127
   // Data output drivers
128
   //
129
   //assign do_a = (oe_a) ? mem[addr_a_reg] : {dw{1'b0}};
130
   assign do_a = mem[addr_a_reg];
131
 
132
 
133
   //
134
   // RAM read
135
   //
136
   always @(posedge clk_a)
137
     if (ce_a)
138
       addr_a_reg <= #1 addr_a;
139
 
140
   //
141
   // RAM write
142
   //
143
   always @(posedge clk_b)
144
     if (ce_b & we_b)
145
       mem[addr_b] <= #1 di_b;
146
 
147
endmodule // or1200_dpram

powered by: WebSVN 2.1.0

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