Fix LFU implementation

While at it make some alignment changes.
This commit is contained in:
Sanchayan Maity 2017-04-05 23:44:23 +05:30
parent 5af8a0c2af
commit bfcc9d4080

View file

@ -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));