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

Subversion Repositories theia_gpu

[/] [theia_gpu/] [trunk/] [rtl/] [Module_RAM.v] - Blame information for rev 211

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

Line No. Rev Author Line
1 152 diegovalve
`timescale 1ns / 1ps
2
`include "aDefinitions.v"
3
/**********************************************************************************
4
Theia, Ray Cast Programable graphic Processing Unit.
5
Copyright (C) 2010  Diego Valverde (diego.valverde.g@gmail.com)
6
 
7
This program is free software; you can redistribute it and/or
8
modify it under the terms of the GNU General Public License
9
as published by the Free Software Foundation; either version 2
10
of the License, or (at your option) any later version.
11
 
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
GNU General Public License for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20
 
21
***********************************************************************************/
22
//--------------------------------------------------------
23
//Dual port RAM.
24
 
25
 
26
module RAM_DUAL_READ_PORT # ( parameter DATA_WIDTH=`DATA_ROW_WIDTH, parameter ADDR_WIDTH=`DATA_ADDRESS_WIDTH, parameter MEM_SIZE=128 )
27
(
28
        input wire                                              Clock,
29
        input wire                                              iWriteEnable,
30
        input wire[ADDR_WIDTH-1:0]       iReadAddress0,
31
        input wire[ADDR_WIDTH-1:0]       iReadAddress1,
32
        input wire[ADDR_WIDTH-1:0]       iWriteAddress,
33
        input wire[DATA_WIDTH-1:0]                       iDataIn,
34
        output reg [DATA_WIDTH-1:0]              oDataOut0,
35
        output reg [DATA_WIDTH-1:0]              oDataOut1
36
);
37
 
38
reg [DATA_WIDTH-1:0] Ram [MEM_SIZE:0];
39
 
40
always @(posedge Clock)
41
begin
42
 
43
                if (iWriteEnable)
44
                        Ram[iWriteAddress] <= iDataIn;
45
 
46
 
47
                        oDataOut0 <= Ram[iReadAddress0];
48
                        oDataOut1 <= Ram[iReadAddress1];
49
 
50
end
51
endmodule
52
//--------------------------------------------------------
53
 
54
module RAM_SINGLE_READ_PORT # ( parameter DATA_WIDTH=`DATA_ROW_WIDTH, parameter ADDR_WIDTH=`DATA_ADDRESS_WIDTH, parameter MEM_SIZE=128 )
55
(
56
        input wire                                              Clock,
57
        input wire                                              iWriteEnable,
58
        input wire[ADDR_WIDTH-1:0]       iReadAddress0,
59
        input wire[ADDR_WIDTH-1:0]       iWriteAddress,
60
        input wire[DATA_WIDTH-1:0]                       iDataIn,
61
        output reg [DATA_WIDTH-1:0]              oDataOut0
62
 
63
);
64
 
65
reg [DATA_WIDTH-1:0] Ram [MEM_SIZE:0];
66
 
67
always @(posedge Clock)
68
begin
69
 
70
                if (iWriteEnable)
71
                        Ram[iWriteAddress] <= iDataIn;
72
 
73
 
74
                        oDataOut0 <= Ram[iReadAddress0];
75
 
76
 
77
end
78
endmodule
79
 
80
 

powered by: WebSVN 2.1.0

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