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

Subversion Repositories theia_gpu

[/] [theia_gpu/] [branches/] [beta_1.1/] [rtl/] [MEM/] [Unit_MEM.v] - Blame information for rev 117

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

Line No. Rev Author Line
1 19 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
The memory unit has all the memory related modules for THEIA.
24
There a 3 memories in the core:
25
DMEM: The data memory, it is a R/W RAM, stores the data locations.
26
IMEM: The instruction memory, R/W RAM, stores user shaders.
27
IROM: RO instruction memory, stores default shaders and other internal code.
28
This unit also has a Control register.
29
*/
30
//-------------------------------------------------------------------
31
module MemoryUnit
32
(
33
input wire                              Clock,
34
input wire                              Reset,
35
input wire                              iDataWriteEnable,
36
input wire                              iInstructionWriteEnable,
37
input  wire [`ROM_ADDRESS_WIDTH-1:0]    iInstructionReadAddress,
38
input wire [`ROM_ADDRESS_WIDTH-1:0]     iInstructionWriteAddress,
39
output wire [`INSTRUCTION_WIDTH-1:0]    oInstruction,
40
input wire [`INSTRUCTION_WIDTH-1:0]     iInstruction,
41
input wire[`DATA_ADDRESS_WIDTH-1:0]     iDataReadAddress1,
42
input wire[`DATA_ROW_WIDTH-1:0]         oData1,
43
input wire[`DATA_ADDRESS_WIDTH-1:0]     iDataReadAddress2,
44
input wire[`DATA_ROW_WIDTH-1:0]         oData2,
45
input wire[`DATA_ADDRESS_WIDTH-1:0]     iDataWriteAddress,
46
input wire[`DATA_ROW_WIDTH-1:0]         iData,
47
input wire[15:0]                       iControlRegister,
48
output wire[15:0]                       oControlRegister
49
 
50
);
51
 
52
wire [`ROM_ADDRESS_WIDTH-1:0] wROMInstructionAddress,wRAMInstructionAddress;
53
wire [`INSTRUCTION_WIDTH-1:0] wIMEM2_IMUX__DataOut,wIROM2_IMUX__DataOut;
54
 
55
 
56
assign oInstruction = (iInstructionReadAddress[`ROM_ADDRESS_WIDTH-1] == 1) ?
57
        wIMEM2_IMUX__DataOut : wIROM2_IMUX__DataOut;
58
 
59
//-------------------------------------------------------------------
60
/*
61
Data memory.
62
*/
63
RAM_DATA DMEM
64
(
65
        .Clock( Clock ),
66
        .iWriteEnable( iDataWriteEnable ),
67
        .iReadAddress0( iDataReadAddress1 ),
68
        .iReadAddress1( iDataReadAddress2 ),
69
        .iWriteAddress( iDataWriteAddress ),
70
        .iDataIn( iData ),
71
        .oDataOut0( oData1 ),
72
        .oDataOut1( oData2 )
73
);
74
//-------------------------------------------------------------------
75
/*
76
Instruction memory.
77
*/
78
RAM_INST IMEM
79
(
80
        .Clock( Clock ),
81
        .iWriteEnable( iInstructionWriteEnable ),
82
        .iReadAddress( iInstructionReadAddress ),
83
        .iWriteAddress( iInstructionWriteAddress ),
84
        .iDataIn( iInstruction ),
85
        .oDataOut( wIMEM2_IMUX__DataOut )
86
 
87
);
88
//-------------------------------------------------------------------
89
/*
90
 Default code stored in ROM.
91
*/
92
ROM IROM
93
(
94
        .Address( iInstructionReadAddress ),
95
        .I(  wIROM2_IMUX__DataOut )
96
);
97
//--------------------------------------------------------
98
ControlRegister CR
99
(
100
        .Clock( Clock ),
101
        .Reset( Reset ),
102
        .iControlRegister( iControlRegister ),
103
        .oControlRegister( oControlRegister )
104
);
105
 
106
 
107
endmodule
108
//-------------------------------------------------------------------

powered by: WebSVN 2.1.0

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