mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-01 17:34:27 +00:00
Properly flush cacheLRU.
This commit is contained in:
parent
e403800ce8
commit
3442b04f9e
2
pipelined/src/cache/cache.sv
vendored
2
pipelined/src/cache/cache.sv
vendored
@ -131,7 +131,7 @@ module cache #(parameter LINELEN, NUMLINES, NUMWAYS, LOGBWPL, WORDLEN, MUXINTE
|
|||||||
.FlushWay, .SelFlush, .ReadDataLineWay, .HitWay, .ValidWay, .VictimDirtyWay, .VictimTagWay, .FlushStage, .InvalidateCache);
|
.FlushWay, .SelFlush, .ReadDataLineWay, .HitWay, .ValidWay, .VictimDirtyWay, .VictimTagWay, .FlushStage, .InvalidateCache);
|
||||||
if(NUMWAYS > 1) begin:vict
|
if(NUMWAYS > 1) begin:vict
|
||||||
cacheLRU #(NUMWAYS, SETLEN, OFFSETLEN, NUMLINES) cacheLRU(
|
cacheLRU #(NUMWAYS, SETLEN, OFFSETLEN, NUMLINES) cacheLRU(
|
||||||
.clk, .reset, .ce, .HitWay, .ValidWay, .VictimWay, .CAdr, .LRUWriteEn(LRUWriteEn & ~FlushStage),
|
.clk, .reset, .ce, .FlushStage, .HitWay, .ValidWay, .VictimWay, .CAdr, .LRUWriteEn(LRUWriteEn & ~FlushStage),
|
||||||
.SetValid, .PAdr(PAdr[SETTOP-1:OFFSETLEN]), .InvalidateCache);
|
.SetValid, .PAdr(PAdr[SETTOP-1:OFFSETLEN]), .InvalidateCache);
|
||||||
end else assign VictimWay = 1'b1; // one hot.
|
end else assign VictimWay = 1'b1; // one hot.
|
||||||
assign CacheHit = | HitWay;
|
assign CacheHit = | HitWay;
|
||||||
|
6
pipelined/src/cache/cacheLRU.sv
vendored
6
pipelined/src/cache/cacheLRU.sv
vendored
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
module cacheLRU
|
module cacheLRU
|
||||||
#(parameter NUMWAYS = 4, SETLEN = 9, OFFSETLEN = 5, NUMLINES = 128)(
|
#(parameter NUMWAYS = 4, SETLEN = 9, OFFSETLEN = 5, NUMLINES = 128)(
|
||||||
input logic clk, reset, ce,
|
input logic clk, reset, ce, FlushStage,
|
||||||
input logic [NUMWAYS-1:0] HitWay,
|
input logic [NUMWAYS-1:0] HitWay,
|
||||||
input logic [NUMWAYS-1:0] ValidWay,
|
input logic [NUMWAYS-1:0] ValidWay,
|
||||||
output logic [NUMWAYS-1:0] VictimWay,
|
output logic [NUMWAYS-1:0] VictimWay,
|
||||||
@ -121,8 +121,8 @@ module cacheLRU
|
|||||||
always_ff @(posedge clk) begin
|
always_ff @(posedge clk) begin
|
||||||
if (reset) for (int set = 0; set < NUMLINES; set++) LRUMemory[set] <= '0;
|
if (reset) for (int set = 0; set < NUMLINES; set++) LRUMemory[set] <= '0;
|
||||||
if(ce) begin
|
if(ce) begin
|
||||||
if(InvalidateCache) for (int set = 0; set < NUMLINES; set++) LRUMemory[set] <= '0;
|
if(InvalidateCache & ~FlushStage) for (int set = 0; set < NUMLINES; set++) LRUMemory[set] <= '0;
|
||||||
else if (LRUWriteEn) begin
|
else if (LRUWriteEn & ~FlushStage) begin
|
||||||
LRUMemory[PAdr] <= NextLRU;
|
LRUMemory[PAdr] <= NextLRU;
|
||||||
CurrLRU <= #1 NextLRU;
|
CurrLRU <= #1 NextLRU;
|
||||||
end else begin
|
end else begin
|
||||||
|
Loading…
Reference in New Issue
Block a user