Clean up of cachefsm.

This commit is contained in:
Ross Thompson 2022-01-06 16:32:49 -06:00
parent 3bfe23bc75
commit e0740034f0
2 changed files with 7 additions and 15 deletions

View File

@ -243,15 +243,8 @@ module cache #(parameter integer LINELEN,
assign FlushAdrFlag = FlushAdr == FlushAdrThreshold[INDEXLEN-1:0]; assign FlushAdrFlag = FlushAdr == FlushAdrThreshold[INDEXLEN-1:0];
assign FlushWayFlag = FlushWay[NUMWAYS-1]; assign FlushWayFlag = FlushWay[NUMWAYS-1];
// controller
// *** fixme
logic CacheableM;
assign CacheableM = 1;
cachefsm cachefsm(.clk, .reset, .CacheFetchLine, .CacheWriteLine, .CacheBusAck, cachefsm cachefsm(.clk, .reset, .CacheFetchLine, .CacheWriteLine, .CacheBusAck,
.RW, .Atomic, .CPUBusy, .CacheableM, .IgnoreRequest, .RW, .Atomic, .CPUBusy, .IgnoreRequest,
.CacheHit, .VictimDirty, .CacheStall, .CacheCommitted, .CacheHit, .VictimDirty, .CacheStall, .CacheCommitted,
.CacheMiss, .CacheAccess, .SelAdr, .SetValid, .CacheMiss, .CacheAccess, .SelAdr, .SetValid,
.ClearValid, .SetDirty, .ClearDirty, .SRAMWordWriteEnable, .ClearValid, .SetDirty, .ClearDirty, .SRAMWordWriteEnable,

View File

@ -34,7 +34,6 @@ module cachefsm
input logic FlushCache, input logic FlushCache,
// hazard inputs // hazard inputs
input logic CPUBusy, input logic CPUBusy,
input logic CacheableM,
// interlock fsm // interlock fsm
input logic IgnoreRequest, input logic IgnoreRequest,
// Bus inputs // Bus inputs
@ -100,8 +99,8 @@ module cachefsm
assign AnyCPUReqM = |RW | (|Atomic); assign AnyCPUReqM = |RW | (|Atomic);
// outputs for the performance counters. // outputs for the performance counters.
assign CacheAccess = AnyCPUReqM & CacheableM & CurrState == STATE_READY; assign CacheAccess = AnyCPUReqM & CurrState == STATE_READY;
assign CacheMiss = CacheAccess & CacheableM & ~CacheHit; assign CacheMiss = CacheAccess & ~CacheHit;
always_ff @(posedge clk) always_ff @(posedge clk)
if (reset) CurrState <= #1 STATE_READY; if (reset) CurrState <= #1 STATE_READY;
@ -159,7 +158,7 @@ module cachefsm
end end
// amo hit // amo hit
else if(Atomic[1] & (&RW) & CacheableM & CacheHit) begin else if(Atomic[1] & (&RW) & CacheHit) begin
SelAdr = 2'b01; SelAdr = 2'b01;
CacheStall = 1'b0; CacheStall = 1'b0;
@ -175,7 +174,7 @@ module cachefsm
end end
end end
// read hit valid cached // read hit valid cached
else if(RW[1] & CacheableM & CacheHit) begin else if(RW[1] & CacheHit) begin
CacheStall = 1'b0; CacheStall = 1'b0;
LRUWriteEn = 1'b1; LRUWriteEn = 1'b1;
@ -188,7 +187,7 @@ module cachefsm
end end
end end
// write hit valid cached // write hit valid cached
else if (RW[0] & CacheableM & CacheHit) begin else if (RW[0] & CacheHit) begin
SelAdr = 2'b01; SelAdr = 2'b01;
CacheStall = 1'b0; CacheStall = 1'b0;
SRAMWordWriteEnable = 1'b1; SRAMWordWriteEnable = 1'b1;
@ -204,7 +203,7 @@ module cachefsm
end end
end end
// read or write miss valid cached // read or write miss valid cached
else if((|RW) & CacheableM & ~CacheHit) begin else if((|RW) & ~CacheHit) begin
NextState = STATE_MISS_FETCH_WDV; NextState = STATE_MISS_FETCH_WDV;
CacheStall = 1'b1; CacheStall = 1'b1;
CacheFetchLine = 1'b1; CacheFetchLine = 1'b1;