Changed to non-blocking in cacheLRU and removed clearing LRU bits on flush.

This commit is contained in:
Rose Thompson 2024-03-05 10:33:47 -06:00 committed by GitHub
parent 1a0097f6e7
commit e8e0538f6c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

12
src/cache/cacheLRU.sv vendored
View File

@ -143,16 +143,14 @@ module cacheLRU
// This is a two port memory.
// Every cycle must read from CacheSetData and each load/store must write the new LRU.
always_ff @(posedge clk) begin
if (reset | (InvalidateCache & ~FlushStage)) for (int set = 0; set < NUMLINES; set++) LRUMemory[set] = '0;
if (reset | (InvalidateCache & ~FlushStage)) for (int set = 0; set < NUMLINES; set++) LRUMemory[set] <= '0;
if(CacheEn) begin
if(ClearValid & ~FlushStage)
LRUMemory[PAdr] = '0;
else if(LRUWriteEn)
LRUMemory[PAdr] = NextLRU;
if(LRUWriteEn)
LRUMemory[PAdr] <= NextLRU;
if(LRUWriteEn & (PAdr == CacheSetTag))
CurrLRU = NextLRU;
CurrLRU <= NextLRU;
else
CurrLRU = LRUMemory[CacheSetTag];
CurrLRU <= LRUMemory[CacheSetTag];
end
end