mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-03 02:05:21 +00:00
More cache simplifications.
This commit is contained in:
parent
08549446ef
commit
337903d8dd
13
src/cache/cache.sv
vendored
13
src/cache/cache.sv
vendored
@ -98,8 +98,6 @@ module cache import cvw::*; #(parameter cvw_t P,
|
|||||||
logic SelWay;
|
logic SelWay;
|
||||||
logic [LINELEN/8-1:0] LineByteMask;
|
logic [LINELEN/8-1:0] LineByteMask;
|
||||||
logic [$clog2(LINELEN/8) - $clog2(MUXINTERVAL/8) - 1:0] WordOffsetAddr;
|
logic [$clog2(LINELEN/8) - $clog2(MUXINTERVAL/8) - 1:0] WordOffsetAddr;
|
||||||
logic ZeroCacheLine;
|
|
||||||
logic [LINELEN-1:0] PreLineWriteData;
|
|
||||||
genvar index;
|
genvar index;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -161,11 +159,6 @@ module cache import cvw::*; #(parameter cvw_t P,
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Write Path
|
// Write Path
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
if(P.ZICBOZ_SUPPORTED) begin : cboz_supported
|
|
||||||
mux2 #(LINELEN) WriteDataMux(FetchBuffer, '0, ZeroCacheLine, PreLineWriteData);
|
|
||||||
end else begin
|
|
||||||
assign PreLineWriteData = FetchBuffer;
|
|
||||||
end
|
|
||||||
if(!READ_ONLY_CACHE) begin:WriteSelLogic
|
if(!READ_ONLY_CACHE) begin:WriteSelLogic
|
||||||
logic [LINELEN/8-1:0] DemuxedByteMask, FetchBufferByteSel;
|
logic [LINELEN/8-1:0] DemuxedByteMask, FetchBufferByteSel;
|
||||||
|
|
||||||
@ -185,14 +178,14 @@ module cache import cvw::*; #(parameter cvw_t P,
|
|||||||
// Merge write data into fetched cache line for store miss
|
// Merge write data into fetched cache line for store miss
|
||||||
for(index = 0; index < LINELEN/8; index++) begin
|
for(index = 0; index < LINELEN/8; index++) begin
|
||||||
mux2 #(8) WriteDataMux(.d0(CacheWriteData[(8*index)%WORDLEN+7:(8*index)%WORDLEN]),
|
mux2 #(8) WriteDataMux(.d0(CacheWriteData[(8*index)%WORDLEN+7:(8*index)%WORDLEN]),
|
||||||
.d1(PreLineWriteData[8*index+7:8*index]), .s(FetchBufferByteSel[index] | ZeroCacheLine), .y(LineWriteData[8*index+7:8*index]));
|
.d1(FetchBuffer[8*index+7:8*index]), .s(FetchBufferByteSel[index] & ~CMOp[3]), .y(LineWriteData[8*index+7:8*index]));
|
||||||
end
|
end
|
||||||
assign LineByteMask = SetValid ? '1 : SetDirty ? DemuxedByteMask : '0;
|
assign LineByteMask = SetValid ? '1 : SetDirty ? DemuxedByteMask : '0;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin:WriteSelLogic
|
begin:WriteSelLogic
|
||||||
// No need for this mux if the cache does not handle writes.
|
// No need for this mux if the cache does not handle writes.
|
||||||
assign LineWriteData = PreLineWriteData;
|
assign LineWriteData = FetchBuffer;
|
||||||
assign LineByteMask = '1;
|
assign LineByteMask = '1;
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -227,7 +220,7 @@ module cache import cvw::*; #(parameter cvw_t P,
|
|||||||
.FlushStage, .CacheRW, .Stall,
|
.FlushStage, .CacheRW, .Stall,
|
||||||
.CacheHit, .LineDirty, .CacheStall, .CacheCommitted,
|
.CacheHit, .LineDirty, .CacheStall, .CacheCommitted,
|
||||||
.CacheMiss, .CacheAccess, .SelAdr, .SelWay,
|
.CacheMiss, .CacheAccess, .SelAdr, .SelWay,
|
||||||
.ClearDirty, .SetDirty, .SetValid, .ClearValid, .ZeroCacheLine, .SelWriteback, .SelFlush,
|
.ClearDirty, .SetDirty, .SetValid, .ClearValid, .SelWriteback, .SelFlush,
|
||||||
.FlushAdrCntEn, .FlushWayCntEn, .FlushCntRst,
|
.FlushAdrCntEn, .FlushWayCntEn, .FlushCntRst,
|
||||||
.FlushAdrFlag, .FlushWayFlag, .FlushCache, .SelFetchBuffer,
|
.FlushAdrFlag, .FlushWayFlag, .FlushCache, .SelFetchBuffer,
|
||||||
.InvalidateCache, .CMOp, .CacheEn, .LRUWriteEn);
|
.InvalidateCache, .CMOp, .CacheEn, .LRUWriteEn);
|
||||||
|
3
src/cache/cachefsm.sv
vendored
3
src/cache/cachefsm.sv
vendored
@ -58,7 +58,6 @@ module cachefsm import cvw::*; #(parameter cvw_t P,
|
|||||||
output logic ClearValid, // Clear the valid bit in the selected way and set
|
output logic ClearValid, // Clear the valid bit in the selected way and set
|
||||||
output logic SetDirty, // Set the dirty bit in the selected way and set
|
output logic SetDirty, // Set the dirty bit in the selected way and set
|
||||||
output logic ClearDirty, // Clear the dirty bit in the selected way and set
|
output logic ClearDirty, // Clear the dirty bit in the selected way and set
|
||||||
output logic ZeroCacheLine, // Write zeros to all bytes of cacheline
|
|
||||||
output logic SelWriteback, // Overrides cached tag check to select a specific way and set for writeback
|
output logic SelWriteback, // Overrides cached tag check to select a specific way and set for writeback
|
||||||
output logic LRUWriteEn, // Update the LRU state
|
output logic LRUWriteEn, // Update the LRU state
|
||||||
output logic SelFlush, // [0] Use SelAdr, [1] SRAM reads/writes from FlushAdr
|
output logic SelFlush, // [0] Use SelAdr, [1] SRAM reads/writes from FlushAdr
|
||||||
@ -174,8 +173,6 @@ module cachefsm import cvw::*; #(parameter cvw_t P,
|
|||||||
assign SelWay = (CurrState == STATE_WRITEBACK & ((~CacheBusAck & ~(CMOp[1] | CMOp[2])) | (P.ZICBOZ_SUPPORTED & CacheBusAck & CMOp[3]))) |
|
assign SelWay = (CurrState == STATE_WRITEBACK & ((~CacheBusAck & ~(CMOp[1] | CMOp[2])) | (P.ZICBOZ_SUPPORTED & CacheBusAck & CMOp[3]))) |
|
||||||
(CurrState == STATE_READY & ((AnyMiss & LineDirty) | (P.ZICBOZ_SUPPORTED & CMOZeroNoEviction & ~CacheHit))) |
|
(CurrState == STATE_READY & ((AnyMiss & LineDirty) | (P.ZICBOZ_SUPPORTED & CMOZeroNoEviction & ~CacheHit))) |
|
||||||
(CurrState == STATE_WRITE_LINE);
|
(CurrState == STATE_WRITE_LINE);
|
||||||
assign ZeroCacheLine = P.ZICBOZ_SUPPORTED & ((CurrState == STATE_READY & CMOZeroNoEviction) |
|
|
||||||
(CurrState == STATE_WRITEBACK & (CMOp[3] & CacheBusAck)));
|
|
||||||
assign SelWriteback = (CurrState == STATE_WRITEBACK & (CMOp[1] | CMOp[2] | ~CacheBusAck)) |
|
assign SelWriteback = (CurrState == STATE_WRITEBACK & (CMOp[1] | CMOp[2] | ~CacheBusAck)) |
|
||||||
(CurrState == STATE_READY & AnyMiss & LineDirty);
|
(CurrState == STATE_READY & AnyMiss & LineDirty);
|
||||||
assign SelFlush = (CurrState == STATE_READY & FlushCache) |
|
assign SelFlush = (CurrState == STATE_READY & FlushCache) |
|
||||||
|
@ -148,7 +148,8 @@ module lsu import cvw::*; #(parameter cvw_t P) (
|
|||||||
logic IgnoreRequestTLB; // On either ITLB or DTLB miss, ignore miss so HPTW can handle
|
logic IgnoreRequestTLB; // On either ITLB or DTLB miss, ignore miss so HPTW can handle
|
||||||
logic IgnoreRequest; // On FlushM or TLB miss ignore memory operation
|
logic IgnoreRequest; // On FlushM or TLB miss ignore memory operation
|
||||||
logic SelDTIM; // Select DTIM rather than bus or D$
|
logic SelDTIM; // Select DTIM rather than bus or D$
|
||||||
|
logic [P.XLEN-1:0] WriteDataZM;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Pipeline for IEUAdr E to M
|
// Pipeline for IEUAdr E to M
|
||||||
// Zero-extend address to 34 bits for XLEN=32
|
// Zero-extend address to 34 bits for XLEN=32
|
||||||
@ -176,6 +177,12 @@ module lsu import cvw::*; #(parameter cvw_t P) (
|
|||||||
assign {SpillStallM, SelStoreDelay} = '0;
|
assign {SpillStallM, SelStoreDelay} = '0;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if(P.ZICBOZ_SUPPORTED) begin : cboz
|
||||||
|
mux2 #(P.XLEN) writedatacbozmux(WriteDataM, '0, CMOpM[3], WriteDataZM);
|
||||||
|
end else begin : cboz
|
||||||
|
assign WriteDataZM = WriteDataM;
|
||||||
|
end
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// HPTW (only needed if VM supported)
|
// HPTW (only needed if VM supported)
|
||||||
// MMU include PMP and is needed if any privileged supported
|
// MMU include PMP and is needed if any privileged supported
|
||||||
@ -187,7 +194,7 @@ module lsu import cvw::*; #(parameter cvw_t P) (
|
|||||||
.FlushW, .DCacheStallM, .SATP_REGW, .PCSpillF,
|
.FlushW, .DCacheStallM, .SATP_REGW, .PCSpillF,
|
||||||
.STATUS_MXR, .STATUS_SUM, .STATUS_MPRV, .STATUS_MPP, .ENVCFG_HADE, .PrivilegeModeW,
|
.STATUS_MXR, .STATUS_SUM, .STATUS_MPRV, .STATUS_MPP, .ENVCFG_HADE, .PrivilegeModeW,
|
||||||
.ReadDataM(ReadDataM[P.XLEN-1:0]), // ReadDataM is LLEN, but HPTW only needs XLEN
|
.ReadDataM(ReadDataM[P.XLEN-1:0]), // ReadDataM is LLEN, but HPTW only needs XLEN
|
||||||
.WriteDataM, .Funct3M, .LSUFunct3M, .Funct7M, .LSUFunct7M,
|
.WriteDataM(WriteDataZM), .Funct3M, .LSUFunct3M, .Funct7M, .LSUFunct7M,
|
||||||
.IEUAdrExtM, .PTE, .IHWriteDataM, .PageType, .PreLSURWM, .LSUAtomicM,
|
.IEUAdrExtM, .PTE, .IHWriteDataM, .PageType, .PreLSURWM, .LSUAtomicM,
|
||||||
.IHAdrM, .HPTWStall, .SelHPTW,
|
.IHAdrM, .HPTWStall, .SelHPTW,
|
||||||
.IgnoreRequestTLB, .LSULoadAccessFaultM, .LSUStoreAmoAccessFaultM,
|
.IgnoreRequestTLB, .LSULoadAccessFaultM, .LSUStoreAmoAccessFaultM,
|
||||||
@ -198,7 +205,7 @@ module lsu import cvw::*; #(parameter cvw_t P) (
|
|||||||
assign LSUFunct3M = Funct3M;
|
assign LSUFunct3M = Funct3M;
|
||||||
assign LSUFunct7M = Funct7M;
|
assign LSUFunct7M = Funct7M;
|
||||||
assign LSUAtomicM = AtomicM;
|
assign LSUAtomicM = AtomicM;
|
||||||
assign IHWriteDataM = WriteDataM;
|
assign IHWriteDataM = WriteDataZM;
|
||||||
assign LoadAccessFaultM = LSULoadAccessFaultM;
|
assign LoadAccessFaultM = LSULoadAccessFaultM;
|
||||||
assign StoreAmoAccessFaultM = LSUStoreAmoAccessFaultM;
|
assign StoreAmoAccessFaultM = LSUStoreAmoAccessFaultM;
|
||||||
assign {HPTWStall, SelHPTW, PTE, PageType, DTLBWriteM, ITLBWriteF, IgnoreRequestTLB} = '0;
|
assign {HPTWStall, SelHPTW, PTE, PageType, DTLBWriteM, ITLBWriteF, IgnoreRequestTLB} = '0;
|
||||||
|
Loading…
Reference in New Issue
Block a user