Line 25... |
Line 25... |
(
|
(
|
|
|
input wire Clock,
|
input wire Clock,
|
input wire Reset,
|
input wire Reset,
|
input wire [`ROM_ADDRESS_WIDTH-1:0] iInitialCodeAddress,
|
input wire [`ROM_ADDRESS_WIDTH-1:0] iInitialCodeAddress,
|
input wire [`INSTRUCTION_WIDTH-1:0] iEncodedInstruction,
|
input wire [`INSTRUCTION_WIDTH-1:0] iInstruction1,
|
|
input wire [`INSTRUCTION_WIDTH-1:0] iInstruction2,
|
|
|
|
|
input wire [`DATA_ROW_WIDTH-1:0] iDataRead0,
|
input wire [`DATA_ROW_WIDTH-1:0] iDataRead0,
|
input wire [`DATA_ROW_WIDTH-1:0] iDataRead1,
|
input wire [`DATA_ROW_WIDTH-1:0] iDataRead1,
|
input wire iTrigger,
|
input wire iTrigger,
|
|
|
|
|
output wire [`ROM_ADDRESS_WIDTH-1:0] oInstructionPointer,
|
output wire [`ROM_ADDRESS_WIDTH-1:0] oInstructionPointer1,
|
|
output wire [`ROM_ADDRESS_WIDTH-1:0] oInstructionPointer2,
|
output wire [`DATA_ADDRESS_WIDTH-1:0] oDataReadAddress0,
|
output wire [`DATA_ADDRESS_WIDTH-1:0] oDataReadAddress0,
|
output wire [`DATA_ADDRESS_WIDTH-1:0] oDataReadAddress1,
|
output wire [`DATA_ADDRESS_WIDTH-1:0] oDataReadAddress1,
|
output wire oDataWriteEnable,
|
output wire oDataWriteEnable,
|
output wire [`DATA_ADDRESS_WIDTH-1:0] oDataWriteAddress,
|
output wire [`DATA_ADDRESS_WIDTH-1:0] oDataWriteAddress,
|
output wire [`DATA_ROW_WIDTH-1:0] oDataBus,
|
output wire [`DATA_ROW_WIDTH-1:0] oDataBus,
|
Line 58... |
Line 60... |
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 [`INSTRUCTION_WIDTH-1:0] CurrentInstruction;
|
wire [`INSTRUCTION_WIDTH-1:0] CurrentInstruction;
|
wire wIDU2_IFU__IDUBusy;
|
//wire wIDU2_IFU__IDUBusy;
|
|
|
|
|
wire [`INSTRUCTION_OP_LENGTH-1:0] wOperation;
|
wire [`INSTRUCTION_OP_LENGTH-1:0] wOperation;
|
|
|
|
|
Line 81... |
Line 83... |
wire [`WIDTH-1:0] ALU2ResultA;
|
wire [`WIDTH-1:0] ALU2ResultA;
|
wire [`WIDTH-1:0] ALU2ResultB;
|
wire [`WIDTH-1:0] ALU2ResultB;
|
wire [`WIDTH-1:0] ALU2ResultC;
|
wire [`WIDTH-1:0] ALU2ResultC;
|
wire wEXE2_ALU__TriggerALU;
|
wire wEXE2_ALU__TriggerALU;
|
wire ALU2OutputReady;
|
wire ALU2OutputReady;
|
wire JumpFlag;
|
wire w2FIU__BranchTaken;
|
wire [`ROM_ADDRESS_WIDTH-1:0] JumpIp;
|
wire [`ROM_ADDRESS_WIDTH-1:0] JumpIp;
|
|
|
|
|
wire wIDU2_IFU__InputsLatched;
|
//wire wIDU2_IFU__InputsLatched;
|
|
|
InstructionFetchUnit IFU
|
wire wEPU_Busy,wTriggerIFU;
|
|
wire [`ROM_ADDRESS_WIDTH-1:0] wEPU_IP,wIFU_IP,wCodeEntryPoint;
|
|
|
|
assign oInstructionPointer1 = (wEPU_Busy) ? wEPU_IP : wIFU_IP;
|
|
|
|
|
|
InstructionEntryPoint EPU
|
(
|
(
|
.Clock( Clock ),
|
.Clock( Clock ),
|
.Reset( Reset ),
|
.Reset( Reset ),
|
.iTrigger( iTrigger ),
|
.iTrigger( iTrigger ),
|
.iInitialCodeAddress( iInitialCodeAddress ),
|
.iInitialCodeAddress( iInitialCodeAddress ),
|
|
.iIMemInput(iInstruction1),
|
|
|
|
.oEPU_Busy(wEPU_Busy),
|
|
.oEntryPoint( wCodeEntryPoint ),
|
|
.oTriggerIFU( wTriggerIFU ),
|
|
.oInstructionAddr( wEPU_IP )
|
|
|
|
);
|
|
|
|
InstructionFetch IFU
|
|
(
|
|
.Clock( Clock ),
|
|
.Reset( Reset ),
|
|
.iTrigger( wTriggerIFU ),
|
|
.iInstruction1( iInstruction1 ),
|
|
.iInstruction2( iInstruction2 ),
|
|
.iInitialCodeAddress( wCodeEntryPoint ),
|
|
.iBranchTaken( w2FIU__BranchTaken ),
|
.oCurrentInstruction( CurrentInstruction ),
|
.oCurrentInstruction( CurrentInstruction ),
|
.oInstructionAvalable( wInstructionAvailable ),
|
.oInstructionAvalable( wInstructionAvailable ),
|
.oInstructionPointer( oInstructionPointer ),
|
.oIP( wIFU_IP ),
|
.iEncodedInstruction( iEncodedInstruction ),
|
.oIP2( oInstructionPointer2 ),
|
.oExecutionDone( oDone ),
|
.iEXEDone( ALU2OutputReady ),
|
.iBranchTaken( JumpFlag ),
|
.oMicroCodeReturnValue( oReturnCode ),
|
.iBranchNotTaken( wALU2_IFU_BranchNotTaken ),
|
.oExecutionDone( oDone )
|
.iJumpIp( JumpIp ),
|
|
.iIDUBusy( wIDU2_IFU__IDUBusy ),
|
|
.iExeBusy( wEXE2_IFU__EXEBusy ),
|
|
.iDecodeUnitLatchedValues( wIDU2_IFU__InputsLatched ),
|
|
.oMicroCodeReturnValue( oReturnCode )
|
|
|
|
);
|
);
|
|
|
|
/*
|
|
InstructionFetchUnit IFU
|
|
(
|
|
.Clock( Clock ),
|
|
.Reset( Reset ),
|
|
.iTrigger( wTriggerIFU ),
|
|
.iInitialCodeAddress( wCodeEntryPoint ),
|
|
.oCurrentInstruction( CurrentInstruction ),
|
|
.oInstructionAvalable( wInstructionAvailable ),
|
|
.oInstructionPointer1( wIFU_IP ),
|
|
.iInstruction1( iInstruction1 ),
|
|
.oExecutionDone( oDone ),
|
|
.iBranchTaken( w2FIU__BranchTaken ),
|
|
.iBranchNotTaken( wALU2_IFU_BranchNotTaken ),
|
|
.iJumpIp( JumpIp ),
|
|
.iIDUBusy( wIDU2_IFU__IDUBusy ),
|
|
.iExeBusy( wEXE2_IFU__EXEBusy ),
|
|
.iDecodeUnitLatchedValues( wIDU2_IFU__InputsLatched ),
|
|
.oMicroCodeReturnValue( oReturnCode )
|
|
|
|
);
|
|
*/
|
////---------------------------------------------------------
|
////---------------------------------------------------------
|
wire wIDU2_EXE_DataReady;
|
wire wIDU2_EXE_DataReady;
|
wire wEXE2_IDU_ExeLatchedValues;
|
wire wEXE2_IDU_ExeLatchedValues;
|
|
|
InstructionDecode IDU
|
InstructionDecode IDU
|
(
|
(
|
.Clock( Clock ),
|
.Clock( Clock ),
|
.Reset( Reset ),
|
.Reset( Reset ),
|
.iTrigger( iTrigger ),
|
|
.iEncodedInstruction( CurrentInstruction ),
|
.iEncodedInstruction( CurrentInstruction ),
|
.iInstructionAvailable( wInstructionAvailable ),
|
.iInstructionAvailable( wInstructionAvailable ),
|
.iExecutioUnitLatchedValues( wEXE2_IDU_ExeLatchedValues ),
|
|
.oRamAddress0( oDataReadAddress0 ),
|
.oRamAddress0( oDataReadAddress0 ),
|
.oRamAddress1( oDataReadAddress1 ),
|
.oRamAddress1( oDataReadAddress1 ),
|
.iRamValue0( iDataRead0 ),
|
.iRamValue0( iDataRead0 ),
|
.iRamValue1( iDataRead1 ),
|
.iRamValue1( iDataRead1 ),
|
|
|
.iLastDestination( wEXE2_IDU_DataFordward_LastDestination ),
|
.iLastDestination( wEXE2_IDU_DataFordward_LastDestination ),
|
.iDataForward( {ALU2ResultA,ALU2ResultB,ALU2ResultC} ),
|
.iDataForward( {ALU2ResultA,ALU2ResultB,ALU2ResultC} ),
|
|
|
//Outputs going to the ALU-FSM
|
//Outputs going to the ALU-FSM
|
.oOperation( wOperation ),
|
.oOperation( wOperation ),
|
.oDestination( wDestination ),
|
.oDestination( wDestination ),
|
.oSource0( wSource0 ),
|
.oSource0( wSource0 ),
|
.oSource1( wSource1 ),
|
.oSource1( wSource1 ),
|
.oInputsLatched( wIDU2_IFU__InputsLatched ),
|
|
.oDataReadyForExe( wIDU2_EXE_DataReady ),
|
|
|
|
`ifdef DEBUG
|
`ifdef DEBUG
|
.iDebug_CurrentIP( oInstructionPointer ),
|
.iDebug_CurrentIP( oInstructionPointer1 ),
|
.oDebug_CurrentIP( wDEBUG_IDU2_EXE_InstructionPointer ),
|
.oDebug_CurrentIP( wDEBUG_IDU2_EXE_InstructionPointer ),
|
`endif
|
`endif
|
.oBusy( wIDU2_IFU__IDUBusy )
|
|
//.oDecodeDone( wEXE2__uCodeDone )
|
.oDataReadyForExe( wIDU2_EXE_DataReady )
|
|
|
|
|
|
|
|
|
|
|
);
|
);
|
|
|
|
/*
|
|
InstructionDecode IDU
|
|
(
|
|
.Clock( Clock ),
|
|
.Reset( Reset ),
|
|
.iTrigger( iTrigger ),
|
|
.iInstruction1( CurrentInstruction ),
|
|
.iInstructionAvailable( wInstructionAvailable ),
|
|
.iExecutioUnitLatchedValues( wEXE2_IDU_ExeLatchedValues ),
|
|
.oRamAddress0( oDataReadAddress0 ),
|
|
.oRamAddress1( oDataReadAddress1 ),
|
|
.iRamValue0( iDataRead0 ),
|
|
.iRamValue1( iDataRead1 ),
|
|
.iLastDestination( wEXE2_IDU_DataFordward_LastDestination ),
|
|
.iDataForward( {ALU2ResultA,ALU2ResultB,ALU2ResultC} ),
|
|
|
|
//Outputs going to the ALU-FSM
|
|
.oOperation( wOperation ),
|
|
.oDestination( wDestination ),
|
|
.oSource0( wSource0 ),
|
|
.oSource1( wSource1 ),
|
|
.oInputsLatched( wIDU2_IFU__InputsLatched ),
|
|
.oDataReadyForExe( wIDU2_EXE_DataReady ),
|
|
|
|
`ifdef DEBUG
|
|
.iDebug_CurrentIP( oInstructionPointer1 ),
|
|
.oDebug_CurrentIP( wDEBUG_IDU2_EXE_InstructionPointer ),
|
|
`endif
|
|
.oBusy( wIDU2_IFU__IDUBusy )
|
|
//.oDecodeDone( wEXE2__uCodeDone )
|
|
);
|
|
*/
|
|
|
|
|
ExecutionFSM EXE
|
ExecutionFSM EXE
|
(
|
(
|
.Clock( Clock ),
|
.Clock( Clock ),
|
Line 161... |
Line 239... |
`endif
|
`endif
|
|
|
//.iJumpResultFromALU( wALU2_EXE__BranchTaken ),
|
//.iJumpResultFromALU( wALU2_EXE__BranchTaken ),
|
.iBranchTaken( wALU2_EXE__BranchTaken ),
|
.iBranchTaken( wALU2_EXE__BranchTaken ),
|
.iBranchNotTaken( wALU2_IFU_BranchNotTaken ),
|
.iBranchNotTaken( wALU2_IFU_BranchNotTaken ),
|
.oJumpFlag( JumpFlag ),
|
.oJumpFlag( w2FIU__BranchTaken ),
|
.oJumpIp( JumpIp ),
|
.oJumpIp( JumpIp ),
|
.oRAMWriteEnable( oDataWriteEnable ),
|
.oRAMWriteEnable( oDataWriteEnable ),
|
.oRAMWriteAddress( oDataWriteAddress ),
|
.oRAMWriteAddress( oDataWriteAddress ),
|
.RAMBus( oDataBus ),
|
.RAMBus( oDataBus ),
|
.oBusy( wEXE2_IFU__EXEBusy ),
|
.oBusy( wEXE2_IFU__EXEBusy ),
|