|
|
|
|
/**********************************************************************************
|
/**********************************************************************************
|
Theia, Ray Cast Programable graphic Processing Unit.
|
Theia, Ray Cast Programable graphic Processing Unit.
|
Copyright (C) 2010 Diego Valverde (diego.valverde.g@gmail.com)
|
Copyright (C) 2010 Diego Valverde (diego.valverde.g@gmail.com)
|
|
|
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
as published by the Free Software Foundation; either version 2
|
as published by the Free Software Foundation; either version 2
|
of the License, or (at your option) any later version.
|
of the License, or (at your option) any later version.
|
|
|
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
GNU General Public License for more details.
|
GNU General Public License for more details.
|
|
|
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
***********************************************************************************/
|
***********************************************************************************/
|
|
|
|
|
/*******************************************************************************
|
/*******************************************************************************
|
Module Description:
|
Module Description:
|
|
|
This is the top module that connects the GPU with the HOST and the HUB/SWITCH.
|
This is the top module that connects the GPU with the HOST and the HUB/SWITCH.
|
|
|
*******************************************************************************/
|
*******************************************************************************/
|
|
|
|
|
|
|
`timescale 1ns / 1ps
|
`timescale 1ns / 1ps
|
`include "aDefinitions.v"
|
`include "aDefinitions.v"
|
`ifdef VERILATOR
|
`ifdef VERILATOR
|
`include "Theia.v"
|
`include "Theia.v"
|
`endif
|
`endif
|
module top
|
module top
|
(
|
(
|
input wire Clock,
|
input wire Clock,
|
input wire Reset,
|
input wire Reset,
|
input wire iHostEnable,
|
input wire iHostEnable,
|
output wire[`WB_WIDTH-1:0] oHostReadAddress,
|
output wire[`WB_WIDTH-1:0] oHostReadAddress,
|
input wire[`WB_WIDTH-1:0] iMemorySize,
|
input wire[`WB_WIDTH-1:0] iMemorySize,
|
output wire[1:0] oMemSelect,
|
output wire[1:0] oMemSelect,
|
input wire [`WB_WIDTH-1:0] iInstruction,
|
input wire [`WB_WIDTH-1:0] iInstruction,
|
input wire [`WB_WIDTH-1:0] iParameter,
|
input wire [`WB_WIDTH-1:0] iParameter,
|
input wire [`WB_WIDTH-1:0] iVertex,
|
input wire [`WB_WIDTH-1:0] iVertex,
|
input wire [`WB_WIDTH-1:0] iControlRegister,
|
input wire [`WB_WIDTH-1:0] iControlRegister,
|
input wire[`WIDTH-1:0] iPrimitiveCount,
|
input wire[`WIDTH-1:0] iPrimitiveCount,
|
input wire [`WB_WIDTH-1:0] iTMEMAdr,
|
input wire [`WB_WIDTH-1:0] iTMEMAdr,
|
input wire [`WB_WIDTH-1:0] iTMEMData,
|
input wire [`WB_WIDTH-1:0] iTMEMData,
|
input wire iTMEM_WE,
|
input wire iTMEM_WE,
|
input wire [`MAX_TMEM_BANKS-1:0] iTMEM_Sel,
|
input wire [`MAX_TMEM_BANKS-1:0] iTMEM_Sel,
|
input wire [`MAX_CORE_BITS-1:0] iOMEMBankSelect,
|
input wire [`MAX_CORE_BITS-1:0] iOMEMBankSelect,
|
input wire [`WB_WIDTH-1:0] iOMEMReadAddress,
|
input wire [`WB_WIDTH-1:0] iOMEMReadAddress,
|
output wire [`WB_WIDTH-1:0] oOMEMData, //Output data bus (Wishbone)
|
output wire [`WB_WIDTH-1:0] oOMEMData, //Output data bus (Wishbone)
|
`ifndef NO_DISPLAY_STATS
|
`ifndef NO_DISPLAY_STATS
|
input wire [`WIDTH-1:0] iDebugWidth,
|
input wire [`WIDTH-1:0] iWidth,iHeight,
|
`endif
|
`endif
|
output wire oDone
|
output wire oDone
|
|
|
|
|
);
|
);
|
|
wire wHost_2__RenderDone;
|
|
assign oDone = wHost_2__RenderDone;
|
|
|
assign oMemSelect = wMemSelect;
|
assign oMemSelect = wMemSelect;
|
|
|
wire [`WB_WIDTH-1:0] wHost_2__DAT_O;
|
wire [`WB_WIDTH-1:0] wHost_2__DAT_O;
|
reg wHost_2__ACK;
|
reg wHost_2__ACK;
|
wire wGPU_2__ACK;
|
wire wGPU_2__ACK;
|
wire [`WB_WIDTH-1:0] ADR_I,wHost_2__ADR_O;
|
wire [`WB_WIDTH-1:0] ADR_I,wHost_2__ADR_O;
|
wire WE_I,STB_I;
|
wire WE_I,STB_I;
|
wire [1:0] wHost_2__TGA_O;
|
wire [1:0] wHost_2__TGA_O;
|
wire [1:0] TGA_I;
|
wire [1:0] TGA_I;
|
wire [`MAX_CORES-1:0] wCoreSelect;
|
wire [`MAX_CORES-1:0] wCoreSelect;
|
wire wHost_2__MST_O;
|
wire wHost_2__MST_O;
|
wire wGPU_2_HOST_Done;
|
wire wGPU_2_HOST_Done;
|
wire [`MAX_CORES-1:0] wHost_2__RENDREN_O;
|
wire [`MAX_CORES-1:0] wHost_2__RENDREN_O;
|
wire wGPU_2__HOST_HDL;
|
wire wGPU_2__HOST_HDL;
|
wire wHost_2__WE_O;
|
wire wHost_2__WE_O;
|
wire wHost_2__STDONE;
|
wire wHost_2__STDONE;
|
wire wGPUCommitedResults;
|
wire wGPUCommitedResults;
|
wire wHostDataAvailable;
|
wire wHostDataAvailable;
|
wire wHost_2__CYC_O,wHost_2__GACK_O,TGC_O,wHost_2__STB_O;
|
wire wHost_2__CYC_O,wHost_2__GACK_O,TGC_O,wHost_2__STB_O;
|
|
|
assign oDone = wGPU_2_HOST_Done;
|
//assign oDone = wGPU_2_HOST_Done;
|
|
|
THEIA GPU
|
THEIA GPU
|
(
|
(
|
.CLK_I( Clock ),
|
.CLK_I( Clock ),
|
.RST_I( Reset ),
|
.RST_I( Reset ),
|
.RENDREN_I( wHost_2__RENDREN_O ),
|
.RENDREN_I( wHost_2__RENDREN_O ),
|
.DAT_I( wHost_2__DAT_O ),
|
.DAT_I( wHost_2__DAT_O ),
|
.ACK_I( wHost_2__ACK ),
|
.ACK_I( wHost_2__ACK ),
|
.CYC_I( wHost_2__CYC_O ),
|
.CYC_I( wHost_2__CYC_O ),
|
.MST_I( wHost_2__MST_O ),
|
.MST_I( wHost_2__MST_O ),
|
.TGA_I( wHost_2__TGA_O ),
|
.TGA_I( wHost_2__TGA_O ),
|
.ACK_O( wGPU_2__ACK ),
|
.ACK_O( wGPU_2__ACK ),
|
.ADR_I( wHost_2__ADR_O ),
|
.ADR_I( wHost_2__ADR_O ),
|
.WE_I( wHost_2__WE_O ),
|
.WE_I( wHost_2__WE_O ),
|
.SEL_I( wCoreSelect ),
|
.SEL_I( wCoreSelect ),
|
.STB_I( wHost_2__STB_O ),
|
.STB_I( wHost_2__STB_O ),
|
|
|
//O-Memory
|
//O-Memory
|
.OMBSEL_I( iOMEMBankSelect ),
|
.OMBSEL_I( iOMEMBankSelect ),
|
.OMADR_I( iOMEMReadAddress ),
|
.OMADR_I( iOMEMReadAddress ),
|
.OMEM_O( oOMEMData ),
|
.OMEM_O( oOMEMData ),
|
//T-Memory
|
//T-Memory
|
.TMDAT_I( iTMEMData ),
|
.TMDAT_I( iTMEMData ),
|
.TMADR_I( iTMEMAdr ),
|
.TMADR_I( iTMEMAdr ),
|
.TMWE_I( iTMEM_WE ),
|
.TMWE_I( iTMEM_WE ),
|
.TMSEL_I( iTMEM_Sel ),
|
.TMSEL_I( iTMEM_Sel ),
|
.HDL_O( wGPU_2__HOST_HDL ),
|
.HDL_O( wGPU_2__HOST_HDL ),
|
.HDLACK_I( wHost_2__GACK_O ),
|
.HDLACK_I( wHost_2__GACK_O ),
|
.STDONE_I( wHost_2__STDONE ),
|
.STDONE_I( wHost_2__STDONE ),
|
.RCOMMIT_O( wGPUCommitedResults ),
|
.RCOMMIT_O( wGPUCommitedResults ),
|
.HDA_I( wHostDataAvailable ),
|
.HDA_I( wHostDataAvailable ),
|
.CREG_I( iControlRegister[15:0] ),
|
.CREG_I( iControlRegister[15:0] ),
|
.DONE_O( wGPU_2_HOST_Done )
|
.DONE_O( wGPU_2_HOST_Done )
|
|
|
);
|
);
|
|
|
|
|
wire[1:0] wMemSelect;
|
wire[1:0] wMemSelect;
|
wire[`WB_WIDTH-1:0] wHostReadData;
|
wire[`WB_WIDTH-1:0] wHostReadData;
|
|
|
MUXFULLPARALELL_2SEL_GENERIC # ( `WB_WIDTH ) MUX1
|
MUXFULLPARALELL_2SEL_GENERIC # ( `WB_WIDTH ) MUX1
|
(
|
(
|
.Sel( wMemSelect ),
|
.Sel( wMemSelect ),
|
.I1( iInstruction ),
|
.I1( iInstruction ),
|
.I2( iParameter ),
|
.I2( iParameter ),
|
.I3( iVertex ),
|
.I3( iVertex ),
|
.I4( 0 ),
|
.I4( 0 ),
|
.O1( wHostReadData )
|
.O1( wHostReadData )
|
);
|
);
|
|
|
Module_Host HOST
|
Module_Host HOST
|
(
|
(
|
.Clock( Clock ),
|
.Clock( Clock ),
|
.Reset( Reset ),
|
.Reset( Reset ),
|
.iEnable( iHostEnable ),
|
.iEnable( iHostEnable ),
|
.oHostDataAvailable( wHostDataAvailable ),
|
.oHostDataAvailable( wHostDataAvailable ),
|
.iHostDataReadConfirmed( wGPU_2__HOST_HDL ),
|
.iHostDataReadConfirmed( wGPU_2__HOST_HDL ),
|
.iMemorySize( iMemorySize ),
|
.iMemorySize( iMemorySize ),
|
.iPrimitiveCount( iPrimitiveCount ),
|
.iPrimitiveCount( iPrimitiveCount ),
|
.iGPUCommitedResults( wGPUCommitedResults ),
|
.iGPUCommitedResults( wGPUCommitedResults ),
|
.STDONE_O( wHost_2__STDONE ),
|
.STDONE_O( wHost_2__STDONE ),
|
.iGPUDone( wGPU_2_HOST_Done ),
|
.iGPUDone( wGPU_2_HOST_Done ),
|
|
.oRenderDone( wHost_2__RenderDone ),
|
|
|
`ifndef NO_DISPLAY_STATS
|
|
.iDebugWidth(iDebugWidth),
|
.iWidth(iWidth),
|
`endif
|
.iHeight(iHeight),
|
|
|
//To Memory
|
//To Memory
|
.oReadAddress( oHostReadAddress ),
|
.oReadAddress( oHostReadAddress ),
|
.iReadData( wHostReadData ),
|
.iReadData( wHostReadData ),
|
|
|
//To Hub/Switch
|
//To Hub/Switch
|
.oCoreSelectMask( wCoreSelect ),
|
.oCoreSelectMask( wCoreSelect ),
|
.oMemSelect( wMemSelect ),
|
.oMemSelect( wMemSelect ),
|
.DAT_O( wHost_2__DAT_O ),
|
.DAT_O( wHost_2__DAT_O ),
|
.ADR_O( wHost_2__ADR_O ),
|
.ADR_O( wHost_2__ADR_O ),
|
.TGA_O( wHost_2__TGA_O ),
|
.TGA_O( wHost_2__TGA_O ),
|
.RENDREN_O( wHost_2__RENDREN_O ),
|
.RENDREN_O( wHost_2__RENDREN_O ),
|
.CYC_O( wHost_2__CYC_O ),
|
.CYC_O( wHost_2__CYC_O ),
|
.STB_O( wHost_2__STB_O ),
|
.STB_O( wHost_2__STB_O ),
|
.MST_O( wHost_2__MST_O ),
|
.MST_O( wHost_2__MST_O ),
|
.GRDY_I( wGPU_2__HOST_HDL ),
|
.GRDY_I( wGPU_2__HOST_HDL ),
|
.GACK_O( wHost_2__GACK_O ),
|
.GACK_O( wHost_2__GACK_O ),
|
.WE_O( wHost_2__WE_O ),
|
.WE_O( wHost_2__WE_O ),
|
.ACK_I( wGPU_2__ACK )
|
.ACK_I( wGPU_2__ACK )
|
);
|
);
|
|
|
|
|
endmodule
|
endmodule
|
|
|