Fixed bug with the itlb fault not dcache ptw ready state to ready state.

This commit is contained in:
Ross Thompson 2021-07-22 14:04:56 -05:00
parent b4029a2848
commit 9c90b4bdf7
2 changed files with 7 additions and 6 deletions

View File

@ -40,7 +40,7 @@ module dcache
input logic [1:0] AtomicM, input logic [1:0] AtomicM,
input logic [11:0] MemAdrE, // virtual address, but we only use the lower 12 bits. input logic [11:0] MemAdrE, // virtual address, but we only use the lower 12 bits.
input logic [`PA_BITS-1:0] MemPAdrM, // physical address input logic [`PA_BITS-1:0] MemPAdrM, // physical address
input logic [11:0] VAdr, // when hptw writes dtlb we use this address to index SRAM. input logic [11:0] VAdr, // when hptw writes dtlb we use this address to index SRAM.
input logic [`XLEN-1:0] WriteDataM, input logic [`XLEN-1:0] WriteDataM,
output logic [`XLEN-1:0] ReadDataW, output logic [`XLEN-1:0] ReadDataW,
@ -56,7 +56,8 @@ module dcache
input logic DTLBMissM, input logic DTLBMissM,
input logic CacheableM, input logic CacheableM,
input logic DTLBWriteM, input logic DTLBWriteM,
input logic ITLBWriteF, input logic ITLBWriteF,
input logic WalkerInstrPageFaultF,
// from ptw // from ptw
input logic SelPTW, input logic SelPTW,
input logic WalkerPageFaultM, input logic WalkerPageFaultM,
@ -378,14 +379,13 @@ module dcache
end end
endgenerate endgenerate
// *** Coding style. this is just awful. The purpose is to align FetchCount to the
// size of XLEN so we can fetch XLEN bits. FetchCount needs to be padded to PA_BITS length.
// *** optimize this
mux2 #(`PA_BITS) BaseAdrMux(.d0(MemPAdrM), mux2 #(`PA_BITS) BaseAdrMux(.d0(MemPAdrM),
.d1({VictimTag, MemPAdrM[INDEXLEN+OFFSETLEN-1:OFFSETLEN], {{OFFSETLEN}{1'b0}}}), .d1({VictimTag, MemPAdrM[INDEXLEN+OFFSETLEN-1:OFFSETLEN], {{OFFSETLEN}{1'b0}}}),
.s(SelEvict), .s(SelEvict),
.y(BasePAdrM)); .y(BasePAdrM));
// if not cacheable the offset bits needs to be sent to the EBU.
// if cacheable the offset bits are discarded. $ FSM will fetch the whole block.
assign BasePAdrOffsetM = CacheableM ? {{OFFSETLEN}{1'b0}} : BasePAdrM[OFFSETLEN-1:0]; assign BasePAdrOffsetM = CacheableM ? {{OFFSETLEN}{1'b0}} : BasePAdrM[OFFSETLEN-1:0];
assign BasePAdrMaskedM = {BasePAdrM[`PA_BITS-1:OFFSETLEN], BasePAdrOffsetM}; assign BasePAdrMaskedM = {BasePAdrM[`PA_BITS-1:OFFSETLEN], BasePAdrOffsetM};
@ -662,7 +662,7 @@ module dcache
// now all output connect to PTW instead of CPU. // now all output connect to PTW instead of CPU.
CommittedM = 1'b1; CommittedM = 1'b1;
if (ITLBWriteF) begin if (ITLBWriteF | WalkerInstrPageFaultF) begin
NextState = STATE_READY; NextState = STATE_READY;
end end

View File

@ -319,6 +319,7 @@ module lsu
.ITLBWriteF(ITLBWriteF), .ITLBWriteF(ITLBWriteF),
.SelPTW(SelPTW), .SelPTW(SelPTW),
.WalkerPageFaultM(WalkerPageFaultM), .WalkerPageFaultM(WalkerPageFaultM),
.WalkerInstrPageFaultF(WalkerInstrPageFaultF),
// AHB connection // AHB connection
.AHBPAdr(DCtoAHBPAdrM), .AHBPAdr(DCtoAHBPAdrM),