Fix LFU implementation
While at it make some alignment changes.
This commit is contained in:
parent
5af8a0c2af
commit
bfcc9d4080
1 changed files with 29 additions and 28 deletions
7
src/mem/cache/tags/lfu.cc
vendored
7
src/mem/cache/tags/lfu.cc
vendored
|
@ -29,9 +29,11 @@ LFU::accessBlock(Addr addr, bool is_secure, Cycles &lat, int master_id)
|
||||||
CacheBlk*
|
CacheBlk*
|
||||||
LFU::findVictim(Addr addr)
|
LFU::findVictim(Addr addr)
|
||||||
{
|
{
|
||||||
int set = extractSet(addr);
|
CacheBlk *blk = BaseSetAssoc::findVictim(addr);
|
||||||
int minimum;
|
unsigned set = extractSet(addr);
|
||||||
|
unsigned minimum;
|
||||||
|
|
||||||
|
if (blk && blk->isValid()) {
|
||||||
BlkType *blk = nullptr;
|
BlkType *blk = nullptr;
|
||||||
for (int i = 0; i < allocAssoc; ++i) {
|
for (int i = 0; i < allocAssoc; ++i) {
|
||||||
BlkType *b = sets[set].blks[i];
|
BlkType *b = sets[set].blks[i];
|
||||||
|
@ -46,7 +48,6 @@ LFU::findVictim(Addr addr)
|
||||||
}
|
}
|
||||||
assert(!blk || blk->way < allocAssoc);
|
assert(!blk || blk->way < allocAssoc);
|
||||||
|
|
||||||
if (blk && blk->isValid()) {
|
|
||||||
DPRINTF(CacheRepl,
|
DPRINTF(CacheRepl,
|
||||||
"set %x: selecting blk %x for replacement\n",
|
"set %x: selecting blk %x for replacement\n",
|
||||||
set, regenerateBlkAddr(blk->tag, set));
|
set, regenerateBlkAddr(blk->tag, set));
|
||||||
|
|
Loading…
Reference in a new issue