Line 81... |
Line 81... |
//Alias this signals
|
//Alias this signals
|
wire Clock,Reset;
|
wire Clock,Reset;
|
assign Clock = CLK_I;
|
assign Clock = CLK_I;
|
assign Reset = RST_I;
|
assign Reset = RST_I;
|
|
|
wire [`DATA_ROW_WIDTH-1:0] w2MEM_WriteData;
|
wire [`DATA_ROW_WIDTH-1:0] wEXE_2__MEM_WriteData;
|
wire [`DATA_ROW_WIDTH-1:0] wUCODE_RAMBus;
|
wire [`DATA_ROW_WIDTH-1:0] wUCODE_RAMBus;
|
wire [`DATA_ADDRESS_WIDTH-1:0] wDataWriteAddress;
|
wire [`DATA_ADDRESS_WIDTH-1:0] wEXE_2__MEM_wDataWriteAddress;
|
wire w2IO__AddrIsImm;
|
wire w2IO__AddrIsImm;
|
wire [`DATA_ADDRESS_WIDTH-1:0] wUCODE_RAMAddress;
|
wire [`DATA_ADDRESS_WIDTH-1:0] wUCODE_RAMAddress;
|
wire [`DATA_ADDRESS_WIDTH-1:0] w2IO__Adr_O_Pointer;
|
wire [`DATA_ADDRESS_WIDTH-1:0] w2IO__Adr_O_Pointer;
|
wire [`DATA_ADDRESS_WIDTH-1:0] wGEO2_IO__Adr_O_Pointer;
|
wire [`DATA_ADDRESS_WIDTH-1:0] wGEO2_IO__Adr_O_Pointer;
|
wire DataWriteEnable;
|
wire wEXE_2__DataWriteEnable;
|
wire wUCODE_RAMWriteEnable;
|
wire wUCODE_RAMWriteEnable;
|
wire [2:0] RamBusOwner;
|
wire [2:0] RamBusOwner;
|
//Unit intercoanection wires
|
//Unit intercoanection wires
|
|
|
wire wCU2__MicrocodeExecutionDone;
|
wire wCU2__MicrocodeExecutionDone;
|
wire [`ROM_ADDRESS_WIDTH-1:0] InitialCodeAddress;
|
wire [`ROM_ADDRESS_WIDTH-1:0] InitialCodeAddress;
|
wire [`ROM_ADDRESS_WIDTH-1:0] wInstructionPointer1,wInstructionPointer2;
|
wire [`ROM_ADDRESS_WIDTH-1:0] wInstructionPointer1,wInstructionPointer2;
|
wire [`INSTRUCTION_WIDTH-1:0] wEncodedInstruction1,wEncodedInstruction2,wIO2_MEM__ExternalInstruction;
|
wire [`INSTRUCTION_WIDTH-1:0] wEncodedInstruction1,wEncodedInstruction2,wIO2_MEM__ExternalInstruction;
|
wire wCU2__ExecuteMicroCode;
|
wire wCU2__ExecuteMicroCode;
|
wire [`ROM_ADDRESS_WIDTH-1:0] wIO2_MEM__InstructionWriteAddr;
|
wire [`ROM_ADDRESS_WIDTH-1:0] wIO2_MEM__InstructionWriteAddr;
|
wire [95:0] wDataRead0, wDataRead1;
|
wire [95:0] wMEM_2__EXE_DataRead0, wMEM_2__EXE_DataRead1,wMEM_2__IO_DataRead0, wMEM_2__IO_DataRead1;
|
wire [`DATA_ADDRESS_WIDTH-1:0] wDataReadAddress0,wDataReadAddress1;
|
wire [`DATA_ADDRESS_WIDTH-1:0] wEXE_2__MEM_DataReadAddress0,wEXE_2__MEM_DataReadAddress1;
|
wire [`DATA_ADDRESS_WIDTH-1:0] wUCODE_RAMReadAddress0,wUCODE_RAMReadAddress1;
|
wire [`DATA_ADDRESS_WIDTH-1:0] wUCODE_RAMReadAddress0,wUCODE_RAMReadAddress1;
|
|
|
|
|
wire [`WIDTH-1:0] w2IO__AddressOffset;
|
wire [`WIDTH-1:0] w2IO__AddressOffset;
|
wire [`DATA_ADDRESS_WIDTH-1:0] w2IO__DataWriteAddress;
|
wire [`DATA_ADDRESS_WIDTH-1:0] w2IO__DataWriteAddress;
|
wire w2IO__Store;
|
wire w2IO__Store;
|
wire w2IO__EnableWBMaster;
|
wire w2IO__EnableWBMaster;
|
|
|
wire [`DATA_ADDRESS_WIDTH-1:0] wIO2_BUSMUX__DataWriteAddress;
|
wire [`DATA_ADDRESS_WIDTH-1:0] wIO2_MEM__DataWriteAddress;
|
wire [`DATA_ADDRESS_WIDTH-1:0] wIO_2_MEM__DataReadAddress0;
|
wire [`DATA_ADDRESS_WIDTH-1:0] wIO_2_MEM__DataReadAddress0;
|
wire [`DATA_ROW_WIDTH-1:0] wIO2_BUSMUX__Bus;
|
wire [`DATA_ROW_WIDTH-1:0] wIO2_MEM__Bus;
|
wire [`WIDTH-1:0] wIO2__Data;
|
wire [`WIDTH-1:0] wIO2_MEM__Data;
|
wire [`WIDTH-1:0] wIO2_WBM__Address;
|
wire [`WIDTH-1:0] wIO2_WBM__Address;
|
wire wIO2_BUSMUX__DataWriteEnable;
|
wire wIO2_MEM__DataWriteEnable;
|
wire wIO2__Done;
|
wire wIO2__Done;
|
wire wCU2_GEO__GeometryFetchEnable;
|
wire wCU2_GEO__GeometryFetchEnable;
|
wire wIFU2__MicroCodeReturnValue;
|
wire wIFU2__MicroCodeReturnValue;
|
wire wCU2_BCU__ACK;
|
wire wCU2_BCU__ACK;
|
wire wGEO2_CU__RequestAABBIU;
|
wire wGEO2_CU__RequestAABBIU;
|
Line 144... |
Line 144... |
wire[31:0] wGEO2_IO__AddressOffset;
|
wire[31:0] wGEO2_IO__AddressOffset;
|
wire wGEO2_IO__EnableWBMaster;
|
wire wGEO2_IO__EnableWBMaster;
|
wire wGEO2_IO__SetAddress;
|
wire wGEO2_IO__SetAddress;
|
wire[`WIDTH-1:0] wGEO2__CurrentPitch,wCU2_GEO_Pitch;
|
wire[`WIDTH-1:0] wGEO2__CurrentPitch,wCU2_GEO_Pitch;
|
wire wCU2_GEO__SetPitch,wCU2_GEO__IncPicth;
|
wire wCU2_GEO__SetPitch,wCU2_GEO__IncPicth;
|
|
wire wCU2_FlipMemEnabled;
|
|
wire w2MEM_FlipMemory;
|
|
|
`ifdef DEBUG
|
`ifdef DEBUG
|
wire [`ROM_ADDRESS_WIDTH-1:0] wDEBUG_IDU2_EXE_InstructionPointer;
|
wire [`ROM_ADDRESS_WIDTH-1:0] wDEBUG_IDU2_EXE_InstructionPointer;
|
`endif
|
`endif
|
//--------------------------------------------------------
|
//--------------------------------------------------------
|
|
|
|
|
|
/*
|
|
///////////////// TODO CHANGE FOR MUXES ////////////////////////////////
|
|
assign wEXE_2__MEM_WriteData = ( RamBusOwner == `REG_BUS_OWNED_BY_UCODE ) ?
|
|
wUCODE_RAMBus : `DATA_ROW_WIDTH'bz;
|
|
|
///////////////// TODO CHANGE FOR MUXES ////////////////////////////////
|
assign wEXE_2__MEM_WriteData = ( RamBusOwner == `REG_BUS_OWNED_BY_GFU || MST_I == 1'b1) ?
|
assign w2MEM_WriteData = ( RamBusOwner == `REG_BUS_OWNED_BY_UCODE ) ?
|
wIO2_MEM__Bus : `DATA_ROW_WIDTH'bz;
|
wUCODE_RAMBus : `DATA_ROW_WIDTH'bz;
|
|
|
|
assign w2MEM_WriteData = ( RamBusOwner == `REG_BUS_OWNED_BY_GFU || MST_I == 1'b1) ?
|
assign wEXE_2__MEM_wDataWriteAddress = ( RamBusOwner == `REG_BUS_OWNED_BY_UCODE ) ?
|
wIO2_BUSMUX__Bus : `DATA_ROW_WIDTH'bz;
|
wUCODE_RAMAddress : `DATA_ADDRESS_WIDTH'bz;
|
|
|
assign wDataWriteAddress = ( RamBusOwner == `REG_BUS_OWNED_BY_UCODE ) ?
|
assign wEXE_2__MEM_wDataWriteAddress = ( RamBusOwner == `REG_BUS_OWNED_BY_GFU || MST_I == 1'b1) ?
|
wUCODE_RAMAddress : `DATA_ADDRESS_WIDTH'bz;
|
wIO2_MEM__DataWriteAddress : `DATA_ADDRESS_WIDTH'bz;
|
|
|
assign wDataWriteAddress = ( RamBusOwner == `REG_BUS_OWNED_BY_GFU || MST_I == 1'b1) ?
|
|
wIO2_BUSMUX__DataWriteAddress : `DATA_ADDRESS_WIDTH'bz;
|
|
|
|
|
|
MUXFULLPARALELL_2SEL_GENERIC # ( `DATA_ADDRESS_WIDTH ) MUX_RA0
|
|
(
|
|
.Sel(RamBusOwner[1:0]),
|
|
.I1(`DATA_ADDRESS_WIDTH'b0),
|
|
.I2(wIO_2_MEM__DataReadAddress0),
|
|
.I3(wUCODE_RAMReadAddress0),
|
|
.O1(wDataReadAddress0)
|
|
);
|
|
|
|
|
MUXFULLPARALELL_2SEL_GENERIC # ( `DATA_ADDRESS_WIDTH ) MUX_RA0
|
|
(
|
|
.Sel(RamBusOwner[1:0]),
|
|
.I1(`DATA_ADDRESS_WIDTH'b0),
|
|
.I2(wIO_2_MEM__DataReadAddress0),
|
|
.I3(wUCODE_RAMReadAddress0),
|
|
.O1(wEXE_2__MEM_DataReadAddress0)
|
|
);
|
|
|
|
|
|
|
|
|
|
|
assign DataWriteEnable = ( RamBusOwner == `REG_BUS_OWNED_BY_UCODE && MST_I == 1'b0) ?
|
|
wUCODE_RAMWriteEnable : 1'bz;
|
|
|
|
assign DataWriteEnable = ( RamBusOwner == `REG_BUS_OWNED_BY_GFU || MST_I == 1'b1) ?
|
assign wEXE_2__DataWriteEnable = ( RamBusOwner == `REG_BUS_OWNED_BY_UCODE && MST_I == 1'b0) ?
|
wIO2_BUSMUX__DataWriteEnable : 1'bz;
|
wUCODE_RAMWriteEnable : 1'bz;
|
|
|
|
assign wEXE_2__DataWriteEnable = ( RamBusOwner == `REG_BUS_OWNED_BY_GFU || MST_I == 1'b1) ?
|
|
wIO2_MEM__DataWriteEnable : 1'bz;
|
|
*/
|
assign wCR2_TextureMappingEnabled = wCR2_ControlRegister[ `CR_EN_TEXTURE ];
|
assign wCR2_TextureMappingEnabled = wCR2_ControlRegister[ `CR_EN_TEXTURE ];
|
|
wire wCU2_FlipMem;
|
//--------------------------------------------------------
|
//--------------------------------------------------------
|
//Control Unit Instance
|
//Control Unit Instance
|
ControlUnit CU
|
ControlUnit CU
|
(
|
(
|
.Clock(Clock),
|
.Clock(Clock),
|
.Reset(Reset),
|
.Reset(Reset),
|
|
.oFlipMemEnabled( wCU2_FlipMemEnabled ),
|
|
.oFlipMem( wCU2_FlipMem ),
|
.iControlRegister( wCR2_ControlRegister ),
|
.iControlRegister( wCR2_ControlRegister ),
|
.oRamBusOwner( RamBusOwner ),
|
.oRamBusOwner( RamBusOwner ),
|
.oGFUEnable( wCU2_GEO__GeometryFetchEnable ),
|
.oGFUEnable( wCU2_GEO__GeometryFetchEnable ),
|
.iTriggerAABBIURequest( wGEO2_CU__RequestAABBIU ),
|
.iTriggerAABBIURequest( wGEO2_CU__RequestAABBIU ),
|
.iTriggerBIURequest( wGEO2_CU__RequestBIU ),
|
.iTriggerBIURequest( wGEO2_CU__RequestBIU ),
|
Line 217... |
Line 221... |
|
|
);
|
);
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------
|
//--------------------------------------------------------
|
|
|
|
//assign w2MEM_FlipMemory = (wCU2__ExecuteMicroCode | wCU2_FlipMem ) & wCU2_FlipMemEnabled;
|
|
assign w2MEM_FlipMemory = wCU2_FlipMem & wCU2_FlipMemEnabled;
|
MemoryUnit MEM
|
MemoryUnit MEM
|
(
|
(
|
.Clock(Clock),
|
.Clock(Clock),
|
.Reset(Reset),
|
.Reset(Reset),
|
//Data Bus
|
|
.iDataReadAddress1( wDataReadAddress0 ),
|
.iFlipMemory( w2MEM_FlipMemory ),
|
.iDataReadAddress2( wDataReadAddress1 ),
|
|
.oData1( wDataRead0 ),
|
//Data Bus to/from EXE
|
.oData2( wDataRead1 ),
|
.iDataReadAddress1_EXE( wEXE_2__MEM_DataReadAddress0 ),
|
.iDataWriteEnable( DataWriteEnable ),
|
.iDataReadAddress2_EXE( wEXE_2__MEM_DataReadAddress1 ),
|
.iDataWriteAddress( wDataWriteAddress ),
|
.oData1_EXE( wMEM_2__EXE_DataRead0 ),
|
.iData( w2MEM_WriteData ),
|
.oData2_EXE( wMEM_2__EXE_DataRead1 ),
|
|
.iDataWriteEnable_EXE( wEXE_2__DataWriteEnable ),
|
|
.iDataWriteAddress_EXE( wEXE_2__MEM_wDataWriteAddress ),
|
|
.iData_EXE( wEXE_2__MEM_WriteData ),
|
|
|
|
//Data Bus to/from IO
|
|
|
|
.iDataReadAddress1_IO( wIO_2_MEM__DataReadAddress0 ),
|
|
.iDataReadAddress2_IO( wIO_2_MEM__DataReadAddress1 ),
|
|
.oData1_IO( wMEM_2__IO_DataRead0 ),
|
|
.oData2_IO( wMEM_2__IO_DataRead1 ),
|
|
.iDataWriteEnable_IO( wIO2_MEM__DataWriteEnable ),
|
|
.iDataWriteAddress_IO( wIO2_MEM__DataWriteAddress ),
|
|
.iData_IO( wIO2_MEM__Bus ),
|
|
|
|
|
//Instruction Bus
|
//Instruction Bus
|
.iInstructionReadAddress1( wInstructionPointer1 ),
|
.iInstructionReadAddress1( wInstructionPointer1 ),
|
.iInstructionReadAddress2( wInstructionPointer2 ),
|
.iInstructionReadAddress2( wInstructionPointer2 ),
|
.oInstruction1( wEncodedInstruction1 ),
|
.oInstruction1( wEncodedInstruction1 ),
|
.oInstruction2( wEncodedInstruction2 ),
|
.oInstruction2( wEncodedInstruction2 ),
|
Line 244... |
Line 267... |
.oControlRegister( wCR2_ControlRegister )
|
.oControlRegister( wCR2_ControlRegister )
|
|
|
);
|
);
|
|
|
////--------------------------------------------------------
|
////--------------------------------------------------------
|
|
|
|
|
ExecutionUnit EXE
|
ExecutionUnit EXE
|
(
|
(
|
|
|
.Clock( Clock),
|
.Clock( Clock),
|
.Reset( Reset ),
|
.Reset( Reset ),
|
.iInitialCodeAddress( InitialCodeAddress ),
|
.iInitialCodeAddress( InitialCodeAddress ),
|
.iInstruction1( wEncodedInstruction1 ),
|
.iInstruction1( wEncodedInstruction1 ),
|
.iInstruction2( wEncodedInstruction2 ),
|
.iInstruction2( wEncodedInstruction2 ),
|
.oInstructionPointer1( wInstructionPointer1 ),
|
.oInstructionPointer1( wInstructionPointer1 ),
|
.oInstructionPointer2( wInstructionPointer2 ),
|
.oInstructionPointer2( wInstructionPointer2 ),
|
.iDataRead0( wDataRead0 ),
|
.iDataRead0( wMEM_2__EXE_DataRead0 ),
|
.iDataRead1( wDataRead1 ),
|
.iDataRead1( wMEM_2__EXE_DataRead1 ),
|
.iTrigger( wCU2__ExecuteMicroCode ),
|
.iTrigger( wCU2__ExecuteMicroCode ),
|
.oDataReadAddress0( wUCODE_RAMReadAddress0 ),
|
.oDataReadAddress0( wEXE_2__MEM_DataReadAddress0 ),
|
.oDataReadAddress1( wUCODE_RAMReadAddress1 ),
|
.oDataReadAddress1( wEXE_2__MEM_DataReadAddress1 ),
|
.oDataWriteEnable( wUCODE_RAMWriteEnable ),
|
.oDataWriteEnable( wEXE_2__DataWriteEnable ),
|
.oDataWriteAddress( wUCODE_RAMAddress ),
|
.oDataWriteAddress( wEXE_2__MEM_wDataWriteAddress ),
|
.oDataBus( wUCODE_RAMBus ),
|
.oDataBus( wEXE_2__MEM_WriteData ),
|
.oReturnCode( wIFU2__MicroCodeReturnValue ),
|
.oReturnCode( wIFU2__MicroCodeReturnValue ),
|
.oDone( wCU2__MicrocodeExecutionDone )
|
.oDone( wCU2__MicrocodeExecutionDone )
|
|
|
);
|
);
|
|
|
Line 278... |
Line 303... |
.Clock( Clock ),
|
.Clock( Clock ),
|
.Reset( Reset ),
|
.Reset( Reset ),
|
.iEnable( wCU2_GEO__GeometryFetchEnable ),
|
.iEnable( wCU2_GEO__GeometryFetchEnable ),
|
.iTexturingEnable( wCR2_TextureMappingEnabled ),
|
.iTexturingEnable( wCR2_TextureMappingEnabled ),
|
//Wires from IO
|
//Wires from IO
|
.iData_WBM( wIO2__Data ),
|
.iData_WBM( wIO2_MEM__Data ),
|
.iDataReady_WBM( wIO2__Done ),
|
.iDataReady_WBM( wIO2__Done ),
|
//Wires to WBM
|
//Wires to WBM
|
.oAddressWBM_Imm( wGEO2_IO__AddressOffset ),
|
.oAddressWBM_Imm( wGEO2_IO__AddressOffset ),
|
.oAddressWBM_fromMEM( wGEO2_IO__Adr_O_Pointer ),
|
.oAddressWBM_fromMEM( wGEO2_IO__Adr_O_Pointer ),
|
.oAddressWBM_IsImm( wGEO2_IO__AddrIsImm ),
|
.oAddressWBM_IsImm( wGEO2_IO__AddrIsImm ),
|
Line 308... |
Line 333... |
);
|
);
|
|
|
|
|
assign TGA_O = (wGEO2__RequestingTextures) ? 2'b1: 2'b0;
|
assign TGA_O = (wGEO2__RequestingTextures) ? 2'b1: 2'b0;
|
//---------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------
|
wire[`DATA_ADDRESS_WIDTH-1:0] wIO2__DataReadAddress1;
|
wire[`DATA_ADDRESS_WIDTH-1:0] wIO_2_MEM__DataReadAddress1;
|
assign wDataReadAddress1 = (wCU2_IO__WritePixel == 0) ? wUCODE_RAMReadAddress1 : wIO2__DataReadAddress1;
|
assign wEXE_2__MEM_DataReadAddress1 = (wCU2_IO__WritePixel == 0) ? wUCODE_RAMReadAddress1 : wIO_2_MEM__DataReadAddress1;
|
assign w2IO__EnableWBMaster = (wCU2_IO__WritePixel == 0 ) ? wGEO2_IO__EnableWBMaster : wCU2_IO__WritePixel;
|
assign w2IO__EnableWBMaster = (wCU2_IO__WritePixel == 0 ) ? wGEO2_IO__EnableWBMaster : wCU2_IO__WritePixel;
|
assign w2IO__AddrIsImm = (wCU2_IO__WritePixel == 0 ) ? wGEO2_IO__AddrIsImm : 1'b1;
|
assign w2IO__AddrIsImm = (wCU2_IO__WritePixel == 0 ) ? wGEO2_IO__AddrIsImm : 1'b1;
|
assign w2IO__AddressOffset = (wCU2_IO__WritePixel == 0 ) ? wGEO2_IO__AddressOffset : 32'b0;
|
assign w2IO__AddressOffset = (wCU2_IO__WritePixel == 0 ) ? wGEO2_IO__AddressOffset : 32'b0;
|
assign w2IO__Adr_O_Pointer = (wCU2_IO__WritePixel == 0 ) ? wGEO2_IO__Adr_O_Pointer : `OREG_PIXEL_PITCH;
|
assign w2IO__Adr_O_Pointer = (wCU2_IO__WritePixel == 0 ) ? wGEO2_IO__Adr_O_Pointer : `OREG_PIXEL_PITCH;
|
wire w2IO_MasterCycleType;
|
wire w2IO_MasterCycleType;
|
Line 335... |
Line 360... |
.iAdr_DataWriteBack( w2IO__DataWriteAddress ),
|
.iAdr_DataWriteBack( w2IO__DataWriteAddress ),
|
.iAdr_O_Set( w2IO__SetAddress ),
|
.iAdr_O_Set( w2IO__SetAddress ),
|
.iAdr_O_Imm( w2IO__AddressOffset ),
|
.iAdr_O_Imm( w2IO__AddressOffset ),
|
.iAdr_O_Type( w2IO__AddrIsImm ),
|
.iAdr_O_Type( w2IO__AddrIsImm ),
|
.iAdr_O_Pointer( w2IO__Adr_O_Pointer ),
|
.iAdr_O_Pointer( w2IO__Adr_O_Pointer ),
|
.iReadDataBus( wDataRead0 ),
|
.iReadDataBus( wMEM_2__IO_DataRead0 ),
|
.iReadDataBus2( wDataRead1 ),
|
.iReadDataBus2( wMEM_2__IO_DataRead1 ),
|
.iDat_O_Pointer( `OREG_PIXEL_COLOR ),
|
.iDat_O_Pointer( `OREG_PIXEL_COLOR ),
|
|
|
|
|
.oDataReadAddress( wIO_2_MEM__DataReadAddress0 ),
|
.oDataReadAddress( wIO_2_MEM__DataReadAddress0 ),
|
.oDataReadAddress2( wIO2__DataReadAddress1 ),
|
.oDataReadAddress2( wIO_2_MEM__DataReadAddress1 ),
|
.oDataWriteAddress( wIO2_BUSMUX__DataWriteAddress ),
|
.oDataWriteAddress( wIO2_MEM__DataWriteAddress ),
|
.oDataBus( wIO2_BUSMUX__Bus ),
|
.oDataBus( wIO2_MEM__Bus ),
|
.oInstructionBus( wIO2_MEM__ExternalInstruction ),
|
.oInstructionBus( wIO2_MEM__ExternalInstruction ),
|
|
|
.oDataWriteEnable( wIO2_BUSMUX__DataWriteEnable ),
|
.oDataWriteEnable( wIO2_MEM__DataWriteEnable ),
|
.oData( wIO2__Data ),
|
.oData( wIO2_MEM__Data ),
|
.oInstructionWriteEnable( wIO2_MEM_InstructionWriteEnable ),
|
.oInstructionWriteEnable( wIO2_MEM_InstructionWriteEnable ),
|
.oInstructionWriteAddress( wIO2_MEM__InstructionWriteAddr ),
|
.oInstructionWriteAddress( wIO2_MEM__InstructionWriteAddr ),
|
.iWriteBack_Set( w2IO_WriteBack_Set ),
|
.iWriteBack_Set( w2IO_WriteBack_Set ),
|
|
|
.oDone( wIO2__Done ),
|
.oDone( wIO2__Done ),
|