summaryrefslogtreecommitdiff
path: root/src/mem/cache/tags/sector_tags.cc
diff options
context:
space:
mode:
authorDaniel R. Carvalho <odanrc@yahoo.com.br>2018-09-07 14:33:00 +0200
committerDaniel Carvalho <odanrc@yahoo.com.br>2018-10-10 18:17:42 +0000
commit8f58d9fb87c521674f11c78b8939e5ffdf851d39 (patch)
tree0c85323aba79d385befe368ac47797a27f3b8a4a /src/mem/cache/tags/sector_tags.cc
parentd204e56b2b9b8ad561fc258ebdc50ae8365159e1 (diff)
downloadgem5-8f58d9fb87c521674f11c78b8939e5ffdf851d39.tar.xz
mem-cache: Use set and way for ReplaceableEntry
Replaceable entries belong to table-like structures, and therefore they should be indexable by combining a row and a column. These, using conventional cache nomenclature translate to sets and ways. Make these entries aware of their sets and ways. The idea is to make indexing policies usable by other table-like structures. In order to do so we move sets and ways to ReplaceableEntry, which will be the common base among table entries. Change-Id: If0e3dacf9ea2f523af9cface067469ccecf82648 Reviewed-on: https://gem5-review.googlesource.com/c/12764 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/mem/cache/tags/sector_tags.cc')
-rw-r--r--src/mem/cache/tags/sector_tags.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/mem/cache/tags/sector_tags.cc b/src/mem/cache/tags/sector_tags.cc
index ef3fec2b9..90b31b64b 100644
--- a/src/mem/cache/tags/sector_tags.cc
+++ b/src/mem/cache/tags/sector_tags.cc
@@ -92,6 +92,9 @@ SectorTags::init(BaseCache* cache)
// Associate a replacement data entry to the sector
sec_blk->replacementData = replacementPolicy->instantiateEntry();
+ // Set its index
+ sec_blk->setPosition(i, j);
+
// Initialize all blocks in this sector
sec_blk->blks.resize(numBlocksPerSector);
for (unsigned k = 0; k < numBlocksPerSector; ++k){
@@ -110,9 +113,8 @@ SectorTags::init(BaseCache* cache)
// Associate the sector replacement data to this block
blk->replacementData = sec_blk->replacementData;
- // Set its set, way and sector offset
- blk->set = i;
- blk->way = j;
+ // Set its index and sector offset
+ blk->setPosition(i, j);
blk->setSectorOffset(k);
// Update block index
@@ -308,8 +310,8 @@ SectorTags::findVictim(Addr addr, const bool is_secure,
}
}
- DPRINTF(CacheRepl, "set %x, way %x, sector offset %x: %s\n",
- "selecting blk for replacement\n", victim->set, victim->way,
+ DPRINTF(CacheRepl, "set %x, way %x, sector offset %x: selecting blk " \
+ "for replacement\n", victim->getSet(), victim->getWay(),
victim->getSectorOffset());
return victim;
@@ -337,7 +339,8 @@ Addr
SectorTags::regenerateBlkAddr(const CacheBlk* blk) const
{
const SectorSubBlk* blk_cast = static_cast<const SectorSubBlk*>(blk);
- return ((blk_cast->getTag() << tagShift) | ((Addr)blk->set << setShift) |
+ const Addr set = blk_cast->getSectorBlock()->getSet() << setShift;
+ return ((blk_cast->getTag() << tagShift) | set |
((Addr)blk_cast->getSectorOffset() << sectorShift));
}