OpenCores
URL https://opencores.org/ocsvn/fpga-median/fpga-median/trunk

Subversion Repositories fpga-median

[/] [fpga-median/] [trunk/] [rtl/] [dual_port_ram.v] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 joaocarlos
/* --------------------------------------------------------------------------------
2
 This file is part of FPGA Median Filter.
3
 
4
    FPGA Median Filter is free software: you can redistribute it and/or modify
5
    it under the terms of the GNU General Public License as published by
6
    the Free Software Foundation, either version 3 of the License, or
7
    (at your option) any later version.
8
 
9
    FPGA Median Filter is distributed in the hope that it will be useful,
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
    GNU General Public License for more details.
13
 
14
    You should have received a copy of the GNU General Public License
15
    along with FPGA Median Filter.  If not, see <http://www.gnu.org/licenses/>.
16
-------------------------------------------------------------------------------- */
17 2 joaocarlos
//*******************************************************************//
18
//-------------------------------------------------------------------//
19
// File name            : dual_port_ram.v
20
// File contents        : Parameterized memory for syncronous fifo     
21
//
22
// Design Engineer      : Igor Dantas
23
// Last Changed         : 10/27/2008 09:00
24
//-------------------------------------------------------------------//
25
//*******************************************************************//
26
 
27
`timescale 1ns/10ps
28
 
29
module dual_port_ram
30
#(
31
   parameter MEMFILE = "",
32
   parameter DATA_WIDTH = 'd32,
33
   parameter ADDR_WIDTH = 14
34
)
35
(
36
   input clk,
37
   input r_ena,
38
   input w_ena,
39
   input [DATA_WIDTH-1:0] w_data,
40
   input [ADDR_WIDTH-1:0] w_addr,
41
   input [ADDR_WIDTH-1:0] r_addr,
42
   output reg [DATA_WIDTH-1:0] r_data
43
);
44
 
45
//The Register memory
46
reg [DATA_WIDTH-1:0] mem[0:2**ADDR_WIDTH-1];
47
// synchronous read and write when enabled
48
always @ (posedge clk) begin
49
   if (w_ena)  mem[w_addr] <=  w_data;
50
   if (r_ena) r_data <= mem[r_addr];
51
end
52
 
53
initial $readmemh(MEMFILE, mem);
54
 
55
 
56
endmodule
57
 

powered by: WebSVN 2.1.0

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