| 1 |
209 |
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,
|
| 34 |
|
|
output wire [DATA_WIDTH-1:0] oData0,
|
| 35 |
|
|
output wire [DATA_WIDTH-1:0] oData1
|
| 36 |
|
|
|
| 37 |
|
|
);
|
| 38 |
|
|
|
| 39 |
|
|
parameter DATA_CHANNEL_WIDTH = DATA_WIDTH / 3;
|
| 40 |
|
|
|
| 41 |
|
|
wire wEnableFrameOffsetOverwrite;
|
| 42 |
|
|
assign wEnableFrameOffsetOverwrite = (iWriteAddress == `SPR_CONTROL) ? 1'b1 : 1'b0;
|
| 43 |
|
|
|
| 44 |
|
|
FFD_POSEDGE_SYNCRONOUS_RESET # ( `DATA_ADDRESS_WIDTH ) FDD_FRAMEOFFSET
|
| 45 |
|
|
( Clock, Reset, (wEnableFrameOffsetOverwrite & iWriteEnable[2]) ,iData[`X_RNG], oFrameOffset );
|
| 46 |
|
|
|
| 47 |
|
|
RAM_DUAL_READ_PORT # ( DATA_CHANNEL_WIDTH, ADDR_WIDTH ) RF_X
|
| 48 |
|
|
(
|
| 49 |
|
|
.Clock( Clock ),
|
| 50 |
|
|
.iWriteEnable( iWriteEnable[2] ),
|
| 51 |
|
|
.iReadAddress0( iReadAddress0 ),
|
| 52 |
|
|
.iReadAddress1( iReadAddress1 ),
|
| 53 |
|
|
.iWriteAddress( iWriteAddress ),
|
| 54 |
|
|
.iDataIn( iData[`X_RNG] ),
|
| 55 |
|
|
.oDataOut0( oData0[`X_RNG] ),
|
| 56 |
|
|
.oDataOut1( oData1[`X_RNG] )
|
| 57 |
|
|
);
|
| 58 |
|
|
|
| 59 |
|
|
|
| 60 |
|
|
RAM_DUAL_READ_PORT # ( DATA_CHANNEL_WIDTH, ADDR_WIDTH ) RF_Y
|
| 61 |
|
|
(
|
| 62 |
|
|
.Clock( Clock ),
|
| 63 |
|
|
.iWriteEnable( iWriteEnable[1] ),
|
| 64 |
|
|
.iReadAddress0( iReadAddress0 ),
|
| 65 |
|
|
.iReadAddress1( iReadAddress1 ),
|
| 66 |
|
|
.iWriteAddress( iWriteAddress ),
|
| 67 |
|
|
.iDataIn( iData[`Y_RNG] ),
|
| 68 |
|
|
.oDataOut0( oData0[`Y_RNG] ),
|
| 69 |
|
|
.oDataOut1( oData1[`Y_RNG] )
|
| 70 |
|
|
);
|
| 71 |
|
|
|
| 72 |
|
|
|
| 73 |
|
|
RAM_DUAL_READ_PORT # ( DATA_CHANNEL_WIDTH, ADDR_WIDTH ) RF_Z
|
| 74 |
|
|
(
|
| 75 |
|
|
.Clock( Clock ),
|
| 76 |
|
|
.iWriteEnable( iWriteEnable[0] ),
|
| 77 |
|
|
.iReadAddress0( iReadAddress0 ),
|
| 78 |
|
|
.iReadAddress1( iReadAddress1 ),
|
| 79 |
|
|
.iWriteAddress( iWriteAddress ),
|
| 80 |
|
|
.iDataIn( iData[`Z_RNG] ),
|
| 81 |
|
|
.oDataOut0( oData0[`Z_RNG] ),
|
| 82 |
|
|
.oDataOut1( oData1[`Z_RNG] )
|
| 83 |
|
|
);
|
| 84 |
|
|
|
| 85 |
|
|
endmodule
|