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

Subversion Repositories theia_gpu

[/] [theia_gpu/] [branches/] [beta_2.0/] [rtl/] [Module_RAM.v] - Blame information for rev 218

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

Line No. Rev Author Line
1 213 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 )
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
parameter DEPTH = 2**ADDR_WIDTH;
39
reg [DATA_WIDTH-1:0] Ram [DEPTH-1:0];
40
 
41
 
42
always @(posedge Clock)
43
begin
44
 
45
  /* verilator lint_off WIDTH */
46
  if (iWriteEnable)
47
   Ram[iWriteAddress] <= iDataIn;
48
 
49
 
50
   oDataOut0 <= Ram[iReadAddress0];
51
   oDataOut1 <= Ram[iReadAddress1];
52
    /* verilator lint_on WIDTH */
53
 
54
end
55
endmodule
56
//--------------------------------------------------------
57
 
58
module RAM_SINGLE_READ_PORT # ( parameter DATA_WIDTH=`DATA_ROW_WIDTH, parameter ADDR_WIDTH=`DATA_ADDRESS_WIDTH, parameter MEM_SIZE=128 )
59
(
60
 input wire      Clock,
61
 input wire      iWriteEnable,
62
 input wire[ADDR_WIDTH-1:0] iReadAddress0,
63
 input wire[ADDR_WIDTH-1:0] iWriteAddress,
64
 input wire[DATA_WIDTH-1:0]    iDataIn,
65
 output reg [DATA_WIDTH-1:0]   oDataOut0
66
 
67
);
68
 
69
reg [DATA_WIDTH -1:0] Ram [MEM_SIZE-1:0];
70
 
71
always @(posedge Clock)
72
begin
73
 
74
  if (iWriteEnable)
75
   Ram[iWriteAddress] <= iDataIn;
76
 
77
 
78
   oDataOut0 <= Ram[iReadAddress0];
79
 
80
 
81
end
82
endmodule
83
 
84
 

powered by: WebSVN 2.1.0

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