Line 1... |
Line 1... |
`timescale 1ns / 1ps
|
`timescale 1ns / 1ps
|
`include "aDefinitions.v"
|
`include "aDefinitions.v"
|
|
`ifdef VERILATOR
|
|
`include "Module_HostWBM.v"
|
|
`endif
|
|
|
|
|
/**********************************************************************************
|
/**********************************************************************************
|
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)
|
Line 74... |
Line 76... |
output wire [`WB_WIDTH-1:0] oReadAddress,
|
output wire [`WB_WIDTH-1:0] oReadAddress,
|
input wire [`WB_WIDTH-1:0] iReadData,
|
input wire [`WB_WIDTH-1:0] iReadData,
|
input wire iGPUCommitedResults,
|
input wire iGPUCommitedResults,
|
|
|
//To Hub/Switch
|
//To Hub/Switch
|
output wire [`MAX_CORES-1:0] oCoreSelectMask,
|
output reg [`MAX_CORES-1:0] oCoreSelectMask,
|
output reg [1:0] oMemSelect,
|
output reg [1:0] oMemSelect,
|
output wire [`WB_WIDTH-1:0] DAT_O,
|
output wire [`WB_WIDTH-1:0] DAT_O,
|
output wire [`WB_WIDTH-1:0] ADR_O,
|
output wire [`WB_WIDTH-1:0] ADR_O,
|
output reg[1:0] TGA_O,
|
output reg[1:0] TGA_O,
|
output reg[`MAX_CORES-1:0] RENDREN_O,
|
output reg[`MAX_CORES-1:0] RENDREN_O,
|
Line 92... |
Line 94... |
output reg oHostDataAvailable,
|
output reg oHostDataAvailable,
|
input wire iGPUDone,
|
input wire iGPUDone,
|
`ifndef NO_DISPLAY_STATS
|
`ifndef NO_DISPLAY_STATS
|
input wire [`WIDTH-1:0] iDebugWidth,
|
input wire [`WIDTH-1:0] iDebugWidth,
|
`endif
|
`endif
|
|
|
input wire ACK_I
|
input wire ACK_I
|
);
|
);
|
|
wire wGPUDone;
|
|
|
|
//Need this flop to break combinatorial loop asserted by verilator!
|
|
FFD_POSEDGE_SYNCRONOUS_RESET # ( 1 ) FFD_DONE
|
|
(
|
|
.Clock(Clock),
|
|
.Reset(Reset),
|
|
.Enable( 1'b1 ),
|
|
.D(iGPUDone),
|
|
.Q(wGPUDone)
|
|
);
|
|
|
|
|
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
wire wLastPrimitive;
|
wire wLastPrimitive;
|
assign wLastPrimitive = (wVertexCount >= iPrimitiveCount) ? 1'b1 : 1'b0;
|
assign wLastPrimitive = (wVertexCount >= iPrimitiveCount) ? 1'b1 : 1'b0;
|
assign STDONE_O = wLastPrimitive;
|
assign STDONE_O = wLastPrimitive;
|
|
|
Line 113... |
Line 129... |
reg rIncCoreSelect,rResetVertexCount;
|
reg rIncCoreSelect,rResetVertexCount;
|
//--------------------------------------------------------
|
//--------------------------------------------------------
|
|
|
assign WE_O = MST_O;
|
assign WE_O = MST_O;
|
|
|
assign oCoreSelectMask =
|
//assign oCoreSelectMask =
|
(rCoreBroadCast) ? `SELECT_ALL_CORES : wCoreSelect;
|
// (rCoreBroadCast) ? `SELECT_ALL_CORES : wCoreSelect;
|
|
|
|
|
|
wire wLastCoreSelected;
|
|
assign wLastCoreSelected = wCoreSelect[`MAX_CORES-1];
|
|
|
assign wLastValidReadAddress =
|
assign wLastValidReadAddress =
|
(oReadAddress >= iMemorySize) ? 1'b1 : 1'b0;
|
(oReadAddress >= iMemorySize) ? 1'b1 : 1'b0;
|
|
|
wire wLastParameter;
|
wire wLastParameter;
|
Line 155... |
Line 175... |
wire wShortCycle;
|
wire wShortCycle;
|
//For instruction we send 2 packets per cycle
|
//For instruction we send 2 packets per cycle
|
//for the other we send 3 packets per cycle
|
//for the other we send 3 packets per cycle
|
assign wShortCycle = (oMemSelect == `SELECT_INST_MEM) ? 1'b1 : 1'b0;
|
assign wShortCycle = (oMemSelect == `SELECT_INST_MEM) ? 1'b1 : 1'b0;
|
|
|
WBMaster WBM
|
WBMaster HOST_WBM
|
(
|
(
|
.Clock( Clock ),
|
.Clock( Clock ),
|
.Reset( Reset | rWBMReset ),
|
.Reset( Reset | rWBMReset ),
|
.iEnable( rWBMEnable ),
|
.iEnable( rWBMEnable ),
|
.iInitialReadAddr( rInitiaReadAddr ),
|
.iInitialReadAddr( rInitiaReadAddr ),
|
Line 193... |
Line 213... |
reg [63:0] RenderedPixels;
|
reg [63:0] RenderedPixels;
|
wire wLastVertexInFrame;
|
wire wLastVertexInFrame;
|
assign wLastVertexInFrame =
|
assign wLastVertexInFrame =
|
(wVertexCount % `MAX_VERTEX_IN_FRAME == 1'b0 ) ? 1'b1 : 1'b0;
|
(wVertexCount % `MAX_VERTEX_IN_FRAME == 1'b0 ) ? 1'b1 : 1'b0;
|
|
|
// WAS ((wVertexCount % `MAX_VERTEX_IN_FRAME) == 1'b0 && wVertexCount != 0) ? 1'b1 : 1'b0;
|
|
|
|
reg [31:0] StartTime;
|
reg [31:0] StartTime;
|
|
|
// Host Finite State Machine //
|
// Host Finite State Machine //
|
always @( * )
|
always @( * )
|
Line 207... |
Line 226... |
//----------------------------------------
|
//----------------------------------------
|
//Wait for reset sequence to complete,
|
//Wait for reset sequence to complete,
|
//Or until we are enabled
|
//Or until we are enabled
|
`HOST_IDLE:
|
`HOST_IDLE:
|
begin
|
begin
|
|
`ifndef VERILATOR
|
RenderedPixels = 0;
|
RenderedPixels = 0;
|
|
`endif
|
|
|
rWBMEnable = 0;
|
rWBMEnable = 0;
|
rInitiaReadAddr = 1; //Start reading from 1, because 0 is the size
|
rInitiaReadAddr = 1; //Start reading from 1, because 0 is the size
|
rWBMReset = 0;
|
rWBMReset = 0;
|
oMemSelect = 0;
|
oMemSelect = 0;
|
TGA_O = 0;
|
TGA_O = 0;
|
MST_O = 0;
|
MST_O = 0;
|
rInitialWriteAddress = 0;
|
rInitialWriteAddress = 0;
|
rSetWriteAddr = 0;
|
rSetWriteAddr = 0;
|
rCoreBroadCast = 0;
|
//rCoreBroadCast = 0;
|
|
oCoreSelectMask = wCoreSelect;
|
rIncCoreSelect = 0;
|
rIncCoreSelect = 0;
|
RENDREN_O = 0;
|
RENDREN_O = 0;
|
rResetVertexCount = 0;
|
rResetVertexCount = 0;
|
GACK_O = 0;
|
GACK_O = 0;
|
//STDONE_O = 0;
|
|
oHostDataAvailable = 0;
|
oHostDataAvailable = 0;
|
|
|
if ( ~Reset & iEnable )
|
if ( ~Reset & iEnable )
|
begin
|
begin
|
$display("-I- HOST: Broadcasting User code to all Cores\n"); $fflush;
|
$display("-I- HOST: Broadcasting User code to all Cores\n");
|
|
`ifndef VERILATOR
|
|
$fflush;
|
|
`endif
|
|
|
rHostNextState = `HOST_WRITE_INSTRUCTION;
|
rHostNextState = `HOST_WRITE_INSTRUCTION;
|
end
|
end
|
else
|
else
|
rHostNextState = `HOST_IDLE;
|
rHostNextState = `HOST_IDLE;
|
end
|
end
|
Line 248... |
Line 273... |
oMemSelect = `SELECT_INST_MEM; //Start by sending the instructions
|
oMemSelect = `SELECT_INST_MEM; //Start by sending the instructions
|
TGA_O = `TAG_INSTRUCTION_ADDRESS_TYPE;
|
TGA_O = `TAG_INSTRUCTION_ADDRESS_TYPE;
|
MST_O = 1;
|
MST_O = 1;
|
rInitialWriteAddress = 0;
|
rInitialWriteAddress = 0;
|
rSetWriteAddr = 0;
|
rSetWriteAddr = 0;
|
rCoreBroadCast = 1;
|
//rCoreBroadCast = 1;
|
|
oCoreSelectMask = `SELECT_ALL_CORES;
|
rIncCoreSelect = 0;
|
rIncCoreSelect = 0;
|
RENDREN_O = 0;
|
RENDREN_O = 0;
|
rResetVertexCount = 0;
|
rResetVertexCount = 0;
|
GACK_O = 0;
|
GACK_O = 0;
|
//STDONE_O = 0;
|
|
oHostDataAvailable = 0;
|
oHostDataAvailable = 0;
|
|
|
rHostNextState = `HOST_WAIT_INSTRUCTION;
|
rHostNextState = `HOST_WAIT_INSTRUCTION;
|
end
|
end
|
//----------------------------------------
|
//----------------------------------------
|
Line 269... |
Line 294... |
oMemSelect = `SELECT_INST_MEM;
|
oMemSelect = `SELECT_INST_MEM;
|
TGA_O = `TAG_INSTRUCTION_ADDRESS_TYPE;
|
TGA_O = `TAG_INSTRUCTION_ADDRESS_TYPE;
|
MST_O = 1;
|
MST_O = 1;
|
rInitialWriteAddress = 0;
|
rInitialWriteAddress = 0;
|
rSetWriteAddr = 0;
|
rSetWriteAddr = 0;
|
rCoreBroadCast = 1;
|
//rCoreBroadCast = 1;
|
|
oCoreSelectMask = `SELECT_ALL_CORES;
|
rIncCoreSelect = 0;
|
rIncCoreSelect = 0;
|
RENDREN_O = 0;
|
RENDREN_O = 0;
|
rResetVertexCount = 0;
|
rResetVertexCount = 0;
|
GACK_O = 0;
|
GACK_O = 0;
|
//STDONE_O = 0;
|
|
oHostDataAvailable = 0;
|
oHostDataAvailable = 0;
|
|
|
if ( wWBMDone && ~wLastValidReadAddress )
|
if ( wWBMDone && ~wLastValidReadAddress )
|
rHostNextState = `HOST_WRITE_INSTRUCTION;
|
rHostNextState = `HOST_WRITE_INSTRUCTION;
|
else if (wWBMDone && wLastValidReadAddress )
|
else if (wWBMDone && wLastValidReadAddress )
|
Line 299... |
Line 324... |
oMemSelect = `SELECT_SCENE_MEM; //We are reading from the scene memory
|
oMemSelect = `SELECT_SCENE_MEM; //We are reading from the scene memory
|
TGA_O = `TAG_DATA_ADDRESS_TYPE; //We will write to the DATA section of the core MEM
|
TGA_O = `TAG_DATA_ADDRESS_TYPE; //We will write to the DATA section of the core MEM
|
MST_O = 1; //Keep master signal in 1 for now
|
MST_O = 1; //Keep master signal in 1 for now
|
rInitialWriteAddress = 0; //We start writing from address zero now
|
rInitialWriteAddress = 0; //We start writing from address zero now
|
rSetWriteAddr = 1;
|
rSetWriteAddr = 1;
|
rCoreBroadCast = 1; //Set to zero to unicast, starting from core 0
|
//rCoreBroadCast = 1; //Set to zero to unicast, starting from core 0
|
|
oCoreSelectMask = `SELECT_ALL_CORES;
|
rIncCoreSelect = 0; //Set to unicast to the next core
|
rIncCoreSelect = 0; //Set to unicast to the next core
|
RENDREN_O = 0;
|
RENDREN_O = 0;
|
rResetVertexCount = 0;
|
rResetVertexCount = 0;
|
GACK_O = 0;
|
GACK_O = 0;
|
//STDONE_O = 0;
|
|
oHostDataAvailable = 0;
|
oHostDataAvailable = 0;
|
|
|
$display("-I- HOST: Configuring Core Mask %b\n",oCoreSelectMask); $fflush;
|
$display("-I- HOST: Configuring Core Mask %b\n",oCoreSelectMask);
|
|
`ifndef VERILATOR
|
|
$fflush;
|
|
`endif
|
|
|
|
|
rHostNextState = `HOST_WRITE_SCENE_PARAMS;
|
rHostNextState = `HOST_WRITE_SCENE_PARAMS;
|
end
|
end
|
|
|
//----------------------------------------
|
//----------------------------------------
|
Line 324... |
Line 353... |
oMemSelect = `SELECT_SCENE_MEM;
|
oMemSelect = `SELECT_SCENE_MEM;
|
TGA_O = `TAG_DATA_ADDRESS_TYPE;
|
TGA_O = `TAG_DATA_ADDRESS_TYPE;
|
MST_O = 1;
|
MST_O = 1;
|
rInitialWriteAddress = 0;
|
rInitialWriteAddress = 0;
|
rSetWriteAddr = 0;
|
rSetWriteAddr = 0;
|
rCoreBroadCast = 1;
|
//rCoreBroadCast = 1;
|
|
oCoreSelectMask = `SELECT_ALL_CORES;
|
rIncCoreSelect = 0;
|
rIncCoreSelect = 0;
|
RENDREN_O = 0;
|
RENDREN_O = 0;
|
rResetVertexCount = 0;
|
rResetVertexCount = 0;
|
GACK_O = 0;
|
GACK_O = 0;
|
//STDONE_O = 0;
|
|
oHostDataAvailable = 0;
|
oHostDataAvailable = 0;
|
|
|
rHostNextState = `HOST_WAIT_SCENE_PARAMS;
|
rHostNextState = `HOST_WAIT_SCENE_PARAMS;
|
end
|
end
|
//----------------------------------------
|
//----------------------------------------
|
Line 345... |
Line 374... |
oMemSelect = `SELECT_SCENE_MEM;
|
oMemSelect = `SELECT_SCENE_MEM;
|
TGA_O = `TAG_DATA_ADDRESS_TYPE;
|
TGA_O = `TAG_DATA_ADDRESS_TYPE;
|
MST_O = 1;
|
MST_O = 1;
|
rInitialWriteAddress = 0;
|
rInitialWriteAddress = 0;
|
rSetWriteAddr = 0;
|
rSetWriteAddr = 0;
|
rCoreBroadCast = 1;
|
//rCoreBroadCast = 1;
|
|
oCoreSelectMask = `SELECT_ALL_CORES;
|
rIncCoreSelect = 0;
|
rIncCoreSelect = 0;
|
RENDREN_O = 0;
|
RENDREN_O = 0;
|
rResetVertexCount = 0;
|
rResetVertexCount = 0;
|
GACK_O = 0;
|
GACK_O = 0;
|
//STDONE_O = 0;
|
|
oHostDataAvailable = 0;
|
oHostDataAvailable = 0;
|
|
|
if ( wWBMDone && ~wLastParameter )
|
if ( wWBMDone && ~wLastParameter )
|
rHostNextState = `HOST_WRITE_SCENE_PARAMS;
|
rHostNextState = `HOST_WRITE_SCENE_PARAMS;
|
else if (wWBMDone && wLastParameter )
|
else if (wWBMDone && wLastParameter )
|
Line 377... |
Line 406... |
oMemSelect = `SELECT_SCENE_MEM; //We are reading from the scene memory
|
oMemSelect = `SELECT_SCENE_MEM; //We are reading from the scene memory
|
TGA_O = `TAG_DATA_ADDRESS_TYPE; //We will write to the DATA section of the core MEM
|
TGA_O = `TAG_DATA_ADDRESS_TYPE; //We will write to the DATA section of the core MEM
|
MST_O = 1; //Keep master signal in 1 for now
|
MST_O = 1; //Keep master signal in 1 for now
|
rInitialWriteAddress = `CREG_PIXEL_2D_INITIAL_POSITION; //The address from which to start wrting @ the cores
|
rInitialWriteAddress = `CREG_PIXEL_2D_INITIAL_POSITION; //The address from which to start wrting @ the cores
|
rSetWriteAddr = 1; //Set to use the initial write address bellow
|
rSetWriteAddr = 1; //Set to use the initial write address bellow
|
rCoreBroadCast = 0; //Set to zero to unicast, starting from core 0
|
//rCoreBroadCast = 0; //Set to zero to unicast, starting from core 0
|
|
oCoreSelectMask = wCoreSelect;
|
rIncCoreSelect = 0; //Set to unicast to the next core
|
rIncCoreSelect = 0; //Set to unicast to the next core
|
RENDREN_O = 0;
|
RENDREN_O = 0;
|
rResetVertexCount = 0;
|
rResetVertexCount = 0;
|
GACK_O = 0;
|
GACK_O = 0;
|
//STDONE_O = 0;
|
|
oHostDataAvailable = 0;
|
oHostDataAvailable = 0;
|
|
|
|
|
rHostNextState = `HOST_UNICAST_CORE_CONFIG;
|
rHostNextState = `HOST_UNICAST_CORE_CONFIG;
|
end
|
end
|
Line 400... |
Line 429... |
oMemSelect = `SELECT_SCENE_MEM;
|
oMemSelect = `SELECT_SCENE_MEM;
|
TGA_O = `TAG_DATA_ADDRESS_TYPE;
|
TGA_O = `TAG_DATA_ADDRESS_TYPE;
|
MST_O = 1;
|
MST_O = 1;
|
rInitialWriteAddress = 0;
|
rInitialWriteAddress = 0;
|
rSetWriteAddr = 0;
|
rSetWriteAddr = 0;
|
rCoreBroadCast = 0;
|
//rCoreBroadCast = 0;
|
|
oCoreSelectMask = wCoreSelect;
|
rIncCoreSelect = 0;
|
rIncCoreSelect = 0;
|
RENDREN_O = 0;
|
RENDREN_O = 0;
|
rResetVertexCount = 0;
|
rResetVertexCount = 0;
|
GACK_O = 0;
|
GACK_O = 0;
|
//STDONE_O = 0;
|
|
oHostDataAvailable = 0;
|
oHostDataAvailable = 0;
|
|
|
rHostNextState = `HOST_WAIT_CORE_CONFIG;
|
rHostNextState = `HOST_WAIT_CORE_CONFIG;
|
end
|
end
|
//----------------------------------------
|
//----------------------------------------
|
Line 421... |
Line 450... |
oMemSelect = `SELECT_SCENE_MEM;
|
oMemSelect = `SELECT_SCENE_MEM;
|
TGA_O = `TAG_DATA_ADDRESS_TYPE;
|
TGA_O = `TAG_DATA_ADDRESS_TYPE;
|
MST_O = 1;
|
MST_O = 1;
|
rInitialWriteAddress = 0;
|
rInitialWriteAddress = 0;
|
rSetWriteAddr = 0;
|
rSetWriteAddr = 0;
|
rCoreBroadCast = 0;
|
//rCoreBroadCast = 0;
|
|
oCoreSelectMask = wCoreSelect;
|
rIncCoreSelect = 0;
|
rIncCoreSelect = 0;
|
RENDREN_O = 0;
|
RENDREN_O = 0;
|
rResetVertexCount = 0;
|
rResetVertexCount = 0;
|
GACK_O = 0;
|
GACK_O = 0;
|
//STDONE_O = 0;
|
|
oHostDataAvailable = 0;
|
oHostDataAvailable = 0;
|
|
|
|
|
if (wWBMDone && !(oReadAddress % 2))
|
if (wWBMDone && !(oReadAddress % 2))
|
rHostNextState = `HOST_UNICAST_CORE_CONFIG;
|
rHostNextState = `HOST_UNICAST_CORE_CONFIG;
|
Line 453... |
Line 482... |
oMemSelect = `SELECT_GEO_MEM;
|
oMemSelect = `SELECT_GEO_MEM;
|
TGA_O = `TAG_DATA_ADDRESS_TYPE;
|
TGA_O = `TAG_DATA_ADDRESS_TYPE;
|
MST_O = 0; //The master signal goes to zero until request
|
MST_O = 0; //The master signal goes to zero until request
|
rInitialWriteAddress = `CREG_PIXEL_2D_INITIAL_POSITION; //Write starting from this location on the cores
|
rInitialWriteAddress = `CREG_PIXEL_2D_INITIAL_POSITION; //Write starting from this location on the cores
|
rSetWriteAddr = 1; //Set to use the initial write address bellow
|
rSetWriteAddr = 1; //Set to use the initial write address bellow
|
rCoreBroadCast = 0;
|
//rCoreBroadCast = 0;
|
|
oCoreSelectMask = wCoreSelect;
|
rIncCoreSelect = 1; //Moving to configure the next core now
|
rIncCoreSelect = 1; //Moving to configure the next core now
|
RENDREN_O = 0;
|
RENDREN_O = 0;
|
rResetVertexCount = 0;
|
rResetVertexCount = 0;
|
GACK_O = 0;
|
GACK_O = 0;
|
//STDONE_O = 0;
|
|
oHostDataAvailable = 0;
|
oHostDataAvailable = 0;
|
|
|
if (wCoreSelect[`MAX_CORES-1] == 1)
|
if (wLastCoreSelected)//wCoreSelect[`MAX_CORES-1] == 1)
|
rHostNextState = `HOST_PREPARE_FOR_GEO_REQUESTS;
|
rHostNextState = `HOST_PREPARE_FOR_GEO_REQUESTS;
|
else
|
else
|
rHostNextState = `HOST_UNICAST_CORE_CONFIG;
|
rHostNextState = `HOST_UNICAST_CORE_CONFIG;
|
end
|
end
|
//----------------------------------------
|
//----------------------------------------
|
Line 481... |
Line 510... |
oMemSelect = `SELECT_GEO_MEM; //Use external GEO mem for reading
|
oMemSelect = `SELECT_GEO_MEM; //Use external GEO mem for reading
|
TGA_O = `TAG_DATA_ADDRESS_TYPE; //We write to the data MEM @ the cores
|
TGA_O = `TAG_DATA_ADDRESS_TYPE; //We write to the data MEM @ the cores
|
MST_O = 0; //The master signal goes to zero until request
|
MST_O = 0; //The master signal goes to zero until request
|
rInitialWriteAddress = `CREG_V0; //Write starting from this location on the cores
|
rInitialWriteAddress = `CREG_V0; //Write starting from this location on the cores
|
rSetWriteAddr = 1; //Set to use the initial write address bellow
|
rSetWriteAddr = 1; //Set to use the initial write address bellow
|
rCoreBroadCast = 1; //From now on we only broadcast
|
//rCoreBroadCast = 1; //From now on we only broadcast
|
|
oCoreSelectMask = `SELECT_ALL_CORES;
|
rIncCoreSelect = 0; //Ignored during broadcasts
|
rIncCoreSelect = 0; //Ignored during broadcasts
|
RENDREN_O = 0;
|
RENDREN_O = 0;
|
rResetVertexCount = 1;
|
rResetVertexCount = 1;
|
GACK_O = 0;
|
GACK_O = 0;
|
//STDONE_O = 0;
|
|
oHostDataAvailable = 0;
|
oHostDataAvailable = 0;
|
|
|
if (iGPUDone)
|
if (wGPUDone)
|
rHostNextState = `HOST_GPU_EXECUTION_DONE;
|
rHostNextState = `HOST_GPU_EXECUTION_DONE;
|
else
|
else
|
rHostNextState = `HOST_BROADCAST_NEXT_VERTEX;
|
rHostNextState = `HOST_BROADCAST_NEXT_VERTEX;
|
|
|
end
|
end
|
Line 506... |
Line 535... |
oMemSelect = `SELECT_GEO_MEM; //Use external GEO mem for reading
|
oMemSelect = `SELECT_GEO_MEM; //Use external GEO mem for reading
|
TGA_O = `TAG_DATA_ADDRESS_TYPE; //We write to the data MEM @ the cores
|
TGA_O = `TAG_DATA_ADDRESS_TYPE; //We write to the data MEM @ the cores
|
MST_O = 0; //The master signal goes to zero until request
|
MST_O = 0; //The master signal goes to zero until request
|
rInitialWriteAddress = `CREG_V0; //Write starting from this location on the cores
|
rInitialWriteAddress = `CREG_V0; //Write starting from this location on the cores
|
rSetWriteAddr = 1; //Set to use the initial write address bellow
|
rSetWriteAddr = 1; //Set to use the initial write address bellow
|
rCoreBroadCast = 1; //From now on we only broadcast
|
//rCoreBroadCast = 1; //From now on we only broadcast
|
|
oCoreSelectMask = `SELECT_ALL_CORES;
|
rIncCoreSelect = 0; //Ignored during broadcasts
|
rIncCoreSelect = 0; //Ignored during broadcasts
|
RENDREN_O = 0;
|
RENDREN_O = 0;
|
rResetVertexCount = 0;
|
rResetVertexCount = 0;
|
GACK_O = 1;
|
GACK_O = 1;
|
//STDONE_O = 0;
|
|
oHostDataAvailable = 0;
|
oHostDataAvailable = 0;
|
|
|
|
|
rHostNextState = `HOST_BROADCAST_NEXT_VERTEX;
|
rHostNextState = `HOST_BROADCAST_NEXT_VERTEX;
|
|
|
Line 533... |
Line 562... |
oMemSelect = `SELECT_GEO_MEM;
|
oMemSelect = `SELECT_GEO_MEM;
|
TGA_O = `TAG_DATA_ADDRESS_TYPE;
|
TGA_O = `TAG_DATA_ADDRESS_TYPE;
|
MST_O = 1; //Start the Transmition
|
MST_O = 1; //Start the Transmition
|
rInitialWriteAddress = 0;
|
rInitialWriteAddress = 0;
|
rSetWriteAddr = 0;
|
rSetWriteAddr = 0;
|
rCoreBroadCast = 1;
|
//rCoreBroadCast = 1;
|
|
oCoreSelectMask = `SELECT_ALL_CORES;
|
rIncCoreSelect = 0;
|
rIncCoreSelect = 0;
|
RENDREN_O = `SELECT_ALL_CORES;
|
RENDREN_O = `SELECT_ALL_CORES;
|
rResetVertexCount = 0;
|
rResetVertexCount = 0;
|
GACK_O = 0;
|
GACK_O = 0;
|
//STDONE_O = 0;
|
|
oHostDataAvailable = 0;
|
oHostDataAvailable = 0;
|
|
|
rHostNextState = `HOST_WAIT_FOR_VERTEX;
|
rHostNextState = `HOST_WAIT_FOR_VERTEX;
|
|
|
end
|
end
|
Line 555... |
Line 584... |
oMemSelect = `SELECT_GEO_MEM;
|
oMemSelect = `SELECT_GEO_MEM;
|
TGA_O = `TAG_DATA_ADDRESS_TYPE;
|
TGA_O = `TAG_DATA_ADDRESS_TYPE;
|
MST_O = 1; //Start the Transmition
|
MST_O = 1; //Start the Transmition
|
rInitialWriteAddress = 0;
|
rInitialWriteAddress = 0;
|
rSetWriteAddr = 0;
|
rSetWriteAddr = 0;
|
rCoreBroadCast = 1;
|
//rCoreBroadCast = 1;
|
|
oCoreSelectMask = `SELECT_ALL_CORES;
|
rIncCoreSelect = 0;
|
rIncCoreSelect = 0;
|
RENDREN_O = `SELECT_ALL_CORES;
|
RENDREN_O = `SELECT_ALL_CORES;
|
rResetVertexCount = 0;
|
rResetVertexCount = 0;
|
GACK_O = 0;
|
GACK_O = 0;
|
//STDONE_O = 0;
|
|
oHostDataAvailable = 0;
|
oHostDataAvailable = 0;
|
|
|
|
|
if (wWBMDone & ~wLastVertexInFrame )
|
if (wWBMDone & ~wLastVertexInFrame )
|
rHostNextState = `HOST_BROADCAST_NEXT_VERTEX;
|
rHostNextState = `HOST_BROADCAST_NEXT_VERTEX;
|
else if (wWBMDone & wLastVertexInFrame )
|
else if (wWBMDone & wLastVertexInFrame )
|
rHostNextState = `HOST_GET_PRIMITIVE_COUNT;
|
rHostNextState = `HOST_GET_PRIMITIVE_COUNT;
|
else
|
else
|
rHostNextState = `HOST_WAIT_FOR_VERTEX;
|
rHostNextState = `HOST_WAIT_FOR_VERTEX;
|
|
|
|
|
/*
|
|
if (wWBMDone)
|
|
rHostNextState = `HOST_WAIT_DATA_READ_CONFIRMATION;
|
|
else
|
|
rHostNextState = `HOST_WAIT_FOR_VERTEX;
|
|
*/
|
|
end
|
end
|
//----------------------------------------
|
//----------------------------------------
|
`HOST_GET_PRIMITIVE_COUNT:
|
`HOST_GET_PRIMITIVE_COUNT:
|
begin
|
begin
|
rWBMEnable = 0; //Disable WBM when it is donw
|
rWBMEnable = 0; //Disable WBM when it is donw
|
Line 590... |
Line 612... |
oMemSelect = `SELECT_GEO_MEM;
|
oMemSelect = `SELECT_GEO_MEM;
|
TGA_O = `TAG_DATA_ADDRESS_TYPE;
|
TGA_O = `TAG_DATA_ADDRESS_TYPE;
|
MST_O = 1; //Start the Transmition
|
MST_O = 1; //Start the Transmition
|
rInitialWriteAddress = 0;
|
rInitialWriteAddress = 0;
|
rSetWriteAddr = 0;
|
rSetWriteAddr = 0;
|
rCoreBroadCast = 1;
|
//rCoreBroadCast = 1;
|
|
oCoreSelectMask = `SELECT_ALL_CORES;
|
rIncCoreSelect = 0;
|
rIncCoreSelect = 0;
|
RENDREN_O = `SELECT_ALL_CORES;
|
RENDREN_O = `SELECT_ALL_CORES;
|
rResetVertexCount = 0;
|
rResetVertexCount = 0;
|
GACK_O = 0;
|
GACK_O = 0;
|
//STDONE_O = 0;
|
|
oHostDataAvailable = 0;//1;
|
oHostDataAvailable = 0;//1;
|
|
|
if (wVertexCount >= iPrimitiveCount)
|
if (wVertexCount >= iPrimitiveCount)
|
rHostNextState = `HOST_LAST_PRIMITIVE_REACHED;
|
rHostNextState = `HOST_LAST_PRIMITIVE_REACHED;
|
else
|
else
|
Line 620... |
Line 642... |
oMemSelect = `SELECT_GEO_MEM; //Use external GEO mem for reading
|
oMemSelect = `SELECT_GEO_MEM; //Use external GEO mem for reading
|
TGA_O = `TAG_DATA_ADDRESS_TYPE; //We write to the data MEM @ the cores
|
TGA_O = `TAG_DATA_ADDRESS_TYPE; //We write to the data MEM @ the cores
|
MST_O = 0; //The master signal goes to zero until request
|
MST_O = 0; //The master signal goes to zero until request
|
rInitialWriteAddress = `CREG_V0; //Write starting from this location on the cores
|
rInitialWriteAddress = `CREG_V0; //Write starting from this location on the cores
|
rSetWriteAddr = 1; //Set to use the initial write address bellow
|
rSetWriteAddr = 1; //Set to use the initial write address bellow
|
rCoreBroadCast = 1; //From now on we only broadcast
|
//rCoreBroadCast = 1; //From now on we only broadcast
|
|
oCoreSelectMask = `SELECT_ALL_CORES;
|
rIncCoreSelect = 0; //Ignored during broadcasts
|
rIncCoreSelect = 0; //Ignored during broadcasts
|
RENDREN_O = `SELECT_ALL_CORES;
|
RENDREN_O = `SELECT_ALL_CORES;
|
rResetVertexCount = 0;
|
rResetVertexCount = 0;
|
GACK_O = 0;
|
GACK_O = 0;
|
//STDONE_O = 0;
|
|
oHostDataAvailable = 1;
|
oHostDataAvailable = 1;
|
|
|
if ( iHostDataReadConfirmed )
|
if ( iHostDataReadConfirmed )
|
rHostNextState = `HOST_ACK_GEO_REQUEST;
|
rHostNextState = `HOST_ACK_GEO_REQUEST;
|
else
|
else
|
Line 644... |
Line 666... |
oMemSelect = `SELECT_GEO_MEM;
|
oMemSelect = `SELECT_GEO_MEM;
|
TGA_O = `TAG_DATA_ADDRESS_TYPE;
|
TGA_O = `TAG_DATA_ADDRESS_TYPE;
|
MST_O = 1;
|
MST_O = 1;
|
rInitialWriteAddress = 0;
|
rInitialWriteAddress = 0;
|
rSetWriteAddr = 0;
|
rSetWriteAddr = 0;
|
rCoreBroadCast = 1;
|
//rCoreBroadCast = 1;
|
|
oCoreSelectMask = `SELECT_ALL_CORES;
|
rIncCoreSelect = 0;
|
rIncCoreSelect = 0;
|
RENDREN_O = `SELECT_ALL_CORES;
|
RENDREN_O = `SELECT_ALL_CORES;
|
rResetVertexCount = 0; //Reset the vertex count to zero
|
rResetVertexCount = 0; //Reset the vertex count to zero
|
GACK_O = 0;
|
GACK_O = 0;
|
//STDONE_O = 1;
|
|
oHostDataAvailable = 0;
|
oHostDataAvailable = 0;
|
|
|
|
|
|
|
if (iGPUCommitedResults)
|
if (iGPUCommitedResults)
|
begin
|
begin
|
|
`ifndef VERILATOR
|
`ifndef NO_DISPLAY_STATS
|
`ifndef NO_DISPLAY_STATS
|
for (i = 0; i < `MAX_CORES; i = i + 1)
|
for (i = 0; i < `MAX_CORES; i = i + 1)
|
begin
|
begin
|
$write(".");$fflush;
|
$write(".");
|
|
`ifndef VERILATOR
|
|
$fflush;
|
|
`endif
|
end
|
end
|
|
|
RenderedPixels = RenderedPixels + `MAX_CORES;
|
RenderedPixels = RenderedPixels + `MAX_CORES;
|
if ( RenderedPixels % iDebugWidth == 0)
|
if ( RenderedPixels % iDebugWidth == 0)
|
$write("]%d\n[",RenderedPixels / iDebugWidth);$fflush;
|
$write("]%d\n[",RenderedPixels / iDebugWidth);
|
|
`ifndef VERILATOR
|
|
$fflush;
|
|
`endif
|
|
`endif
|
`endif
|
`endif
|
|
|
rHostNextState = `HOST_PREPARE_FOR_GEO_REQUESTS;
|
rHostNextState = `HOST_PREPARE_FOR_GEO_REQUESTS;
|
end
|
end
|
else
|
else
|
Line 684... |
Line 714... |
oMemSelect = 0;
|
oMemSelect = 0;
|
TGA_O = 0;
|
TGA_O = 0;
|
MST_O = 0;
|
MST_O = 0;
|
rInitialWriteAddress = 0;
|
rInitialWriteAddress = 0;
|
rSetWriteAddr = 0;
|
rSetWriteAddr = 0;
|
rCoreBroadCast = 0;
|
//rCoreBroadCast = 0;
|
|
oCoreSelectMask = wCoreSelect;
|
rIncCoreSelect = 0;
|
rIncCoreSelect = 0;
|
RENDREN_O = 0;
|
RENDREN_O = 0;
|
rResetVertexCount = 0;
|
rResetVertexCount = 0;
|
GACK_O = 0;
|
GACK_O = 0;
|
//STDONE_O = 0;
|
|
oHostDataAvailable = 0;
|
oHostDataAvailable = 0;
|
|
|
rHostNextState = `HOST_GPU_EXECUTION_DONE;
|
rHostNextState = `HOST_GPU_EXECUTION_DONE;
|
end
|
end
|
//----------------------------------------
|
//----------------------------------------
|
Line 706... |
Line 736... |
oMemSelect = 0;
|
oMemSelect = 0;
|
TGA_O = 0;
|
TGA_O = 0;
|
MST_O = 0;
|
MST_O = 0;
|
rInitialWriteAddress = 0;
|
rInitialWriteAddress = 0;
|
rSetWriteAddr = 0;
|
rSetWriteAddr = 0;
|
rCoreBroadCast = 0;
|
//rCoreBroadCast = 0;
|
|
oCoreSelectMask = wCoreSelect;
|
rIncCoreSelect = 0;
|
rIncCoreSelect = 0;
|
RENDREN_O = 0;
|
RENDREN_O = 0;
|
rResetVertexCount = 0;
|
rResetVertexCount = 0;
|
GACK_O = 0;
|
GACK_O = 0;
|
//STDONE_O = 0;
|
|
oHostDataAvailable = 0;
|
oHostDataAvailable = 0;
|
|
|
rHostNextState = `HOST_IDLE;
|
rHostNextState = `HOST_IDLE;
|
end
|
end
|
//----------------------------------------
|
//----------------------------------------
|