?? nnarm.v
字號:
`include "Def_StructureParameter.v"
`include "InstructionPreFetch.v"
`include "MemoryController.v"
`include "InstructionCacheController.v"
`include "DataCacheController.v"
`include "IF.v"
`include "Decoder_ARM.v"
`include "ALUShell.v"
`include "ALUComb.v"
`include "mem.v"
`include "wb.v"
`include "Arbitrator.v"
`include "RegisterFile.v"
`include "BusTransfer.v"
`include "CanGoGen.v"
`include "psr.v"
module nnARM(clock,
reset);
//global signal
input clock,reset;
//the signal between MemoryController and InstructionCache
wire [`MemoryBusWidth-1:0] MemoryBus;
wire nMemoryWait;
wire [`AddressBusWidth-1:0] InstructionAddress;
wire nRW,nBW,MemoryRequest,SEQ;
//the signal between instruction cache and instruction prefetch
wire [`InstructionCacheLineWidth-1:0] InstructionOut;
wire InstructionWait;
wire [`AddressBusWidth-1:0] PreFetchedAddress;
wire PreFetchedRequest;
//signal between instruction prefetch and if
wire Wait;
wire [`InstructionWidth-1:0] Instruction;
wire [`AddressBusWidth-1:0] out_InstructionAddress,out_NextInstructionAddress;
//signal between if and register file
//use to update pc and read pc
wire out_FourthReadRegisterEnable;
wire [`Def_RegisterSelectWidth-1:0] out_FourthReadRegisterNumber;
wire [`WordWidth-1:0] FourthReadBus;
wire out_SecondWriteRegisterEnable;
wire [`Def_RegisterSelectWidth-1:0] out_SecondWriteRegisterNumber;
wire [`WordWidth-1:0] SecondWriteBus;
//signal between if and id
wire [`InstructionWidth-1:0] Pipeline_IFID;
wire Valid_Pipeline_IFID;
wire [`AddressBusWidth-1:0] out_AddressGoWithInstruction;
//signal between id and register file
wire out_LeftReadRegisterEnable,out_RightReadRegisterEnable,out_ThirdReadRegisterEnable;
wire [`Def_RegisterSelectWidth-1:0] out_LeftReadRegisterNumber,out_RightReadRegisterNumber,out_ThirdReadRegisterNumber;
//signal between decoder and alu
wire out_ALUEnable;
wire [`ByteWidth-1:0] out_ALUType;
wire [`Def_RegisterSelectWidth-1:0] out_ALULeftRegister;
wire [`Def_RegisterSelectWidth-1:0] out_ALURightRegister;
wire [`Def_RegisterSelectWidth-1:0] out_ALUThirdRegister;
wire out_ALULeftFromImm;
wire out_ALURightFromImm;
wire out_ALUThirdFromImm;
wire out_CPSRFromImm;
wire out_SPSRFromImm;
wire [`Def_RegisterSelectWidth-1:0] out_ALUTargetRegister;
wire [`Def_ShiftTypeWidth-1:0] out_ALURightShiftType;
wire [`ByteWidth-1:0] out_SimpleALUType;
wire [`Def_RegisterSelectWidth-1:0] out_SimpleALUTargetRegister;
wire [`WordWidth-1:0] out_ALUMisc;
wire [`ByteWidth-1:0] out_ALUPSRType;
wire [`AddressBusWidth-1:0] out_NextAddressGoWithInstruction2ALU;
//signal bwtween decoder and mem
wire out_MEMEnable;
wire [`ByteWidth-1:0] out_MEMType;
wire [`Def_RegisterSelectWidth-1:0] out_MEMTargetRegister;
wire [`ByteWidth-1:0] out_SimpleMEMType;
wire [`Def_RegisterSelectWidth-1:0] out_SimpleMEMTargetRegister;
wire [`ByteWidth-1:0] out_MEMPSRType;
//signal go from alu to mem
wire out_ALUWriteEnable;
wire [`WordWidth-1:0] out_ALUWriteBus;
wire [`WordWidth-1:0] out_ALUCPSR2MEM,out_ALUSPSR2MEM;
wire [`Def_RegisterSelectWidth-1:0] out_ALUTargetRegister2MEM;
wire [`WordWidth-1:0] out_SimpleALUResult2MEM;
wire [`Def_RegisterSelectWidth-1:0] out_SimpleALUTargetRegister2MEM;
wire [`ByteWidth-1:0] out_MEMType2MEM;
wire [`Def_RegisterSelectWidth-1:0] out_MEMTargetRegister2MEM;
wire [`ByteWidth-1:0] out_SimpleMEMType2MEM;
wire [`Def_RegisterSelectWidth-1:0] out_SimpleMEMTargetRegister2MEM;
wire [`WordWidth-1:0] out_StoredValue;
wire [`ByteWidth-1:0] out_MEMPSRType2MEM,out_ALUPSRType2MEM;
wire out_IsLoadToPC;
wire out_IfChangeState2MEM;
wire [4:0] out_ChangeStateAction2MEM;
//signal go out of mem and into wb and forward to alu
wire out_MEMWriteEnable;
wire [`WordWidth-1:0] out_MEMWriteResult;
wire [`Def_RegisterSelectWidth-1:0] out_MEMTargetRegister2WB;
wire [`WordWidth-1:0] out_SimpleMEMResult2WB;
wire [`Def_RegisterSelectWidth-1:0] out_SimpleMEMTargetRegister2WB;
wire [`ByteWidth-1:0] out_MEMPSRType2WB;
wire [`WordWidth-1:0] out_CPSR2WB,out_SPSR2WB;
//connection between ALUShell and ALUComb
wire [`WordWidth-1:0] ALUCombResult;
wire Carry,Zero,Neg,Overflow;
wire [`ByteWidth-1:0] ALUComb_ALUType;
wire [`WordWidth-1:0] ALUComb_LeftOperand,
ALUComb_RightOperand,
ALUComb_ThirdOperand;
wire [`Def_ShiftTypeWidth-1:0] ALUComb_RightOperandShiftType;
wire [`Def_ShiftCountWidth-1:0] ALUComb_RightOperandShiftCount;
wire [2:0] ALUComb_ShiftCountHigh3Bit;
wire ALUComb_ShiftCountInReg;
wire ALUComb_Carry,ALUComb_Neg,ALUComb_Zero,ALUComb_Overflow;
//who can go and who can not go
wire out_IFCanGo,out_IFOwnCanGo;
wire out_IDCanGo,out_IDOwnCanGo;
wire out_EXECanGo,out_EXEOwnCanGo;
wire out_MEMCanGo,out_MEMOwnCanGo;
//signal between mem and data cache
wire [`AddressBusWidth-1:0] out_MEMAccessAddress;
wire out_MEMAccessRequest,
out_MEMAccessRW,
out_MEMAccessBW;
wire out_DataCacheWait;
wire [`WordWidth-1:0] DataCacheBus;
//signal between data cache and data memory
wire [`AddressBusWidth-1:0] out_DataMemoryAddress;
wire [`WordWidth-1:0] DataMemoryBus;
wire out_DataMemoryEnable,
out_DataMemoryRW;
wire nDataMemoryWait;
//psr register file
wire [`WordWidth-1:0] out_CPSR,out_SPSR;
wire in_SPSRWriteEnable;
wire in_CPSRWriteEnable;
wire [`WordWidth-1:0] out_CPSRWriteValue,out_SPSRWriteValue;
wire [4:0] out_ChangeStateAction2WB;
wire out_IfChangeState2WB;
//alu send out these signal to if to update pc
wire out_ChangePC;
wire [`AddressBusWidth-1:0] out_NewPC;
//mem send out these signal to if to update pc
wire out_MEMChangePC;
wire [`AddressBusWidth-1:0] out_MEMNewPC;
//global signal
wire [`WordWidth-1:0] LeftReadBus,RightReadBus,ThirdReadBus,WriteBus,SecondWriteBus,ThirdWriteBus;
wire WriteRegisterEnable,ThirdWriteRegisterEnable;
wire [`Def_RegisterSelectWidth-1:0] WriteRegisterNumber,ThirdWriteRegisterNumber;
CanGoGen inst_CanGoGen(.out_IFCanGo(out_IFCanGo),
.out_IDCanGo(out_IDCanGo),
.out_EXECanGo(out_EXECanGo),
.out_MEMCanGo(out_MEMCanGo),
.in_IFOwnCanGo(out_IFOwnCanGo),
.in_IDOwnCanGo(out_IDOwnCanGo),
.in_EXEOwnCanGo(out_EXEOwnCanGo),
.in_MEMOwnCanGo(out_MEMOwnCanGo)
);
StatusRegisters inst_StatusRegisters( //change of state
.in_IfChangeState(out_IfChangeState2WB),
.in_ChangeStateAction(out_ChangeStateAction2WB),
//write to register
.in_CPSRWriteEnable(out_CPSRWriteEnable),
.in_CPSRWriteValue(out_CPSRWriteValue),
.in_SPSRWriteEnable(out_SPSRWriteEnable),
.in_SPSRWriteValue(out_SPSRWriteValue),
//output of status register
.out_CPSR(out_CPSR),
.out_SPSR(out_SPSR),
.clock(clock),
.reset(reset)
);
RegisterFile inst_RegisterFile( //change of state
.in_IfChangeState(out_IfChangeState2WB),
.in_ChangeStateAction(out_ChangeStateAction2WB),
.in_LeftReadEnable(out_LeftReadRegisterEnable),
.in_LeftReadRegisterNumber(out_LeftReadRegisterNumber),
.out_LeftReadBus(LeftReadBus),
.in_RightReadEnable(out_RightReadRegisterEnable),
.in_RightReadRegisterNumber(out_RightReadRegisterNumber),
.out_RightReadBus(RightReadBus),
.in_ThirdReadEnable(out_ThirdReadRegisterEnable),
.in_ThirdReadRegisterNumber(out_ThirdReadRegisterNumber),
.out_ThirdReadBus(ThirdReadBus),
.in_FourthReadEnable(out_FourthReadRegisterEnable),
.in_FourthReadRegisterNumber(out_FourthReadRegisterNumber),
.out_FourthReadBus(FourthReadBus),
.in_WriteEnable(WriteRegisterEnable),
.in_WriteRegisterNumber(WriteRegisterNumber),
.in_WriteBus(WriteBus),
.in_SecondWriteEnable(out_SecondWriteRegisterEnable),
.in_SecondWriteRegisterNumber(out_SecondWriteRegisterNumber),
.in_SecondWriteBus(SecondWriteBus),
.in_ThirdWriteEnable(ThirdWriteRegisterEnable),
.in_ThirdWriteRegisterNumber(ThirdWriteRegisterNumber),
.in_ThirdWriteBus(ThirdWriteBus),
//the processor mode
.in_ProcessorMode(out_CPSR[4:0]),
.clock(clock),
.reset(reset)
);
//WB inst_WB(//the write to register file
// .out_WBWriteBus(WriteBus),
// .out_WBWriteEnable(WriteRegisterEnable),
// .out_WBWriteTargetRegister(WriteRegisterNumber),
//input from mem
// .in_MEMWriteEnable(out_MEMWriteEnable),
// .in_MEMWriteResult(out_MEMWriteResult),
// .in_MEMWriteTargetRegister(out_MEMTargetRegister),
// .clock(clock),
// .reset(reset)
// );
MEM inst_MEM( //signal from ALU
.in_ALUValid(out_ALUWriteEnable),
.in_ALUWriteBus(out_ALUWriteBus),
.in_ALUTargetRegister(out_ALUTargetRegister2MEM),
.in_SimpleALUResult(out_SimpleALUResult2MEM),
.in_SimpleALUTargetRegister(out_SimpleALUTargetRegister2MEM),
.in_StoredValue(out_StoredValue),
.in_CPSR(out_ALUCPSR2MEM),
.in_SPSR(out_ALUSPSR2MEM),
.in_IfChangeState(out_IfChangeState2MEM),
.in_ChangeStateAction(out_ChangeStateAction2MEM),
//signal come from alu that origin come from decoder
.in_MEMType(out_MEMType2MEM),
.in_MEMTargetRegister(out_MEMTargetRegister2MEM),
.in_SimpleMEMType(out_SimpleMEMType2MEM),
.in_SimpleMEMTargetRegister(out_SimpleMEMTargetRegister2MEM),
.in_MEMPSRType(out_MEMPSRType2MEM),
.in_IsLoadToPC(out_IsLoadToPC),
//signal goto wb
.out_MEMWriteEnable(out_MEMWriteEnable),
.out_MEMWriteResult(out_MEMWriteResult),
.out_MEMTargetRegister(out_MEMTargetRegister2WB),
.out_SimpleMEMResult(out_SimpleMEMResult2WB),
.out_SimpleMEMTargetRegister(out_SimpleMEMTargetRegister2WB),
.out_MEMPSRType2WB(out_MEMPSRType2WB),
.out_CPSR2WB(out_CPSR2WB),
.out_SPSR2WB(out_SPSR2WB),
.out_IfChangeState(out_IfChangeState2WB),
.out_ChangeStateAction(out_ChangeStateAction2WB),
//the first and third write bus
.out_WriteBus(WriteBus),
.out_WriteRegisterEnable(WriteRegisterEnable),
.out_WriteRegisterNumber(WriteRegisterNumber),
.out_ThirdWriteBus(ThirdWriteBus),
.out_ThirdWriteRegisterEnable(ThirdWriteRegisterEnable),
.out_ThirdWriteRegisterNumber(ThirdWriteRegisterNumber),
.out_CPSR2PSR(out_CPSRWriteValue),
.out_CPSRWriteEnable(out_CPSRWriteEnable),
.out_SPSR2PSR(out_SPSRWriteValue),
.out_SPSRWriteEnable(out_SPSRWriteEnable),
//can MEM go?
.out_MEMOwnCanGo(out_MEMOwnCanGo),
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -