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 230

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 230 diegovalve
wire                           wEnableFrameOffsetOverwrite,wEnableControlRegOverwrite;
43 213 diegovalve
wire [`DATA_ADDRESS_WIDTH-1:0] wIndexRegister;
44 230 diegovalve
wire [`WIDTH-1:0]              wDataX,wDataZ;
45
 
46 213 diegovalve
assign wEnableFrameOffsetOverwrite = (iWriteAddress == `SPR_CONTROL1) ? 1'b1 : 1'b0;
47 230 diegovalve
assign wEnableControlRegOverwrite  = (iWriteAddress == `SPR_CONTROL0) ? 1'b1 : 1'b0;
48
assign wDataX                      = iData[`X_RNG];
49
assign wDataZ                      = iData[`Z_RNG];
50
//This stores the frame offset register
51 213 diegovalve
 
52 230 diegovalve
 
53 213 diegovalve
FFD_POSEDGE_SYNCRONOUS_RESET # ( `DATA_ADDRESS_WIDTH ) FDD_FRAMEOFFSET
54 230 diegovalve
(       Clock, Reset, (wEnableFrameOffsetOverwrite & iWriteEnable[2]) ,wDataX[`DATA_ADDRESS_WIDTH-1:0], oFrameOffset  );
55 213 diegovalve
 
56
//This stores the index register
57
FFD_POSEDGE_SYNCRONOUS_RESET # ( `DATA_ADDRESS_WIDTH ) FDD_INDEXREGISTER
58 230 diegovalve
(       Clock, Reset, (wEnableFrameOffsetOverwrite & iWriteEnable[0]) ,wDataZ[`DATA_ADDRESS_WIDTH-1:0], wIndexRegister  );
59 213 diegovalve
 
60
FFD_POSEDGE_SYNCRONOUS_RESET # ( `WIDTH ) FDD_CONTROLREGISTER
61
(       Clock, Reset, (wEnableControlRegOverwrite & iWriteEnable[0]) ,iData[`Z_RNG], oThreadControlRegister  );
62
 
63
 
64
//Can't afford to wait 1 extra clock cycle just to allow the data to be written to the flop!
65
assign oIndexRegister = (wEnableFrameOffsetOverwrite & iWriteEnable[0]) ? iData[`Z_RNG] : wIndexRegister;
66
 
67
RAM_DUAL_READ_PORT # ( DATA_CHANNEL_WIDTH, ADDR_WIDTH ) RF_X
68
(
69
 .Clock(             Clock            ),
70
 .iWriteEnable(      iWriteEnable[2]  ),
71
 .iReadAddress0(     iReadAddress0    ),
72
 .iReadAddress1(     iReadAddress1    ),
73
 .iWriteAddress(     iWriteAddress    ),
74
 .iDataIn(           iData[`X_RNG]    ),
75
 .oDataOut0(         oData0[`X_RNG]   ),
76
 .oDataOut1(         oData1[`X_RNG]   )
77
);
78
 
79
 
80
RAM_DUAL_READ_PORT # ( DATA_CHANNEL_WIDTH, ADDR_WIDTH ) RF_Y
81
(
82
 .Clock(             Clock            ),
83
 .iWriteEnable(      iWriteEnable[1]  ),
84
 .iReadAddress0(     iReadAddress0    ),
85
 .iReadAddress1(     iReadAddress1    ),
86
 .iWriteAddress(     iWriteAddress    ),
87
 .iDataIn(           iData[`Y_RNG]    ),
88
 .oDataOut0(         oData0[`Y_RNG]   ),
89
 .oDataOut1(         oData1[`Y_RNG]   )
90
);
91
 
92
 
93
RAM_DUAL_READ_PORT # ( DATA_CHANNEL_WIDTH, ADDR_WIDTH ) RF_Z
94
(
95
 .Clock(             Clock            ),
96
 .iWriteEnable(      iWriteEnable[0]  ),
97
 .iReadAddress0(     iReadAddress0    ),
98
 .iReadAddress1(     iReadAddress1    ),
99
 .iWriteAddress(     iWriteAddress    ),
100
 .iDataIn(           iData[`Z_RNG]    ),
101
 .oDataOut0(         oData0[`Z_RNG]   ),
102
 .oDataOut1(         oData1[`Z_RNG]   )
103
);
104
 
105
endmodule

powered by: WebSVN 2.1.0

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