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

Subversion Repositories test_project

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

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

Line No. Rev Author Line
1 18 unneback
//////////////////////////////////////////////////////////////////////
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
// synopsys translate_off
48
`include "timescale.v"
49
// synopsys translate_on
50
`include "or1200_defines.v"
51
 
52
module or1200_dpram
53
  (
54
   // Generic synchronous double-port RAM interface
55
   clk_a, ce_a, addr_a, do_a,
56
   clk_b, ce_b, we_b, addr_b, di_b
57
   );
58
 
59
   //
60
   // Default address and data buses width
61
   //
62
   parameter aw = 5;
63
   parameter dw = 32;
64
 
65
   //
66
   // Generic synchronous double-port RAM interface
67
   //
68
   input                        clk_a;  // Clock
69
   input                        ce_a;   // Chip enable input
70
   input [aw-1:0]                addr_a; // address bus inputs
71
   output [dw-1:0]               do_a;   // output data bus
72
   input                        clk_b;  // Clock
73
   input                        ce_b;   // Chip enable input
74
   input                        we_b;   // Write enable input
75
   input [aw-1:0]                addr_b; // address bus inputs
76
   input [dw-1:0]                di_b;   // input data bus
77
 
78
   //
79
   // Internal wires and registers
80
   //
81
 
82
   //
83
   // Generic double-port synchronous RAM model
84
   //
85
 
86
   //
87
   // Generic RAM's registers and wires
88
   //
89
   reg [dw-1:0]          mem [(1<<aw)-1:0];       // RAM content
90
   reg [aw-1:0]          addr_a_reg;             // RAM address registered
91
 
92
   //
93
   // Data output drivers
94
   //
95
   //assign do_a = (oe_a) ? mem[addr_a_reg] : {dw{1'b0}};
96
   assign do_a = mem[addr_a_reg];
97
 
98
 
99
   //
100
   // RAM read
101
   //
102
   always @(posedge clk_a)
103
     if (ce_a)
104
       addr_a_reg <= #1 addr_a;
105
 
106
   //
107
   // RAM write
108
   //
109
   always @(posedge clk_b)
110
     if (ce_b & we_b)
111
       mem[addr_b] <= #1 di_b;
112
 
113
endmodule // or1200_dpram

powered by: WebSVN 2.1.0

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