Removed CommittedM as it is redundant with LSUStall.

This commit is contained in:
Ross Thompson 2021-12-28 16:14:10 -06:00
parent 39bd78c295
commit e29803be30
6 changed files with 8 additions and 39 deletions

View File

@ -42,7 +42,6 @@ module dcache
input logic [`XLEN-1:0] FinalWriteDataM, input logic [`XLEN-1:0] FinalWriteDataM,
output logic [`XLEN-1:0] ReadDataWordM, output logic [`XLEN-1:0] ReadDataWordM,
output logic DCacheStall, output logic DCacheStall,
output logic CommittedM,
output logic DCacheMiss, output logic DCacheMiss,
output logic DCacheAccess, output logic DCacheAccess,
@ -282,7 +281,6 @@ module dcache
.CacheHit, .CacheHit,
.VictimDirty, .VictimDirty,
.DCacheStall, .DCacheStall,
.CommittedM,
.DCacheMiss, .DCacheMiss,
.DCacheAccess, .DCacheAccess,
.SelAdrM, .SelAdrM,

View File

@ -46,7 +46,6 @@ module dcachefsm
// hazard outputs // hazard outputs
output logic DCacheStall, output logic DCacheStall,
output logic CommittedM,
// counter outputs // counter outputs
output logic DCacheMiss, output logic DCacheMiss,
output logic DCacheAccess, output logic DCacheAccess,
@ -115,7 +114,6 @@ module dcachefsm
ClearDirty = 1'b0; ClearDirty = 1'b0;
SRAMWordWriteEnableM = 1'b0; SRAMWordWriteEnableM = 1'b0;
SRAMBlockWriteEnableM = 1'b0; SRAMBlockWriteEnableM = 1'b0;
CommittedM = 1'b0;
SelEvict = 1'b0; SelEvict = 1'b0;
LRUWriteEn = 1'b0; LRUWriteEn = 1'b0;
SelFlush = 1'b0; SelFlush = 1'b0;
@ -136,7 +134,6 @@ module dcachefsm
SRAMWordWriteEnableM = 1'b0; SRAMWordWriteEnableM = 1'b0;
SetDirty = 1'b0; SetDirty = 1'b0;
LRUWriteEn = 1'b0; LRUWriteEn = 1'b0;
CommittedM = 1'b0;
// TLB Miss // TLB Miss
if(IgnoreRequest) begin if(IgnoreRequest) begin
@ -146,7 +143,6 @@ module dcachefsm
// PTW ready the CPU will stall. // PTW ready the CPU will stall.
// The page table walker asserts it's control 1 cycle // The page table walker asserts it's control 1 cycle
// after the TLBs miss. // after the TLBs miss.
// CommittedM = 1'b1; ??? *** Not Sure yet.
NextState = STATE_READY; NextState = STATE_READY;
end end
@ -216,7 +212,6 @@ module dcachefsm
STATE_MISS_FETCH_WDV: begin STATE_MISS_FETCH_WDV: begin
DCacheStall = 1'b1; DCacheStall = 1'b1;
SelAdrM = 2'b10; SelAdrM = 2'b10;
CommittedM = 1'b1;
if (BUSACK) begin if (BUSACK) begin
NextState = STATE_MISS_FETCH_DONE; NextState = STATE_MISS_FETCH_DONE;
@ -228,7 +223,6 @@ module dcachefsm
STATE_MISS_FETCH_DONE: begin STATE_MISS_FETCH_DONE: begin
DCacheStall = 1'b1; DCacheStall = 1'b1;
SelAdrM = 2'b10; SelAdrM = 2'b10;
CommittedM = 1'b1;
if(VictimDirty) begin if(VictimDirty) begin
NextState = STATE_MISS_EVICT_DIRTY; NextState = STATE_MISS_EVICT_DIRTY;
DCWriteLine = 1'b1; DCWriteLine = 1'b1;
@ -244,14 +238,12 @@ module dcachefsm
SelAdrM = 2'b10; SelAdrM = 2'b10;
SetValid = 1'b1; SetValid = 1'b1;
ClearDirty = 1'b1; ClearDirty = 1'b1;
CommittedM = 1'b1;
//LRUWriteEn = 1'b1; // DO not update LRU on SRAM fetch update. Wait for subsequent read/write //LRUWriteEn = 1'b1; // DO not update LRU on SRAM fetch update. Wait for subsequent read/write
end end
STATE_MISS_READ_WORD: begin STATE_MISS_READ_WORD: begin
SelAdrM = 2'b10; SelAdrM = 2'b10;
DCacheStall = 1'b1; DCacheStall = 1'b1;
CommittedM = 1'b1;
if (MemRWM[0] & ~AtomicM[1]) begin // handles stores and amo write. if (MemRWM[0] & ~AtomicM[1]) begin // handles stores and amo write.
NextState = STATE_MISS_WRITE_WORD; NextState = STATE_MISS_WRITE_WORD;
end else begin end else begin
@ -263,7 +255,6 @@ module dcachefsm
STATE_MISS_READ_WORD_DELAY: begin STATE_MISS_READ_WORD_DELAY: begin
//SelAdrM = 2'b10; //SelAdrM = 2'b10;
CommittedM = 1'b1;
SRAMWordWriteEnableM = 1'b0; SRAMWordWriteEnableM = 1'b0;
SetDirty = 1'b0; SetDirty = 1'b0;
LRUWriteEn = 1'b0; LRUWriteEn = 1'b0;
@ -294,7 +285,6 @@ module dcachefsm
SRAMWordWriteEnableM = 1'b1; SRAMWordWriteEnableM = 1'b1;
SetDirty = 1'b1; SetDirty = 1'b1;
SelAdrM = 2'b10; SelAdrM = 2'b10;
CommittedM = 1'b1;
LRUWriteEn = 1'b1; LRUWriteEn = 1'b1;
if(CPUBusy) begin if(CPUBusy) begin
NextState = STATE_CPU_BUSY; NextState = STATE_CPU_BUSY;
@ -308,7 +298,6 @@ module dcachefsm
STATE_MISS_EVICT_DIRTY: begin STATE_MISS_EVICT_DIRTY: begin
DCacheStall = 1'b1; DCacheStall = 1'b1;
SelAdrM = 2'b10; SelAdrM = 2'b10;
CommittedM = 1'b1;
SelEvict = 1'b1; SelEvict = 1'b1;
if(BUSACK) begin if(BUSACK) begin
NextState = STATE_MISS_WRITE_CACHE_BLOCK; NextState = STATE_MISS_WRITE_CACHE_BLOCK;
@ -319,7 +308,6 @@ module dcachefsm
STATE_CPU_BUSY: begin STATE_CPU_BUSY: begin
CommittedM = 1'b1;
SelAdrM = 2'b00; SelAdrM = 2'b00;
if(CPUBusy) begin if(CPUBusy) begin
NextState = STATE_CPU_BUSY; NextState = STATE_CPU_BUSY;
@ -331,7 +319,6 @@ module dcachefsm
end end
STATE_CPU_BUSY_FINISH_AMO: begin STATE_CPU_BUSY_FINISH_AMO: begin
CommittedM = 1'b1;
SelAdrM = 2'b10; SelAdrM = 2'b10;
SRAMWordWriteEnableM = 1'b0; SRAMWordWriteEnableM = 1'b0;
SetDirty = 1'b0; SetDirty = 1'b0;
@ -349,7 +336,6 @@ module dcachefsm
STATE_FLUSH: begin STATE_FLUSH: begin
DCacheStall = 1'b1; DCacheStall = 1'b1;
CommittedM = 1'b1;
SelAdrM = 2'b11; SelAdrM = 2'b11;
SelFlush = 1'b1; SelFlush = 1'b1;
FlushAdrCntEn = 1'b1; FlushAdrCntEn = 1'b1;
@ -372,7 +358,6 @@ module dcachefsm
STATE_FLUSH_WRITE_BACK: begin STATE_FLUSH_WRITE_BACK: begin
DCacheStall = 1'b1; DCacheStall = 1'b1;
SelAdrM = 2'b11; SelAdrM = 2'b11;
CommittedM = 1'b1;
SelFlush = 1'b1; SelFlush = 1'b1;
if(BUSACK) begin if(BUSACK) begin
NextState = STATE_FLUSH_CLEAR_DIRTY; NextState = STATE_FLUSH_CLEAR_DIRTY;

View File

@ -42,7 +42,6 @@ module lsu
input logic ExceptionM, input logic ExceptionM,
input logic PendingInterruptM, input logic PendingInterruptM,
input logic FlushDCacheM, input logic FlushDCacheM,
output logic CommittedM,
output logic SquashSCW, output logic SquashSCW,
output logic DCacheMiss, output logic DCacheMiss,
output logic DCacheAccess, output logic DCacheAccess,
@ -110,9 +109,6 @@ module lsu
logic SelHPTW; logic SelHPTW;
logic DCCommittedM;
logic CommittedMfromBus;
logic BusStall; logic BusStall;
@ -221,7 +217,6 @@ module lsu
assign CPUBusy = StallW & ~SelHPTW; assign CPUBusy = StallW & ~SelHPTW;
// always block interrupts when using the hardware page table walker. // always block interrupts when using the hardware page table walker.
assign CommittedM = SelHPTW | DCCommittedM | CommittedMfromBus;
// this is for the d cache SRAM. // this is for the d cache SRAM.
// turns out because we cannot pipeline hptw requests we don't need this register // turns out because we cannot pipeline hptw requests we don't need this register
@ -259,13 +254,13 @@ module lsu
assign LsuAdrE = IEUAdrE[11:0]; assign LsuAdrE = IEUAdrE[11:0];
assign LsuPAdrM = IEUAdrExtM; assign LsuPAdrM = IEUAdrExtM;
assign CPUBusy = StallW; assign CPUBusy = StallW;
assign CommittedM = CommittedMfromBus;
assign DTLBLoadPageFaultM = 1'b0; assign DTLBLoadPageFaultM = 1'b0;
assign DTLBStorePageFaultM = 1'b0; assign DTLBStorePageFaultM = 1'b0;
end end
endgenerate endgenerate
mmu #(.TLB_ENTRIES(`DTLB_ENTRIES), .IMMU(0)) mmu #(.TLB_ENTRIES(`DTLB_ENTRIES), .IMMU(0))
dmmu(.clk, .reset, .SATP_REGW, .STATUS_MXR, .STATUS_SUM, .STATUS_MPRV, .STATUS_MPP, dmmu(.clk, .reset, .SATP_REGW, .STATUS_MXR, .STATUS_SUM, .STATUS_MPRV, .STATUS_MPP,
.PrivilegeModeW, .DisableTranslation(SelHPTW), .PrivilegeModeW, .DisableTranslation(SelHPTW),
@ -369,7 +364,6 @@ module lsu
.MemAdrE(DCAdrE), .MemAdrE(DCAdrE),
.MemPAdrM, .MemPAdrM,
.FinalWriteDataM, .ReadDataWordM, .DCacheStall, .FinalWriteDataM, .ReadDataWordM, .DCacheStall,
.CommittedM(DCCommittedM),
.DCacheMiss, .DCacheAccess, .IgnoreRequest, .DCacheMiss, .DCacheAccess, .IgnoreRequest,
.CacheableM(CacheableM), .CacheableM(CacheableM),
@ -475,7 +469,6 @@ module lsu
PreCntEn = 1'b0; PreCntEn = 1'b0;
LsuBusWrite = 1'b0; LsuBusWrite = 1'b0;
LsuBusRead = 1'b0; LsuBusRead = 1'b0;
CommittedMfromBus = 1'b0;
BUSACK = 1'b0; BUSACK = 1'b0;
SelUncached = 1'b0; SelUncached = 1'b0;
@ -515,7 +508,6 @@ module lsu
STATE_BUS_UNCACHED_WRITE : begin STATE_BUS_UNCACHED_WRITE : begin
BusStall = 1'b1; BusStall = 1'b1;
LsuBusWrite = 1'b1; LsuBusWrite = 1'b1;
CommittedMfromBus = 1'b1;
if(LsuBusAck) begin if(LsuBusAck) begin
BusNextState = STATE_BUS_UNCACHED_WRITE_DONE; BusNextState = STATE_BUS_UNCACHED_WRITE_DONE;
end else begin end else begin
@ -526,7 +518,6 @@ module lsu
STATE_BUS_UNCACHED_READ: begin STATE_BUS_UNCACHED_READ: begin
BusStall = 1'b1; BusStall = 1'b1;
LsuBusRead = 1'b1; LsuBusRead = 1'b1;
CommittedMfromBus = 1'b1;
if(LsuBusAck) begin if(LsuBusAck) begin
BusNextState = STATE_BUS_UNCACHED_READ_DONE; BusNextState = STATE_BUS_UNCACHED_READ_DONE;
end else begin end else begin
@ -535,12 +526,10 @@ module lsu
end end
STATE_BUS_UNCACHED_WRITE_DONE: begin STATE_BUS_UNCACHED_WRITE_DONE: begin
CommittedMfromBus = 1'b1;
BusNextState = STATE_BUS_READY; BusNextState = STATE_BUS_READY;
end end
STATE_BUS_UNCACHED_READ_DONE: begin STATE_BUS_UNCACHED_READ_DONE: begin
CommittedMfromBus = 1'b1;
SelUncached = 1'b1; SelUncached = 1'b1;
end end
@ -548,7 +537,6 @@ module lsu
BusStall = 1'b1; BusStall = 1'b1;
PreCntEn = 1'b1; PreCntEn = 1'b1;
LsuBusRead = 1'b1; LsuBusRead = 1'b1;
CommittedMfromBus = 1'b1;
if (FetchCountFlag & LsuBusAck) begin if (FetchCountFlag & LsuBusAck) begin
BusNextState = STATE_BUS_READY; BusNextState = STATE_BUS_READY;
@ -562,7 +550,6 @@ module lsu
BusStall = 1'b1; BusStall = 1'b1;
PreCntEn = 1'b1; PreCntEn = 1'b1;
LsuBusWrite = 1'b1; LsuBusWrite = 1'b1;
CommittedMfromBus = 1'b1;
if(FetchCountFlag & LsuBusAck) begin if(FetchCountFlag & LsuBusAck) begin
BusNextState = STATE_BUS_READY; BusNextState = STATE_BUS_READY;
BUSACK = 1'b1; BUSACK = 1'b1;

View File

@ -39,7 +39,7 @@ module privileged (
output logic [`XLEN-1:0] PrivilegedNextPCM, output logic [`XLEN-1:0] PrivilegedNextPCM,
output logic RetM, TrapM, output logic RetM, TrapM,
output logic ITLBFlushF, DTLBFlushM, output logic ITLBFlushF, DTLBFlushM,
input logic InstrValidM, CommittedM, input logic InstrValidM, LSUStall,
input logic FRegWriteM, LoadStallD, input logic FRegWriteM, LoadStallD,
input logic BPPredDirWrongM, input logic BPPredDirWrongM,
input logic BTBPredPCWrongM, input logic BTBPredPCWrongM,
@ -230,7 +230,7 @@ module privileged (
.PCM, .PCM,
.InstrMisalignedAdrM, .IEUAdrM, .InstrMisalignedAdrM, .IEUAdrM,
.InstrM, .InstrM,
.InstrValidM, .CommittedM, .InstrValidM, .LSUStall,
.TrapM, .MTrapM, .STrapM, .UTrapM, .RetM, .TrapM, .MTrapM, .STrapM, .UTrapM, .RetM,
.InterruptM, .InterruptM,
.ExceptionM, .ExceptionM,

View File

@ -41,7 +41,7 @@ module trap (
input logic [`XLEN-1:0] PCM, input logic [`XLEN-1:0] PCM,
input logic [`XLEN-1:0] InstrMisalignedAdrM, IEUAdrM, input logic [`XLEN-1:0] InstrMisalignedAdrM, IEUAdrM,
input logic [31:0] InstrM, input logic [31:0] InstrM,
input logic InstrValidM, CommittedM, input logic InstrValidM, LSUStall,
output logic TrapM, MTrapM, STrapM, UTrapM, RetM, output logic TrapM, MTrapM, STrapM, UTrapM, RetM,
output logic InterruptM, output logic InterruptM,
output logic ExceptionM, output logic ExceptionM,
@ -61,12 +61,12 @@ module trap (
// Determine pending enabled interrupts // Determine pending enabled interrupts
// interrupt if any sources are pending // interrupt if any sources are pending
// & with a M stage valid bit to avoid interrupts from interrupt a nonexistent flushed instruction (in the M stage) // & with a M stage valid bit to avoid interrupts from interrupt a nonexistent flushed instruction (in the M stage)
// & with ~CommittedM to make sure MEPC isn't chosen so as to rerun the same instr twice // & with ~LSUStall to make sure MEPC isn't chosen so as to rerun the same instr twice
assign MIntGlobalEnM = (PrivilegeModeW != `M_MODE) || STATUS_MIE; // if M ints enabled or lower priv 3.1.9 assign MIntGlobalEnM = (PrivilegeModeW != `M_MODE) || STATUS_MIE; // if M ints enabled or lower priv 3.1.9
assign SIntGlobalEnM = (PrivilegeModeW == `U_MODE) || ((PrivilegeModeW == `S_MODE) && STATUS_SIE); // if in lower priv mode, or if S ints enabled and not in higher priv mode 3.1.9 assign SIntGlobalEnM = (PrivilegeModeW == `U_MODE) || ((PrivilegeModeW == `S_MODE) && STATUS_SIE); // if in lower priv mode, or if S ints enabled and not in higher priv mode 3.1.9
assign PendingIntsM = ((MIP_REGW & MIE_REGW) & ({12{MIntGlobalEnM}} & 12'h888)) | ((SIP_REGW & SIE_REGW) & ({12{SIntGlobalEnM}} & 12'h222)); assign PendingIntsM = ((MIP_REGW & MIE_REGW) & ({12{MIntGlobalEnM}} & 12'h888)) | ((SIP_REGW & SIE_REGW) & ({12{SIntGlobalEnM}} & 12'h222));
assign PendingInterruptM = (|PendingIntsM) & InstrValidM; assign PendingInterruptM = (|PendingIntsM) & InstrValidM;
assign InterruptM = PendingInterruptM & ~CommittedM; assign InterruptM = PendingInterruptM & ~LSUStall; // previously CommittedM. The purpose is to delay an interrupt if the instruction in the memory stage is busy in the LSU. LSUStall directly provides this.
//assign ExceptionM = TrapM; //assign ExceptionM = TrapM;
assign ExceptionM = Exception1M; assign ExceptionM = Exception1M;
// *** as of 7/17/21, the system passes with this definition of ExceptionM as being all traps and fails if ExceptionM = Exception1M // *** as of 7/17/21, the system passes with this definition of ExceptionM as being all traps and fails if ExceptionM = Exception1M

View File

@ -125,7 +125,6 @@ module wallypipelinedhart (
(* mark_debug = "true" *) logic [`XLEN-1:0] IEUAdrM; (* mark_debug = "true" *) logic [`XLEN-1:0] IEUAdrM;
(* mark_debug = "true" *) logic [`XLEN-1:0] ReadDataM; (* mark_debug = "true" *) logic [`XLEN-1:0] ReadDataM;
logic [`XLEN-1:0] ReadDataW; logic [`XLEN-1:0] ReadDataW;
logic CommittedM;
// AHB ifu interface // AHB ifu interface
logic [`PA_BITS-1:0] InstrPAdrF; logic [`PA_BITS-1:0] InstrPAdrF;
@ -240,7 +239,7 @@ module wallypipelinedhart (
// CPU interface // CPU interface
.MemRWM, .Funct3M, .Funct7M(InstrM[31:25]), .MemRWM, .Funct3M, .Funct7M(InstrM[31:25]),
.AtomicM, .ExceptionM, .PendingInterruptM, .AtomicM, .ExceptionM, .PendingInterruptM,
.CommittedM, .DCacheMiss, .DCacheAccess, .DCacheMiss, .DCacheAccess,
.SquashSCW, .SquashSCW,
//.DataMisalignedM(DataMisalignedM), //.DataMisalignedM(DataMisalignedM),
.IEUAdrE, .IEUAdrM, .WriteDataM, .IEUAdrE, .IEUAdrM, .WriteDataM,
@ -314,7 +313,7 @@ module wallypipelinedhart (
.InstrM, .CSRReadValW, .PrivilegedNextPCM, .InstrM, .CSRReadValW, .PrivilegedNextPCM,
.RetM, .TrapM, .RetM, .TrapM,
.ITLBFlushF, .DTLBFlushM, .ITLBFlushF, .DTLBFlushM,
.InstrValidM, .CommittedM, .InstrValidM, .LSUStall,
.FRegWriteM, .LoadStallD, .FRegWriteM, .LoadStallD,
.BPPredDirWrongM, .BTBPredPCWrongM, .BPPredDirWrongM, .BTBPredPCWrongM,
.RASPredPCWrongM, .BPPredClassNonCFIWrongM, .RASPredPCWrongM, .BPPredClassNonCFIWrongM,