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

Subversion Repositories theia_gpu

[/] [theia_gpu/] [branches/] [icarus_version/] [rtl/] [Module_RAM.v] - Blame information for rev 217

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

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

powered by: WebSVN 2.1.0

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