OpenCores
URL https://opencores.org/ocsvn/theia_gpu/theia_gpu/trunk

Subversion Repositories theia_gpu

[/] [theia_gpu/] [branches/] [beta_1.2/] [rtl/] [TOP/] [Theia_Core.v] - Diff between revs 82 and 87

Only display areas with differences | Details | Blame | View Log

Rev 82 Rev 87
/**********************************************************************************
/**********************************************************************************
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.
 
 
***********************************************************************************/
***********************************************************************************/
 
 
/**********************************************************************************
/**********************************************************************************
Description:
Description:
 This is the top level block for THEIA.
 This is the top level block for THEIA.
 THEIA core has 5 main logical blocks called Units.
 THEIA core has 5 main logical blocks called Units.
 This module implements the interconections between the Units.
 This module implements the interconections between the Units.
 
 
 Units:
 Units:
  > EXE: Mananges execution logic for the SHADERS.
  > EXE: Mananges execution logic for the SHADERS.
  > GEO: Manages geometry data structures.
  > GEO: Manages geometry data structures.
  > IO: Input/Output (Wishbone).
  > IO: Input/Output (Wishbone).
  > MEM: Internal memory, separate for Instructions and data.
  > MEM: Internal memory, separate for Instructions and data.
  > CONTROL: Main control Finite state machine.
  > CONTROL: Main control Finite state machine.
 
 
 Internal Buses:
 Internal Buses:
        THEIA has separate instruction and data buses.
        THEIA has separate instruction and data buses.
        THEIA avoids using tri-state buses by having separate input/output
        THEIA avoids using tri-state buses by having separate input/output
        for each bus.
        for each bus.
        There are 2 separate data buses since the Data memory
        There are 2 separate data buses since the Data memory
        has a Dual read channel.
        has a Dual read channel.
   Please see the MEM unit chapter in the documentation for more details.
   Please see the MEM unit chapter in the documentation for more details.
 
 
 External Buses:
 External Buses:
        External buses are managed by the IO Unit.
        External buses are managed by the IO Unit.
        External buses follow the wishbone protocol.
        External buses follow the wishbone protocol.
        Please see the IO unit chapter in the documentation for more details.
        Please see the IO unit chapter in the documentation for more details.
**********************************************************************************/
**********************************************************************************/
 
 
`timescale 1ns / 1ps
`timescale 1ns / 1ps
`include "aDefinitions.v"
`include "aDefinitions.v"
 
 
module THEIACORE
module THEIACORE
(
(
 
 
input wire                    CLK_I,    //Input clock
input wire                    CLK_I,    //Input clock
input wire                    RST_I,    //Input reset
input wire                    RST_I,    //Input reset
//Theia Interfaces
//Theia Interfaces
input wire                    MST_I,    //Master signal, THEIA enters configuration mode
input wire                    MST_I,    //Master signal, THEIA enters configuration mode
                                       //when this gets asserted (see documentation)
                                       //when this gets asserted (see documentation)
//Wish Bone Interface
//Wish Bone Interface
input wire [`WB_WIDTH-1:0]    DAT_I,     //Input data bus  (Wishbone)
input wire [`WB_WIDTH-1:0]    DAT_I,     //Input data bus  (Wishbone)
output wire [`WB_WIDTH-1:0]   DAT_O,     //Output data bus (Wishbone)
output wire [`WB_WIDTH-1:0]   DAT_O,     //Output data bus (Wishbone)
input wire                    ACK_I,    //Input ack
input wire                    ACK_I,    //Input ack
output wire                   ACK_O,    //Output ack
output wire                   ACK_O,    //Output ack
output wire [`WB_WIDTH-1:0]   ADR_O,     //Output address
output wire [`WB_WIDTH-1:0]   ADR_O,     //Output address
input wire [`WB_WIDTH-1:0]    ADR_I,     //Input address
input wire [`WB_WIDTH-1:0]    ADR_I,     //Input address
output wire                   WE_O,             //Output write enable
output wire                   WE_O,             //Output write enable
input wire                    WE_I,    //Input write enable
input wire                    WE_I,    //Input write enable
output wire                   STB_O,    //Strobe signal, see wishbone documentation
output wire                   STB_O,    //Strobe signal, see wishbone documentation
input wire                    STB_I,    //Strobe signal, see wishbone documentation
input wire                    STB_I,    //Strobe signal, see wishbone documentation
output wire                   CYC_O,    //Bus cycle signal, see wishbone documentation
output wire                   CYC_O,    //Bus cycle signal, see wishbone documentation
input wire                    CYC_I,   //Bus cycle signal, see wishbone documentation
input wire                    CYC_I,   //Bus cycle signal, see wishbone documentation
output wire     [1:0]             TGC_O,   //Bus cycle tag, see THEAI documentation
output wire     [1:0]             TGC_O,   //Bus cycle tag, see THEAI documentation
input wire [1:0]              TGA_I,   //Input address tag, see THEAI documentation
input wire [1:0]              TGA_I,   //Input address tag, see THEAI documentation
output wire [1:0]             TGA_O,   //Output address tag, see THEAI documentation
output wire [1:0]             TGA_O,   //Output address tag, see THEAI documentation
input wire      [1:0]             TGC_I,   //Bus cycle tag, see THEAI documentation
input wire      [1:0]             TGC_I,   //Bus cycle tag, see THEAI documentation
input wire                    GNT_I,   //Bus arbiter 'Granted' signal, see THEAI documentation
input wire                    GNT_I,   //Bus arbiter 'Granted' signal, see THEAI documentation
input wire                    RENDREN_I,
input wire                    RENDREN_I,
 
 
`ifdef DEBUG
`ifdef DEBUG
input wire[`MAX_CORES-1:0]    iDebug_CoreID,
input wire[`MAX_CORES-1:0]    iDebug_CoreID,
`endif
`endif
//Control Register
//Control Register
input wire [15:0]                         CREG_I,
input wire [15:0]                         CREG_I,
output wire                   DONE_O
output wire                   DONE_O
 
 
 
 
);
);
 
 
//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                              wIO_Busy;
wire                              wIO_Busy;
wire [`DATA_ROW_WIDTH-1:0]                        wEXE_2__MEM_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]    wEXE_2__MEM_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                                                                             wEXE_2__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]                                                      wMEM_2__EXE_DataRead0, wMEM_2__EXE_DataRead1,wMEM_2__IO_DataRead0, wMEM_2__IO_DataRead1;
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]   wEXE_2__MEM_DataReadAddress0,wEXE_2__MEM_DataReadAddress1;
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_MEM__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_MEM__Bus;
wire [`DATA_ROW_WIDTH-1:0]               wIO2_MEM__Bus;
wire [`WIDTH-1:0]                                        wIO2_MEM__Data;
wire [`WIDTH-1:0]                                        wIO2_MEM__Data;
wire [`WIDTH-1:0]                                        wIO2_WBM__Address;
wire [`WIDTH-1:0]                                        wIO2_WBM__Address;
wire                                                                            wIO2_MEM__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;
wire                                                                            wGEO2_CU__RequestBIU;
wire                                                                            wGEO2_CU__RequestBIU;
wire                             wGEO2_CU__RequestTCC;
wire                             wGEO2_CU__RequestTCC;
wire                                                                            wGEO2_CU__GeometryUnitDone;
wire                                                                            wGEO2_CU__GeometryUnitDone;
wire                                                                            wGEO2_CU__Sync;
wire                                                                            wGEO2_CU__Sync;
wire                                                                            wEXE2__uCodeDone;
wire                                                                            wEXE2__uCodeDone;
wire                                                                            wEXE2_IFU__EXEBusy;
wire                                                                            wEXE2_IFU__EXEBusy;
wire [`DATA_ADDRESS_WIDTH-1:0]   wEXE2_IDU_DataFordward_LastDestination;
wire [`DATA_ADDRESS_WIDTH-1:0]   wEXE2_IDU_DataFordward_LastDestination;
wire                                                                            wALU2_EXE__BranchTaken;
wire                                                                            wALU2_EXE__BranchTaken;
wire                                                                            wALU2_IFU_BranchNotTaken;
wire                                                                            wALU2_IFU_BranchNotTaken;
wire                                                                            w2IO__SetAddress;
wire                                                                            w2IO__SetAddress;
wire                                                                            wIDU2_IFU__IDUBusy;
wire                                                                            wIDU2_IFU__IDUBusy;
//Control Registe wires
//Control Registe wires
wire[15:0]                                                               wCR2_ControlRegister;
wire[15:0]                                                               wCR2_ControlRegister;
wire                                                                            wCR2_TextureMappingEnabled;
wire                                                                            wCR2_TextureMappingEnabled;
wire                             wGEO2_CU__TFFDone;
wire                             wGEO2_CU__TFFDone;
wire                             wCU2_GEO__TriggerTFF;
wire                             wCU2_GEO__TriggerTFF;
wire                             wIO2_MEM_InstructionWriteEnable;
wire                             wIO2_MEM_InstructionWriteEnable;
wire                             wCU2_IO__WritePixel;
wire                             wCU2_IO__WritePixel;
wire                             wGEO2_IO__AddrIsImm;
wire                             wGEO2_IO__AddrIsImm;
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 wCU2_FlipMemEnabled;
wire w2MEM_FlipMemory;
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
//--------------------------------------------------------
//--------------------------------------------------------
 
 
 
 
assign wCR2_TextureMappingEnabled = wCR2_ControlRegister[ `CR_EN_TEXTURE ];
assign wCR2_TextureMappingEnabled = wCR2_ControlRegister[ `CR_EN_TEXTURE ];
wire wCU2_FlipMem;
wire wCU2_FlipMem;
//--------------------------------------------------------
//--------------------------------------------------------
//Control Unit Instance
//Control Unit Instance
        ControlUnit CU
        ControlUnit CU
        (
        (
           .Clock(Clock),
           .Clock(Clock),
                .Reset(Reset),
                .Reset(Reset),
                .oFlipMemEnabled(                   wCU2_FlipMemEnabled            ),
                .oFlipMemEnabled(                   wCU2_FlipMemEnabled            ),
                .oFlipMem(                          wCU2_FlipMem                   ),
                .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           ),
                .iTriggertTCCRequest(               wGEO2_CU__RequestTCC           ),
                .iTriggertTCCRequest(               wGEO2_CU__RequestTCC           ),
                .oUCodeEnable(                      wCU2__ExecuteMicroCode         ),
                .oUCodeEnable(                      wCU2__ExecuteMicroCode         ),
                .oCodeInstructioPointer(           InitialCodeAddress             ),
                .oCodeInstructioPointer(           InitialCodeAddress             ),
                .iUCodeDone(                        wCU2__MicrocodeExecutionDone   ),
                .iUCodeDone(                        wCU2__MicrocodeExecutionDone   ),
                .iIODone(                           wIO2__Done                     ),
                .iIODone(                           wIO2__Done                     ),
                .oIOWritePixel(                     wCU2_IO__WritePixel            ),
                .oIOWritePixel(                     wCU2_IO__WritePixel            ),
                .iUCodeReturnValue(                 wIFU2__MicroCodeReturnValue    ),
                .iUCodeReturnValue(                 wIFU2__MicroCodeReturnValue    ),
                .iGEOSync(                          wGEO2_CU__Sync                 ),
                .iGEOSync(                          wGEO2_CU__Sync                 ),
                .iTFFDone(                          wGEO2_CU__TFFDone              ),
                .iTFFDone(                          wGEO2_CU__TFFDone              ),
                .oTriggerTFF(                       wCU2_GEO__TriggerTFF           ),
                .oTriggerTFF(                       wCU2_GEO__TriggerTFF           ),
                .MST_I(                             MST_I                          ),
                .MST_I(                             MST_I                          ),
                .oSetCurrentPitch(                  wCU2_GEO__SetPitch             ),
                .oSetCurrentPitch(                  wCU2_GEO__SetPitch             ),
                .iGFUDone(                          wGEO2_CU__GeometryUnitDone     ),
                .iGFUDone(                          wGEO2_CU__GeometryUnitDone     ),
                .iRenderEnable(                     RENDREN_I                      ),
                .iRenderEnable(                     RENDREN_I                      ),
 
 
                `ifdef DEBUG
                `ifdef DEBUG
                .iDebug_CoreID( iDebug_CoreID ),
                .iDebug_CoreID( iDebug_CoreID ),
                `endif
                `endif
                .oDone(                             DONE_O                         )
                .oDone(                             DONE_O                         )
 
 
        );
        );
 
 
 
 
 
 
 
 
//--------------------------------------------------------      
//--------------------------------------------------------      
 
 
//assign w2MEM_FlipMemory =  (wCU2__ExecuteMicroCode | wCU2_FlipMem ) & wCU2_FlipMemEnabled;
//assign w2MEM_FlipMemory =  (wCU2__ExecuteMicroCode | wCU2_FlipMem ) & wCU2_FlipMemEnabled;
assign w2MEM_FlipMemory =  wCU2_FlipMem  & wCU2_FlipMemEnabled;
assign w2MEM_FlipMemory =  wCU2_FlipMem  & wCU2_FlipMemEnabled;
MemoryUnit MEM
MemoryUnit MEM
(
(
.Clock(Clock),
.Clock(Clock),
.Reset(Reset),
.Reset(Reset),
 
 
.iFlipMemory( w2MEM_FlipMemory ),
.iFlipMemory( w2MEM_FlipMemory ),
 
 
//Data Bus to/from EXE
//Data Bus to/from EXE
.iDataReadAddress1_EXE(       wEXE_2__MEM_DataReadAddress0        ),
.iDataReadAddress1_EXE(       wEXE_2__MEM_DataReadAddress0        ),
.iDataReadAddress2_EXE(       wEXE_2__MEM_DataReadAddress1        ),
.iDataReadAddress2_EXE(       wEXE_2__MEM_DataReadAddress1        ),
.oData1_EXE(                  wMEM_2__EXE_DataRead0               ),
.oData1_EXE(                  wMEM_2__EXE_DataRead0               ),
.oData2_EXE(                  wMEM_2__EXE_DataRead1               ),
.oData2_EXE(                  wMEM_2__EXE_DataRead1               ),
.iDataWriteEnable_EXE(        wEXE_2__DataWriteEnable          ),
.iDataWriteEnable_EXE(        wEXE_2__DataWriteEnable          ),
.iDataWriteAddress_EXE(       wEXE_2__MEM_wDataWriteAddress        ),
.iDataWriteAddress_EXE(       wEXE_2__MEM_wDataWriteAddress        ),
.iData_EXE(                   wEXE_2__MEM_WriteData          ),
.iData_EXE(                   wEXE_2__MEM_WriteData          ),
 
 
//Data Bus to/from IO
//Data Bus to/from IO
 
 
.iDataReadAddress1_IO(       wIO_2_MEM__DataReadAddress0        ),
.iDataReadAddress1_IO(       wIO_2_MEM__DataReadAddress0        ),
.iDataReadAddress2_IO(       wIO_2_MEM__DataReadAddress1        ),
.iDataReadAddress2_IO(       wIO_2_MEM__DataReadAddress1        ),
.oData1_IO(                  wMEM_2__IO_DataRead0               ),
.oData1_IO(                  wMEM_2__IO_DataRead0               ),
.oData2_IO(                  wMEM_2__IO_DataRead1               ),
.oData2_IO(                  wMEM_2__IO_DataRead1               ),
.iDataWriteEnable_IO(        wIO2_MEM__DataWriteEnable          ),
.iDataWriteEnable_IO(        wIO2_MEM__DataWriteEnable          ),
.iDataWriteAddress_IO(       wIO2_MEM__DataWriteAddress        ),
.iDataWriteAddress_IO(       wIO2_MEM__DataWriteAddress        ),
.iData_IO(                   wIO2_MEM__Bus          ),
.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             ),
.iInstructionWriteEnable(  wIO2_MEM_InstructionWriteEnable ),
.iInstructionWriteEnable(  wIO2_MEM_InstructionWriteEnable ),
.iInstructionWriteAddress( wIO2_MEM__InstructionWriteAddr  ),
.iInstructionWriteAddress( wIO2_MEM__InstructionWriteAddr  ),
.iInstruction(             wIO2_MEM__ExternalInstruction   ),
.iInstruction(             wIO2_MEM__ExternalInstruction   ),
.iControlRegister(         CREG_I                          ),
.iControlRegister(         CREG_I                          ),
.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(             wMEM_2__EXE_DataRead0             ),
.iDataRead0(             wMEM_2__EXE_DataRead0             ),
.iDataRead1(             wMEM_2__EXE_DataRead1             ),
.iDataRead1(             wMEM_2__EXE_DataRead1             ),
.iTrigger(               wCU2__ExecuteMicroCode ),
.iTrigger(               wCU2__ExecuteMicroCode ),
.oDataReadAddress0( wEXE_2__MEM_DataReadAddress0 ),
.oDataReadAddress0( wEXE_2__MEM_DataReadAddress0 ),
.oDataReadAddress1( wEXE_2__MEM_DataReadAddress1 ),
.oDataReadAddress1( wEXE_2__MEM_DataReadAddress1 ),
.oDataWriteEnable(  wEXE_2__DataWriteEnable  ),
.oDataWriteEnable(  wEXE_2__DataWriteEnable  ),
.oDataWriteAddress( wEXE_2__MEM_wDataWriteAddress      ),
.oDataWriteAddress( wEXE_2__MEM_wDataWriteAddress      ),
.oDataBus(          wEXE_2__MEM_WriteData          ),
.oDataBus(          wEXE_2__MEM_WriteData          ),
.oReturnCode(       wIFU2__MicroCodeReturnValue ),
.oReturnCode(       wIFU2__MicroCodeReturnValue ),
 
 
`ifdef DEBUG
`ifdef DEBUG
.iDebug_CoreID( iDebug_CoreID ),
.iDebug_CoreID( iDebug_CoreID ),
`endif
`endif
.oDone(             wCU2__MicrocodeExecutionDone )
.oDone(             wCU2__MicrocodeExecutionDone )
 
 
);
);
 
 
////--------------------------------------------------------
////--------------------------------------------------------
wire wGEO2__RequestingTextures;
wire wGEO2__RequestingTextures;
wire w2IO_WriteBack_Set;
wire w2IO_WriteBack_Set;
 
 
GeometryUnit GEO
GeometryUnit GEO
(
(
                .Clock( Clock ),
                .Clock( Clock ),
                .Reset( Reset ),
                .Reset( Reset ),
                .iEnable(                     wCU2_GEO__GeometryFetchEnable       ),
                .iEnable(                     wCU2_GEO__GeometryFetchEnable       ),
                .iIOBusy( wIO_Busy ),
                .iIOBusy( wIO_Busy ),
                .iTexturingEnable(            wCR2_TextureMappingEnabled          ),
                .iTexturingEnable(            wCR2_TextureMappingEnabled          ),
                //Wires from IO
                //Wires from IO
                .iData_WBM(                                             wIO2_MEM__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                 ),
                .oEnable_WBM(                                           wGEO2_IO__EnableWBMaster                                ),
                .oEnable_WBM(                                           wGEO2_IO__EnableWBMaster                                ),
                .oSetAddressWBM(                                        wGEO2_IO__SetAddress                                            ),
                .oSetAddressWBM(                                        wGEO2_IO__SetAddress                                            ),
                .oSetIOWriteBackAddr(         w2IO_WriteBack_Set                  ),
                .oSetIOWriteBackAddr(         w2IO_WriteBack_Set                  ),
                //Wires to CU
                //Wires to CU
                .oRequest_AABBIU(             wGEO2_CU__RequestAABBIU                ),
                .oRequest_AABBIU(             wGEO2_CU__RequestAABBIU                ),
                .oRequest_BIU(                wGEO2_CU__RequestBIU                   ),
                .oRequest_BIU(                wGEO2_CU__RequestBIU                   ),
                .oRequest_TCC(                wGEO2_CU__RequestTCC                   ),
                .oRequest_TCC(                wGEO2_CU__RequestTCC                   ),
                .oTFFDone(                    wGEO2_CU__TFFDone                      ),
                .oTFFDone(                    wGEO2_CU__TFFDone                      ),
                //Wires to RAM-Bus MUX  
                //Wires to RAM-Bus MUX  
                .oRAMWriteAddress(                              w2IO__DataWriteAddress                                     ),
                .oRAMWriteAddress(                              w2IO__DataWriteAddress                                     ),
                .oRAMWriteEnable(                               w2IO__Store                            ),
                .oRAMWriteEnable(                               w2IO__Store                            ),
                //Wires from Execution Unit
                //Wires from Execution Unit
                .iMicrocodeExecutionDone(               wCU2__MicrocodeExecutionDone                            ),
                .iMicrocodeExecutionDone(               wCU2__MicrocodeExecutionDone                            ),
                .iMicroCodeReturnValue(                 wIFU2__MicroCodeReturnValue                             ),
                .iMicroCodeReturnValue(                 wIFU2__MicroCodeReturnValue                             ),
                .oSync(                                                         wGEO2_CU__Sync                                                                  ),
                .oSync(                                                         wGEO2_CU__Sync                                                                  ),
                .iTrigger_TFF(                wCU2_GEO__TriggerTFF                   ),
                .iTrigger_TFF(                wCU2_GEO__TriggerTFF                   ),
                .iBIUHit(                     wIFU2__MicroCodeReturnValue            ),
                .iBIUHit(                     wIFU2__MicroCodeReturnValue            ),
                .oRequestingTextures(         wGEO2__RequestingTextures              ),
                .oRequestingTextures(         wGEO2__RequestingTextures              ),
                `ifdef DEBUG
                `ifdef DEBUG
                .iDebug_CoreID(               iDebug_CoreID                          ),
                .iDebug_CoreID(               iDebug_CoreID                          ),
                `endif
                `endif
                .oDone(                                                         wGEO2_CU__GeometryUnitDone                                      )
                .oDone(                                                         wGEO2_CU__GeometryUnitDone                                      )
);
);
 
 
 
 
assign TGA_O = (wGEO2__RequestingTextures) ? 2'b1: 2'b0;
assign TGA_O = (wGEO2__RequestingTextures) ? 2'b1: 2'b0;
//---------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------
wire[`DATA_ADDRESS_WIDTH-1:0] wIO_2_MEM__DataReadAddress1;
wire[`DATA_ADDRESS_WIDTH-1:0] wIO_2_MEM__DataReadAddress1;
assign wEXE_2__MEM_DataReadAddress1 = (wCU2_IO__WritePixel == 0) ?  wUCODE_RAMReadAddress1 : wIO_2_MEM__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'b0;
assign w2IO__AddrIsImm       = (wCU2_IO__WritePixel == 0 ) ? wGEO2_IO__AddrIsImm       : 1'b0;
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_ADDR_O;
assign w2IO__Adr_O_Pointer      = (wCU2_IO__WritePixel == 0 ) ? wGEO2_IO__Adr_O_Pointer : `OREG_ADDR_O;
//assign w2IO__Adr_O_Pointer      = (wCU2_IO__WritePixel == 0 ) ? wGEO2_IO__Adr_O_Pointer : `CREG_PIXEL_2D_INITIAL_POSITION; 
//assign w2IO__Adr_O_Pointer      = (wCU2_IO__WritePixel == 0 ) ? wGEO2_IO__Adr_O_Pointer : `CREG_PIXEL_2D_INITIAL_POSITION; 
 
 
wire w2IO_MasterCycleType;
wire w2IO_MasterCycleType;
assign w2IO_MasterCycleType = (wCU2_IO__WritePixel) ? `WB_SIMPLE_WRITE_CYCLE : `WB_SIMPLE_READ_CYCLE;
assign w2IO_MasterCycleType = (wCU2_IO__WritePixel) ? `WB_SIMPLE_WRITE_CYCLE : `WB_SIMPLE_READ_CYCLE;
 
 
 
 
 
 
assign w2IO__SetAddress = (wCU2_IO__WritePixel == 0 )? wGEO2_IO__SetAddress : wCU2_GEO__SetPitch;
assign w2IO__SetAddress = (wCU2_IO__WritePixel == 0 )? wGEO2_IO__SetAddress : wCU2_GEO__SetPitch;
 
 
 
 
IO_Unit IO
IO_Unit IO
(
(
 .Clock(               Clock                            ),
 .Clock(               Clock                            ),
 .Reset(               Reset                            ),
 .Reset(               Reset                            ),
 .iEnable(            w2IO__EnableWBMaster              ),
 .iEnable(            w2IO__EnableWBMaster              ),
 .iBusCyc_Type(         w2IO_MasterCycleType            ),
 .iBusCyc_Type(         w2IO_MasterCycleType            ),
 
 
 .iStore(              w2IO__Store                      ),
 .iStore(              w2IO__Store                      ),
 .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(        wMEM_2__IO_DataRead0                       ),
 .iReadDataBus(        wMEM_2__IO_DataRead0                       ),
 .iReadDataBus2(        wMEM_2__IO_DataRead1                       ),
 .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(   wIO_2_MEM__DataReadAddress1       ),
 .oDataReadAddress2(   wIO_2_MEM__DataReadAddress1       ),
 .oDataWriteAddress(   wIO2_MEM__DataWriteAddress    ),
 .oDataWriteAddress(   wIO2_MEM__DataWriteAddress    ),
 .oDataBus(               wIO2_MEM__Bus                 ),
 .oDataBus(               wIO2_MEM__Bus                 ),
 .oInstructionBus(     wIO2_MEM__ExternalInstruction    ),
 .oInstructionBus(     wIO2_MEM__ExternalInstruction    ),
 
 
 .oDataWriteEnable(         wIO2_MEM__DataWriteEnable    ),
 .oDataWriteEnable(         wIO2_MEM__DataWriteEnable    ),
 .oData(                    wIO2_MEM__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 ),
 .oBusy(                      wIO_Busy                  ),
 .oBusy(                      wIO_Busy                  ),
 .oDone(               wIO2__Done                       ),
 .oDone(               wIO2__Done                       ),
 .MST_I( MST_I ),
 .MST_I( MST_I ),
  //Wish Bone Interface
  //Wish Bone Interface
.DAT_I( DAT_I ),
.DAT_I( DAT_I ),
.DAT_O( DAT_O ),
.DAT_O( DAT_O ),
.ACK_I( ACK_I & GNT_I ),
.ACK_I( ACK_I & GNT_I ),
.ACK_O( ACK_O ),
.ACK_O( ACK_O ),
.ADR_O( ADR_O ),
.ADR_O( ADR_O ),
.ADR_I( ADR_I ),
.ADR_I( ADR_I ),
.WE_O(  WE_O  ),
.WE_O(  WE_O  ),
.WE_I(  WE_I  ),
.WE_I(  WE_I  ),
.STB_O( STB_O ),
.STB_O( STB_O ),
.STB_I( STB_I ),
.STB_I( STB_I ),
.CYC_O( CYC_O ),
.CYC_O( CYC_O ),
.TGA_I( TGA_I ),
.TGA_I( TGA_I ),
.CYC_I( CYC_I ),
.CYC_I( CYC_I ),
.GNT_I( GNT_I ),
.GNT_I( GNT_I ),
.TGC_O( TGC_O )
.TGC_O( TGC_O )
 
 
 
 
);
);
//---------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------
endmodule
endmodule
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.