Line 22... |
Line 22... |
|
|
This is the main Finite State Machine.
|
This is the main Finite State Machine.
|
|
|
**********************************************************************************/
|
**********************************************************************************/
|
|
|
|
|
|
|
`timescale 1ns / 1ps
|
`timescale 1ns / 1ps
|
`include "aDefinitions.v"
|
`include "aDefinitions.v"
|
`ifdef VERILATOR
|
`ifdef VERILATOR
|
`include "Collaterals.v"
|
`include "Collaterals.v"
|
`endif
|
`endif
|
Line 36... |
Line 38... |
`define CU_WAIT_FOR_CONFIG_DATA_READ 3
|
`define CU_WAIT_FOR_CONFIG_DATA_READ 3
|
`define CU_ACK_CONFIG_DATA_READ 4
|
`define CU_ACK_CONFIG_DATA_READ 4
|
`define CU_PRECALCULATE_CONSTANTS 5
|
`define CU_PRECALCULATE_CONSTANTS 5
|
`define CU_WAIT_FOR_CONSTANT 6
|
`define CU_WAIT_FOR_CONSTANT 6
|
`define CU_ACK_PRECALCULATE_CONSTANTS 7
|
`define CU_ACK_PRECALCULATE_CONSTANTS 7
|
`define CU_WAIT_FOR_TASK 8
|
`define CU_TRIGGER_MAIN 8
|
`define CU_READ_TASK_DATA 9
|
`define CU_WAIT_FOR_MAIN 9
|
`define CU_WAIT_TASK_DATA_READ 10
|
`define CU_ACK_MAIN 10
|
`define CU_ACK_TASK_DATA_READ 11
|
`define CU_CLEAR_REGISTERS 11
|
`define CU_TRIGGER_RGU 12
|
`define CU_WAIT_CLEAR_REGISTERS 12
|
`define CU_WAIT_FOR_RGU 13
|
`define CU_ACK_CLEAR_REGISTERS 13
|
`define CU_ACK_RGU 14
|
`define CU_PERFORM_INTIAL_CONFIGURATION 14
|
`define CU_TRIGGER_GEO 15
|
`define CU_TRIGGER_USERCONSTANTS 15
|
`define CU_WAIT_FOR_GEO_SYNC 16
|
`define CU_WAIT_USERCONSTANTS 16
|
//`define CU_CHECK_AABBIU_REQUEST 17
|
`define CU_ACK_USERCONSTANTS 17
|
`define CU_TRIGGER_TCC 17
|
`define CU_DONE 18
|
//`define CU_CHECK_BIU_REQUEST 18
|
`define CU_WAIT_FOR_RENDER_ENABLE 19
|
//`define CU_TRIGGER_TFF 18
|
`define CU_WAIT_FOR_HOST_DATA_AVAILABLE 20
|
//`define CU_CHECK_GEO_DONE 19
|
`define CU_WAIT_FOR_HOST_DATA_ACK 21
|
//`define CU_WAIT_FOR_TFF 19
|
`define CU_COMMIT_PIXEL_RESULT 22
|
`define CU_TRIGGER_AABBIU 20
|
|
`define CU_WAIT_FOR_AABBIU 21
|
|
`define CU_TRIGGER_MAIN 22
|
|
`define CU_WAIT_FOR_MAIN 23
|
|
`define CU_ACK_MAIN 24
|
|
`define CU_TRIGGER_PSU 25
|
|
`define CU_WAIT_FOR_PSU 26
|
|
`define CU_ACK_PSU 27
|
|
//`define CU_TRIGGER_PCU 28
|
|
`define CU_WAIT_FOR_PCU 29
|
|
`define CU_ACK_PCU 30
|
|
`define CU_CHECK_HIT 31
|
|
`define CU_CLEAR_REGISTERS 32
|
|
`define CU_WAIT_CLEAR_REGISTERS 33
|
|
`define CU_ACK_CLEAR_REGISTERS 34
|
|
`define CU_TRIGGER_PSU_WITH_TEXTURE 35
|
|
`define WAIT_FOR_TCC 36
|
|
`define CU_TRIGGER_NPU 37
|
|
`define CU_WAIT_NPU 38
|
|
`define CU_ACK_NPU 39
|
|
`define CU_PERFORM_INTIAL_CONFIGURATION 40
|
|
`define CU_SET_PICTH 41
|
|
`define CU_TRIGGER_USERCONSTANTS 42
|
|
`define CU_WAIT_USERCONSTANTS 43
|
|
`define CU_ACK_USERCONSTANTS 44
|
|
`define CU_TRIGGER_USERPIXELSHADER 45
|
|
`define CU_WAIT_FOR_USERPIXELSHADER 46
|
|
`define CU_ACK_USERPIXELSHADER 47
|
|
`define CU_DONE 48
|
|
`define CU_WAIT_FOR_RENDER_ENABLE 49
|
|
`define CU_ACK_TCC 50
|
|
`define CU_WAIT_FOR_HOST_DATA_AVAILABLE 51
|
|
`define CU_WAIT_FOR_HOST_DATA_ACK 52
|
|
`define CU_COMMIT_PIXEL_RESULT 53
|
|
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
module ControlUnit
|
module ControlUnit
|
(
|
(
|
|
|
input wire Clock,
|
input wire Clock,
|
Line 157... |
Line 125... |
.S( iUCodeReturnValue ),
|
.S( iUCodeReturnValue ),
|
.Q( wHit )
|
.Q( wHit )
|
);
|
);
|
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
|
|
`ifdef DEBUG_CU
|
|
always @ ( wHit )
|
|
begin
|
|
$display( "*** Triangle HIT ***\n");
|
|
end
|
|
`endif
|
|
|
|
//Next states logic and Reset sequence
|
//Next states logic and Reset sequence
|
always @(posedge Clock or posedge Reset)
|
always @(posedge Clock or posedge Reset)
|
begin
|
begin
|
|
|
Line 209... |
Line 171... |
end
|
end
|
//-----------------------------------------
|
//-----------------------------------------
|
|
|
`CU_WAIT_FOR_INITIAL_CONFIGURATION:
|
`CU_WAIT_FOR_INITIAL_CONFIGURATION:
|
begin
|
begin
|
//$display("CORE: %d CU_WAIT_FOR_INITIAL_CONFIGURATION", iDebug_CoreID);
|
|
// `ifdef DEBUG_CU
|
|
// $display("%d Control: CU_WAIT_FOR_INITIAL_CONFIGURATION\n",$time);
|
|
// `endif
|
|
|
|
//oRamBusOwner = 0;
|
|
oCodeInstructioPointer = 0;
|
oCodeInstructioPointer = 0;
|
oGFUEnable = 0;
|
oGFUEnable = 0;
|
oUCodeEnable = 0;
|
oUCodeEnable = 0;
|
oIOWritePixel = 0;
|
oIOWritePixel = 0;
|
rResetHitFlop = 1;
|
rResetHitFlop = 1;
|
Line 270... |
Line 227... |
|
|
`ifdef DEBUG_CU
|
`ifdef DEBUG_CU
|
$display("%d CU_CLEAR_REGISTERS\n",$time);
|
$display("%d CU_CLEAR_REGISTERS\n",$time);
|
`endif
|
`endif
|
|
|
//oRamBusOwner = `REG_BUS_OWNED_BY_UCODE;
|
|
oCodeInstructioPointer = `ENTRYPOINT_INDEX_INITIAL;
|
oCodeInstructioPointer = `ENTRYPOINT_INDEX_INITIAL;
|
oGFUEnable = 0;
|
oGFUEnable = 0;
|
oUCodeEnable = 1; //*
|
oUCodeEnable = 1; //*
|
oIOWritePixel = 0;
|
oIOWritePixel = 0;
|
rResetHitFlop = 0;
|
rResetHitFlop = 0;
|
Line 284... |
Line 240... |
oFlipMemEnabled = 1;
|
oFlipMemEnabled = 1;
|
oFlipMem = 0;
|
oFlipMem = 0;
|
oDone = 0;
|
oDone = 0;
|
oResultCommited = 0;
|
oResultCommited = 0;
|
|
|
////$display("\n\n %d XOXOXOXOX FLIP XOXOXOXOXOX\n\n",$time);
|
|
//oIncCurrentPitch = 0;
|
|
|
|
NextState = `CU_WAIT_CLEAR_REGISTERS;
|
NextState = `CU_WAIT_CLEAR_REGISTERS;
|
end
|
end
|
//-----------------------------------------
|
//-----------------------------------------
|
`CU_WAIT_CLEAR_REGISTERS:
|
`CU_WAIT_CLEAR_REGISTERS:
|
begin
|
begin
|
// `ifdef DEBUG_CU
|
|
// $display("%d CU_WAIT_CLEAR_REGISTERS\n",$time);
|
|
// `endif
|
|
//$display("CORE: %d CU_WAIT_CLEAR_REGISTERS", iDebug_CoreID);
|
|
//oRamBusOwner = `REG_BUS_OWNED_BY_UCODE;
|
|
oCodeInstructioPointer = `ENTRYPOINT_INDEX_INITIAL;
|
oCodeInstructioPointer = `ENTRYPOINT_INDEX_INITIAL;
|
oGFUEnable = 0;
|
oGFUEnable = 0;
|
oUCodeEnable = 0;
|
oUCodeEnable = 0;
|
oIOWritePixel = 0;
|
oIOWritePixel = 0;
|
rResetHitFlop = 0;
|
rResetHitFlop = 0;
|
Line 351... |
Line 301... |
|
|
//-----------------------------------------
|
//-----------------------------------------
|
`CU_WAIT_FOR_CONFIG_DATA_READ:
|
`CU_WAIT_FOR_CONFIG_DATA_READ:
|
begin
|
begin
|
|
|
// `ifdef DEBUG_CU
|
|
// $display("%d Control: CU_WAIT_FOR_CONFIG_DATA_READ\n",$time);
|
|
// `endif
|
|
|
|
|
|
//$display("CORE: %d CU_WAIT_FOR_CONFIG_DATA_READ", iDebug_CoreID);
|
|
|
|
//oRamBusOwner = 0;//`REG_BUS_OWNED_BY_BCU;
|
|
oCodeInstructioPointer = 0;
|
oCodeInstructioPointer = 0;
|
oGFUEnable = 0;
|
oGFUEnable = 0;
|
oUCodeEnable = 0;
|
oUCodeEnable = 0;
|
oIOWritePixel = 0;
|
oIOWritePixel = 0;
|
rResetHitFlop = 0;
|
rResetHitFlop = 0;
|
Line 574... |
Line 516... |
NextState = `CU_WAIT_FOR_HOST_DATA_AVAILABLE;//`CU_TRIGGER_RGU;
|
NextState = `CU_WAIT_FOR_HOST_DATA_AVAILABLE;//`CU_TRIGGER_RGU;
|
else
|
else
|
NextState = `CU_WAIT_FOR_RENDER_ENABLE;
|
NextState = `CU_WAIT_FOR_RENDER_ENABLE;
|
end
|
end
|
//-----------------------------------------
|
//-----------------------------------------
|
/*
|
|
`CU_TRIGGER_RGU:
|
|
begin
|
|
|
|
`ifdef DEBUG_CU
|
|
$display("CORE: %d CU_TRIGGER_RGU", iDebug_CoreID);
|
|
`endif
|
|
|
|
|
|
//oRamBusOwner = `REG_BUS_OWNED_BY_UCODE;
|
|
oCodeInstructioPointer = `ENTRYPOINT_INDEX_RGU;
|
|
oGFUEnable = 0;
|
|
oUCodeEnable = 1;
|
|
oIOWritePixel = 0;
|
|
rResetHitFlop = 0;
|
|
rHitFlopEnable = 0;
|
|
oTriggerTFF = 0;
|
|
oSetCurrentPitch = 0;
|
|
oFlipMemEnabled = 0;
|
|
oFlipMem = 0;
|
|
oDone = 0;
|
|
oResultCommited = 0;
|
|
//oIncCurrentPitch = 0;
|
|
|
|
NextState = `CU_WAIT_FOR_RGU;
|
|
end
|
|
//-----------------------------------------
|
|
`CU_WAIT_FOR_RGU:
|
|
begin
|
|
|
|
// `ifdef DEBUG_CU
|
|
// $display("%d Control: CU_WAIT_FOR_RGU\n",$time);
|
|
// `endif
|
|
|
|
//oRamBusOwner = `REG_BUS_OWNED_BY_UCODE;
|
|
oCodeInstructioPointer = 0;
|
|
oGFUEnable = 0;
|
|
oUCodeEnable = 0;
|
|
oIOWritePixel = 0;
|
|
rResetHitFlop = 0;
|
|
rHitFlopEnable = 0;
|
|
oTriggerTFF = 0;
|
|
oSetCurrentPitch = 0;
|
|
oFlipMemEnabled = 0;
|
|
oFlipMem = 0;
|
|
oDone = 0;
|
|
oResultCommited = 0;
|
|
//oIncCurrentPitch = 0;
|
|
|
|
if ( iUCodeDone )
|
|
NextState = `CU_ACK_RGU;
|
|
else
|
|
NextState = `CU_WAIT_FOR_RGU;
|
|
end
|
|
//-----------------------------------------
|
|
`CU_ACK_RGU:
|
|
begin
|
|
|
|
`ifdef DEBUG_CU
|
|
$display("CORE: %d CU_ACK_RGU", iDebug_CoreID);
|
|
`endif
|
|
//oRamBusOwner = `REG_BUS_OWNED_BY_UCODE;
|
|
oCodeInstructioPointer = 0;
|
|
oGFUEnable = 0;
|
|
oUCodeEnable = 0;
|
|
oIOWritePixel = 0;
|
|
rResetHitFlop = 0;
|
|
rHitFlopEnable = 0;
|
|
oTriggerTFF = 0;
|
|
oSetCurrentPitch = 0;
|
|
oFlipMemEnabled = 1;
|
|
oFlipMem = 0;
|
|
oDone = 0;
|
|
oResultCommited = 0;
|
|
//oIncCurrentPitch = 0;
|
|
|
|
if ( iUCodeDone == 0 & iRenderEnable == 1)
|
|
NextState = `CU_WAIT_FOR_HOST_DATA_AVAILABLE;//`CU_TRIGGER_GEO;///////////// GET RID OF GEO!!!
|
|
else
|
|
NextState = `CU_ACK_RGU;
|
|
|
|
end
|
|
*/
|
|
//-----------------------------------------
|
|
`CU_TRIGGER_TCC:
|
|
begin
|
|
////$display("CU_TRIGGER_TCC");
|
|
`ifdef DEBUG_CU
|
|
$display("%d CORE %d Control: CU_TRIGGER_TCC\n",$time,iDebug_CoreID);
|
|
`endif
|
|
|
|
//oRamBusOwner = `REG_BUS_OWNED_BY_UCODE;
|
|
oCodeInstructioPointer = `ENTRYPOINT_INDEX_TCC;
|
|
oUCodeEnable = 1; //*
|
|
oGFUEnable = 0;
|
|
oIOWritePixel = 0;
|
|
rResetHitFlop = 0;
|
|
rHitFlopEnable = 0;
|
|
oTriggerTFF = 0;
|
|
oSetCurrentPitch = 0;
|
|
oFlipMemEnabled = 1;
|
|
oFlipMem = 0; //We need u,v from last IO read cycle
|
|
oResultCommited = 0;
|
|
////$display("\n\n %d XOXOXOXOX FLIP XOXOXOXOXOX\n\n",$time);
|
|
//oIncCurrentPitch = 0;
|
|
oDone = 0;
|
|
|
|
NextState = `WAIT_FOR_TCC;
|
|
end
|
|
//-----------------------------------------
|
|
`WAIT_FOR_TCC:
|
|
begin
|
|
|
|
////$display("WAIT_FOR_TCC");
|
|
//oRamBusOwner = `REG_BUS_OWNED_BY_UCODE;
|
|
oCodeInstructioPointer = `ENTRYPOINT_INDEX_TCC;
|
|
oUCodeEnable = 0; //*
|
|
oGFUEnable = 0;
|
|
oIOWritePixel = 0;
|
|
rResetHitFlop = 0;
|
|
rHitFlopEnable = 0;
|
|
oTriggerTFF = 0;
|
|
oSetCurrentPitch = 0;
|
|
oFlipMemEnabled = 1;
|
|
oFlipMem = 0;
|
|
oDone = 0;
|
|
oResultCommited = 0;
|
|
//oIncCurrentPitch = 0;
|
|
|
|
if ( iUCodeDone )
|
|
NextState = `CU_ACK_TCC;
|
|
else
|
|
NextState = `WAIT_FOR_TCC;
|
|
|
|
end
|
|
//-----------------------------------------
|
|
`CU_ACK_TCC:
|
|
begin
|
|
|
|
////$display("WAIT_FOR_TCC");
|
|
//oRamBusOwner = `REG_BUS_OWNED_BY_UCODE;
|
|
oCodeInstructioPointer = `ENTRYPOINT_INDEX_TCC;
|
|
oUCodeEnable = 0; //*
|
|
oGFUEnable = 0;
|
|
oIOWritePixel = 0;
|
|
rResetHitFlop = 0;
|
|
rHitFlopEnable = 0;
|
|
oTriggerTFF = 0;
|
|
oSetCurrentPitch = 0;
|
|
oFlipMemEnabled = 0;
|
|
oFlipMem = 0;
|
|
oDone = 0;
|
|
oResultCommited = 0;
|
|
//oIncCurrentPitch = 0;
|
|
|
|
if ( iUCodeDone == 0 && iSceneTraverseComplete == 1'b1) //DDDD
|
|
NextState = `CU_TRIGGER_PSU_WITH_TEXTURE;
|
|
else if (iUCodeDone == 0 && iSceneTraverseComplete == 1'b0)
|
|
NextState = `CU_WAIT_FOR_HOST_DATA_AVAILABLE;
|
|
else
|
|
NextState = `CU_ACK_TCC;
|
|
|
|
end
|
|
//-----------------------------------------
|
|
/*
|
|
Was there any hit at all?
|
|
At this point, all the triangles in the list
|
|
have been traversed looking for a hit with our ray.
|
|
There are 3 possibilities:
|
|
1) The was not a single hit, then just paint a black
|
|
pixel on the screen and send it via PCU.
|
|
2)There was a hit and Texturing is not enabled, then trigger the PSU with
|
|
no texturing
|
|
2) There was a hit and Texturing is enabled, then fetch the texture
|
|
values corresponding to the triangle that we hitted.
|
|
*/
|
|
`CU_CHECK_HIT:
|
|
begin
|
|
|
|
`ifdef DEBUG_CU
|
|
$display("%d CORE %d Control: CU_CHECK_HIT\n",$time,iDebug_CoreID);
|
|
`endif
|
|
|
|
|
|
//oRamBusOwner = `REG_BUS_OWNED_BY_GFU;
|
|
oCodeInstructioPointer = 0;
|
|
oUCodeEnable = 0;
|
|
oGFUEnable = 0; ///CHANGED Aug 15
|
|
oIOWritePixel = 0;
|
|
rResetHitFlop = 0;
|
|
rHitFlopEnable = 0;
|
|
oTriggerTFF = 0;
|
|
oSetCurrentPitch = 0;
|
|
oFlipMemEnabled = 0;
|
|
oFlipMem = 0;
|
|
oDone = 0;
|
|
oResultCommited = 0;
|
|
|
|
|
|
|
|
if (wHit)
|
|
begin
|
|
//$display("HIT");
|
|
NextState = `CU_TRIGGER_PSU_WITH_TEXTURE;
|
|
end
|
|
else
|
|
NextState = `CU_TRIGGER_USERPIXELSHADER;//666
|
|
|
|
end
|
|
|
|
//-----------------------------------------
|
|
`CU_TRIGGER_PSU_WITH_TEXTURE:
|
|
begin
|
|
|
|
`ifdef DEBUG_CU
|
|
$display("%d Control: CU_TRIGGER_PSU_WITH_TEXTURE\n",$time);
|
|
`endif
|
|
|
|
//oRamBusOwner = `REG_BUS_OWNED_BY_UCODE;
|
|
oCodeInstructioPointer = `ENTRYPOINT_INDEX_PSU2;
|
|
oUCodeEnable = 1;
|
|
oGFUEnable = 0;
|
|
oIOWritePixel = 0;
|
|
rResetHitFlop = 1;
|
|
rHitFlopEnable = 0;
|
|
oTriggerTFF = 0;
|
|
oSetCurrentPitch = 0;
|
|
oFlipMemEnabled = 0;//////NEW NEW NEW NEW
|
|
oFlipMem = 0;
|
|
oDone = 0;
|
|
oResultCommited = 0;
|
|
////$display("\n\n %d XOXOXOXOX FLIP XOXOXOXOXOX\n\n",$time);
|
|
//oIncCurrentPitch = 0;
|
|
|
|
NextState = `CU_WAIT_FOR_PSU;
|
|
end
|
|
//-----------------------------------------
|
|
`CU_WAIT_FOR_HOST_DATA_ACK:
|
`CU_WAIT_FOR_HOST_DATA_ACK:
|
begin
|
begin
|
oCodeInstructioPointer = 0;
|
oCodeInstructioPointer = 0;
|
oUCodeEnable = 0;
|
oUCodeEnable = 0;
|
oGFUEnable = 0;
|
oGFUEnable = 0;
|
Line 927... |
Line 632... |
`endif
|
`endif
|
|
|
//oRamBusOwner = `REG_BUS_OWNED_BY_GFU;
|
//oRamBusOwner = `REG_BUS_OWNED_BY_GFU;
|
oCodeInstructioPointer = 0; //*
|
oCodeInstructioPointer = 0; //*
|
oUCodeEnable = 0; //*
|
oUCodeEnable = 0; //*
|
oGFUEnable = 0; //Changed Aug 15
|
oGFUEnable = 0;
|
oIOWritePixel = 0;
|
oIOWritePixel = 0;
|
rResetHitFlop = 0;
|
rResetHitFlop = 0;
|
rHitFlopEnable = 1;
|
rHitFlopEnable = 1;
|
oTriggerTFF = 0;
|
oTriggerTFF = 0;
|
oSetCurrentPitch = 0;
|
oSetCurrentPitch = 0;
|
oFlipMemEnabled = 0;
|
oFlipMemEnabled = 0;
|
oFlipMem = 0;
|
oFlipMem = 0;
|
oDone = 0;
|
oDone = 0;
|
oResultCommited = 0;
|
oResultCommited = 0;
|
//oIncCurrentPitch = 0;
|
|
|
|
// $stop();
|
|
/*
|
|
if ( iUCodeDone == 1'b0 & iSceneTraverseComplete == 1'b1)
|
|
NextState = `CU_CHECK_HIT;
|
|
else if ( iUCodeDone == 1'b0 & iSceneTraverseComplete == 1'b0) //ERROR!!! What if iSceneTraverseComplete will become 1 a cycle after this??
|
|
NextState = `CU_WAIT_FOR_HOST_DATA_ACK;//`CU_WAIT_FOR_HOST_DATA_AVAILABLE;
|
|
else
|
|
NextState = `CU_ACK_MAIN;
|
|
*/
|
|
if (iUCodeDone == 1'b0 && iUCodeReturnValue == 0)
|
if (iUCodeDone == 1'b0 && iUCodeReturnValue == 0)
|
NextState = `CU_WAIT_FOR_HOST_DATA_AVAILABLE;
|
NextState = `CU_WAIT_FOR_HOST_DATA_AVAILABLE;
|
else if (iUCodeDone == 1'b0 && iUCodeReturnValue == 1)
|
else if (iUCodeDone == 1'b0 && iUCodeReturnValue == 1)
|
NextState = `CU_COMMIT_PIXEL_RESULT;
|
NextState = `CU_COMMIT_PIXEL_RESULT;
|
else
|
else
|
Line 976... |
Line 671... |
|
|
|
|
NextState = `CU_WAIT_FOR_HOST_DATA_AVAILABLE;
|
NextState = `CU_WAIT_FOR_HOST_DATA_AVAILABLE;
|
end
|
end
|
//-----------------------------------------
|
//-----------------------------------------
|
|
|
`CU_WAIT_FOR_PSU:
|
|
begin
|
|
|
|
// `ifdef DEBUG_CU
|
|
// $display("%d Control: CU_TRIGGER_PSU\n",$time);
|
|
// `endif
|
|
|
|
//oRamBusOwner = `REG_BUS_OWNED_BY_UCODE;
|
|
oCodeInstructioPointer = `ENTRYPOINT_INDEX_PSU;
|
|
oUCodeEnable = 0;
|
|
oGFUEnable = 0;
|
|
oIOWritePixel = 0;
|
|
rResetHitFlop = 0;
|
|
rHitFlopEnable = 0;
|
|
oTriggerTFF = 0;
|
|
oSetCurrentPitch = 0;
|
|
oFlipMemEnabled = 1;
|
|
oFlipMem = 0;
|
|
oDone = 0;
|
|
oResultCommited = 0;
|
|
//oIncCurrentPitch = 0;
|
|
|
|
|
|
if ( iUCodeDone )
|
|
NextState = `CU_ACK_PSU;
|
|
else
|
|
NextState = `CU_WAIT_FOR_PSU;
|
|
|
|
end
|
|
//-----------------------------------------
|
|
`CU_ACK_PSU:
|
|
begin
|
|
`ifdef DEBUG_CU
|
|
$display("%d CORE: %d Control: CU_ACK_PSU\n",$time, iDebug_CoreID);
|
|
`endif
|
|
|
|
//oRamBusOwner = `REG_BUS_OWNED_BY_UCODE;
|
|
oCodeInstructioPointer = 0; //*
|
|
oUCodeEnable = 0; //*
|
|
oGFUEnable = 0;
|
|
oIOWritePixel = 0;
|
|
rResetHitFlop = 0;
|
|
rHitFlopEnable = 0;
|
|
oTriggerTFF = 0;
|
|
oSetCurrentPitch = 0;
|
|
oFlipMemEnabled = 1;
|
|
oFlipMem = 0;
|
|
oDone = 0;
|
|
oResultCommited = 0;
|
|
//oIncCurrentPitch = 0;
|
|
|
|
if ( iUCodeDone == 0)
|
|
NextState = `CU_TRIGGER_USERPIXELSHADER;
|
|
else
|
|
NextState = `CU_ACK_PSU;
|
|
|
|
|
|
end
|
|
//-----------------------------------------
|
|
|
|
//-----------------------------------------
|
|
`CU_TRIGGER_NPU: //Next Pixel Unit
|
|
begin
|
|
`ifdef DEBUG_CU
|
|
$display("%d CORE: %d Control: CU_TRIGGER_NPU\n",$time, iDebug_CoreID);
|
|
`endif
|
|
//$write("*");
|
|
|
|
//oRamBusOwner = `REG_BUS_OWNED_BY_UCODE;
|
|
oCodeInstructioPointer = `ENTRYPOINT_INDEX_NPG; //*
|
|
oUCodeEnable = 1; //*
|
|
oGFUEnable = 0;
|
|
oIOWritePixel = 0;
|
|
rResetHitFlop = 0;
|
|
rHitFlopEnable = 0;
|
|
oTriggerTFF = 0;
|
|
oSetCurrentPitch = 0;
|
|
oFlipMemEnabled = 1;
|
|
oFlipMem = 0;
|
|
oDone = 0;
|
|
oResultCommited = 0;
|
|
//oIncCurrentPitch = 0;
|
|
|
|
NextState = `CU_WAIT_NPU;
|
|
end
|
|
//-----------------------------------------
|
|
`CU_WAIT_NPU:
|
|
begin
|
|
//oRamBusOwner = `REG_BUS_OWNED_BY_UCODE;
|
|
oCodeInstructioPointer = `ENTRYPOINT_INDEX_NPG;
|
|
oUCodeEnable = 0;
|
|
oGFUEnable = 0;
|
|
oIOWritePixel = 0;
|
|
rResetHitFlop = 0;
|
|
rHitFlopEnable = 0;
|
|
oTriggerTFF = 0;
|
|
oSetCurrentPitch = 0;
|
|
oFlipMemEnabled = 1;
|
|
oFlipMem = 0;
|
|
oDone = 0;
|
|
oResultCommited = 0;
|
|
//oIncCurrentPitch = 0;
|
|
|
|
if ( iUCodeDone )
|
|
NextState = `CU_ACK_NPU;
|
|
else
|
|
NextState = `CU_WAIT_NPU;
|
|
end
|
|
//-----------------------------------------
|
|
/*
|
|
Next Pixel generation: here we either goto
|
|
to RGU for the next pixel, or we have no
|
|
more pixels so we are done we our picture!
|
|
*/
|
|
`CU_ACK_NPU:
|
|
begin
|
|
`ifdef DEBUG_CU
|
|
$display("%d CORE: %d Control: CU_ACK_NPU\n",$time, iDebug_CoreID);
|
|
`endif
|
|
|
|
//oRamBusOwner = `REG_BUS_OWNED_BY_UCODE;
|
|
oCodeInstructioPointer = 0; //*
|
|
oUCodeEnable = 0; //*
|
|
oGFUEnable = 0;
|
|
oIOWritePixel = 0;
|
|
rResetHitFlop = 0;
|
|
rHitFlopEnable = 0;
|
|
oTriggerTFF = 0;
|
|
oSetCurrentPitch = 0;
|
|
oFlipMemEnabled = 1;
|
|
oFlipMem = 0;
|
|
oDone = 0;
|
|
oResultCommited = 0;
|
|
//oIncCurrentPitch = 0;
|
|
|
|
if ( iUCodeDone == 0 && iUCodeReturnValue == 1)
|
|
NextState = `CU_WAIT_FOR_HOST_DATA_AVAILABLE;//`CU_TRIGGER_RGU;
|
|
else if (iUCodeDone == 0 && iUCodeReturnValue == 0)
|
|
NextState = `CU_DONE;
|
|
else
|
|
NextState = `CU_ACK_NPU;
|
|
|
|
|
|
end
|
|
//-----------------------------------------
|
//-----------------------------------------
|
`CU_DONE:
|
`CU_DONE:
|
begin
|
begin
|
//oRamBusOwner = `REG_BUS_OWNED_BY_UCODE;
|
//oRamBusOwner = `REG_BUS_OWNED_BY_UCODE;
|
oCodeInstructioPointer = 0;
|
oCodeInstructioPointer = 0;
|
Line 1143... |
Line 693... |
|
|
|
|
NextState = `CU_DONE;
|
NextState = `CU_DONE;
|
|
|
end
|
end
|
//-----------------------------------------
|
|
/*
|
|
Here we no longer use GFU so set Enable to zero
|
|
*/
|
|
`CU_TRIGGER_USERPIXELSHADER:
|
|
begin
|
|
`ifdef DEBUG_CU
|
|
$display("%d Control: CU_TRIGGER_PSU\n",$time);
|
|
`endif
|
|
|
|
//oRamBusOwner = `REG_BUS_OWNED_BY_UCODE;
|
|
oCodeInstructioPointer = `ENTRYPOINT_INDEX_PIXELSHADER;
|
|
oUCodeEnable = 1;
|
|
oGFUEnable = 0;//*
|
|
oIOWritePixel = 0;
|
|
rResetHitFlop = 0;
|
|
rHitFlopEnable = 0;
|
|
oTriggerTFF = 0;
|
|
oSetCurrentPitch = 0;
|
|
oFlipMemEnabled = 1;
|
|
oFlipMem = 0;
|
|
oDone = 0;
|
|
oResultCommited = 0;
|
|
//oIncCurrentPitch = 0;
|
|
|
|
|
|
NextState = `CU_WAIT_FOR_USERPIXELSHADER;
|
|
end
|
|
//-----------------------------------------
|
|
`CU_WAIT_FOR_USERPIXELSHADER:
|
|
begin
|
|
|
|
// `ifdef DEBUG_CU
|
|
// $display("%d Control: CU_TRIGGER_PSU\n",$time);
|
|
// `endif
|
|
|
|
//oRamBusOwner = `REG_BUS_OWNED_BY_UCODE;
|
|
oCodeInstructioPointer = `ENTRYPOINT_INDEX_PIXELSHADER;
|
|
oUCodeEnable = 0;
|
|
oGFUEnable = 0;
|
|
oIOWritePixel = 0;
|
|
rResetHitFlop = 0;
|
|
rHitFlopEnable = 0;
|
|
oTriggerTFF = 0;
|
|
oSetCurrentPitch = 0;
|
|
oFlipMemEnabled = 1;
|
|
oFlipMem = 0;
|
|
oDone = 0;
|
|
oResultCommited = 0;
|
|
//oIncCurrentPitch = 0;
|
|
|
|
|
|
if ( iUCodeDone )
|
|
NextState = `CU_ACK_USERPIXELSHADER;
|
|
else
|
|
NextState = `CU_WAIT_FOR_USERPIXELSHADER;
|
|
|
|
end
|
|
//-----------------------------------------
|
|
`CU_ACK_USERPIXELSHADER:
|
|
begin
|
|
`ifdef DEBUG_CU
|
|
$display("%d Control: CU_ACK_PSU\n",$time);
|
|
`endif
|
|
|
|
//oRamBusOwner = `REG_BUS_OWNED_BY_UCODE;
|
|
oCodeInstructioPointer = 0; //*
|
|
oUCodeEnable = 0; //*
|
|
oGFUEnable = 0;
|
|
oIOWritePixel = 0;
|
|
rResetHitFlop = 0;
|
|
rHitFlopEnable = 0;
|
|
oTriggerTFF = 0;
|
|
oSetCurrentPitch = 0;
|
|
oFlipMemEnabled = 1;
|
|
oFlipMem = 0;
|
|
oDone = 0;
|
|
oResultCommited = 1;
|
|
//oIncCurrentPitch = 0;
|
|
|
|
if ( iUCodeDone == 0)
|
|
NextState = `CU_TRIGGER_NPU;//`CU_TRIGGER_PCU;
|
|
else
|
|
NextState = `CU_ACK_USERPIXELSHADER;
|
|
|
|
|
|
end
|
|
//---------------------------------------------------
|
//---------------------------------------------------
|
default:
|
default:
|
begin
|
begin
|
|
|
`ifdef DEBUG_CU
|
`ifdef DEBUG_CU
|