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

Subversion Repositories theia_gpu

[/] [theia_gpu/] [branches/] [beta_2.0/] [rtl/] [Module_RegisterFile.v] - Blame information for rev 226

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

Line No. Rev Author Line
1 213 diegovalve
`include "aDefinitions.v"
2
 
3
/**********************************************************************************
4
Theia, Ray Cast Programable graphic Processing Unit.
5
Copyright (C) 2012  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
 
24
module RegisterFile # ( parameter DATA_WIDTH=`DATA_ROW_WIDTH, parameter ADDR_WIDTH=`DATA_ADDRESS_WIDTH )
25
(
26
input wire                                 Clock,
27
input wire                                 Reset,
28
input wire [ADDR_WIDTH-1:0]                iReadAddress0,
29
input wire [ADDR_WIDTH-1:0]                iReadAddress1,
30
input wire [2:0]                           iWriteEnable,
31
input wire [ADDR_WIDTH-1:0]                iWriteAddress,
32
input wire [DATA_WIDTH-1:0]                iData,
33
output wire [`DATA_ADDRESS_WIDTH-1:0]      oFrameOffset,oIndexRegister,
34
output wire [`WIDTH-1:0]                   oThreadControlRegister,
35
output wire [DATA_WIDTH-1:0]               oData0,
36
output wire [DATA_WIDTH-1:0]               oData1
37
 
38
);
39
 
40
parameter DATA_CHANNEL_WIDTH = DATA_WIDTH / 3;
41
 
42
wire  wEnableFrameOffsetOverwrite,wEnableControlRegOverwrite;
43
wire [`DATA_ADDRESS_WIDTH-1:0] wIndexRegister;
44
assign wEnableFrameOffsetOverwrite = (iWriteAddress == `SPR_CONTROL1) ? 1'b1 : 1'b0;
45
assign wEnableControlRegOverwrite = (iWriteAddress == `SPR_CONTROL0) ? 1'b1 : 1'b0;
46
 
47
//This stores the frame offset register
48
FFD_POSEDGE_SYNCRONOUS_RESET # ( `DATA_ADDRESS_WIDTH ) FDD_FRAMEOFFSET
49
(       Clock, Reset, (wEnableFrameOffsetOverwrite & iWriteEnable[2]) ,iData[`X_RNG], oFrameOffset  );
50
 
51
//This stores the index register
52
FFD_POSEDGE_SYNCRONOUS_RESET # ( `DATA_ADDRESS_WIDTH ) FDD_INDEXREGISTER
53
(       Clock, Reset, (wEnableFrameOffsetOverwrite & iWriteEnable[0]) ,iData[`Z_RNG], wIndexRegister  );
54
 
55
FFD_POSEDGE_SYNCRONOUS_RESET # ( `WIDTH ) FDD_CONTROLREGISTER
56
(       Clock, Reset, (wEnableControlRegOverwrite & iWriteEnable[0]) ,iData[`Z_RNG], oThreadControlRegister  );
57
 
58
 
59
//Can't afford to wait 1 extra clock cycle just to allow the data to be written to the flop!
60
assign oIndexRegister = (wEnableFrameOffsetOverwrite & iWriteEnable[0]) ? iData[`Z_RNG] : wIndexRegister;
61
 
62
RAM_DUAL_READ_PORT # ( DATA_CHANNEL_WIDTH, ADDR_WIDTH ) RF_X
63
(
64
 .Clock(             Clock            ),
65
 .iWriteEnable(      iWriteEnable[2]  ),
66
 .iReadAddress0(     iReadAddress0    ),
67
 .iReadAddress1(     iReadAddress1    ),
68
 .iWriteAddress(     iWriteAddress    ),
69
 .iDataIn(           iData[`X_RNG]    ),
70
 .oDataOut0(         oData0[`X_RNG]   ),
71
 .oDataOut1(         oData1[`X_RNG]   )
72
);
73
 
74
 
75
RAM_DUAL_READ_PORT # ( DATA_CHANNEL_WIDTH, ADDR_WIDTH ) RF_Y
76
(
77
 .Clock(             Clock            ),
78
 .iWriteEnable(      iWriteEnable[1]  ),
79
 .iReadAddress0(     iReadAddress0    ),
80
 .iReadAddress1(     iReadAddress1    ),
81
 .iWriteAddress(     iWriteAddress    ),
82
 .iDataIn(           iData[`Y_RNG]    ),
83
 .oDataOut0(         oData0[`Y_RNG]   ),
84
 .oDataOut1(         oData1[`Y_RNG]   )
85
);
86
 
87
 
88
RAM_DUAL_READ_PORT # ( DATA_CHANNEL_WIDTH, ADDR_WIDTH ) RF_Z
89
(
90
 .Clock(             Clock            ),
91
 .iWriteEnable(      iWriteEnable[0]  ),
92
 .iReadAddress0(     iReadAddress0    ),
93
 .iReadAddress1(     iReadAddress1    ),
94
 .iWriteAddress(     iWriteAddress    ),
95
 .iDataIn(           iData[`Z_RNG]    ),
96
 .oDataOut0(         oData0[`Z_RNG]   ),
97
 .oDataOut1(         oData1[`Z_RNG]   )
98
);
99
 
100
endmodule

powered by: WebSVN 2.1.0

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