Skewed caches need to know the way to regenerate a block address.
Change-Id: I62c61ac9509eff2f37bad36862751956db7a6e40
Reviewed-on: https://gem5-review.googlesource.com/8782
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
writebacks[Request::wbMasterId]++;
- Request *req = new Request(tags->regenerateBlkAddr(blk->tag, blk->set),
- blkSize, 0, Request::wbMasterId);
+ Request *req = new Request(tags->regenerateBlkAddr(blk), blkSize, 0,
+ Request::wbMasterId);
if (blk->isSecure())
req->setFlags(Request::SECURE);
PacketPtr
Cache::writecleanBlk(CacheBlk *blk, Request::Flags dest, PacketId id)
{
- Request *req = new Request(tags->regenerateBlkAddr(blk->tag, blk->set),
- blkSize, 0, Request::wbMasterId);
+ Request *req = new Request(tags->regenerateBlkAddr(blk), blkSize, 0,
+ Request::wbMasterId);
if (blk->isSecure()) {
req->setFlags(Request::SECURE);
}
assert(blk && blk->isValid() && !blk->isDirty());
// Creating a zero sized write, a message to the snoop filter
Request *req =
- new Request(tags->regenerateBlkAddr(blk->tag, blk->set), blkSize, 0,
+ new Request(tags->regenerateBlkAddr(blk), blkSize, 0,
Request::wbMasterId);
if (blk->isSecure())
req->setFlags(Request::SECURE);
if (blk.isDirty()) {
assert(blk.isValid());
- Request request(tags->regenerateBlkAddr(blk.tag, blk.set),
- blkSize, 0, Request::funcMasterId);
+ Request request(tags->regenerateBlkAddr(&blk), blkSize, 0,
+ Request::funcMasterId);
request.taskId(blk.task_id);
if (blk.isSecure()) {
request.setFlags(Request::SECURE);
return nullptr;
if (blk->isValid()) {
- Addr repl_addr = tags->regenerateBlkAddr(blk->tag, blk->set);
+ Addr repl_addr = tags->regenerateBlkAddr(blk);
MSHR *repl_mshr = mshrQueue.findMatch(repl_addr, blk->isSecure());
if (repl_mshr) {
// must be an outstanding upgrade request
virtual void insertBlock(PacketPtr pkt, CacheBlk *blk) = 0;
- virtual Addr regenerateBlkAddr(Addr tag, unsigned set) const = 0;
+ /**
+ * Regenerate the block address.
+ *
+ * @param block The block.
+ * @return the block address.
+ */
+ virtual Addr regenerateBlkAddr(const CacheBlk* blk) const = 0;
virtual CacheBlk* findVictim(Addr addr) = 0;
}
/**
- * Regenerate the block address from the tag.
- * @param tag The tag of the block.
- * @param set The set of the block.
- * @return The block address.
+ * Regenerate the block address from the tag and set.
+ *
+ * @param block The block.
+ * @return the block address.
*/
- Addr regenerateBlkAddr(Addr tag, unsigned set) const override
+ Addr regenerateBlkAddr(const CacheBlk* blk) const override
{
- return ((tag << tagShift) | ((Addr)set << setShift));
+ return ((blk->tag << tagShift) | ((Addr)blk->set << setShift));
}
/**
}
/**
- * Regenerate the block address from the tag and the set.
- * @param tag The tag of the block.
- * @param set The set the block belongs to.
+ * Regenerate the block address from the tag.
+ *
+ * @param block The block.
* @return the block address.
*/
- Addr regenerateBlkAddr(Addr tag, unsigned set) const override
+ Addr regenerateBlkAddr(const CacheBlk* blk) const override
{
- return (tag);
+ return blk->tag;
}
/**
// move this block to head of the MRU list
sets[blk->set].moveToHead(blk);
DPRINTF(CacheRepl, "set %x: moving blk %x (%s) to MRU\n",
- blk->set, regenerateBlkAddr(blk->tag, blk->set),
+ blk->set, regenerateBlkAddr(blk),
is_secure ? "s" : "ns");
}
if (blk && blk->isValid()) {
DPRINTF(CacheRepl, "set %x: selecting blk %x for replacement\n",
- set, regenerateBlkAddr(blk->tag, set));
+ set, regenerateBlkAddr(blk));
}
return blk;
assert(blk->way < allocAssoc);
DPRINTF(CacheRepl, "set %x: selecting blk %x for replacement\n",
- blk->set, regenerateBlkAddr(blk->tag, blk->set));
+ blk->set, regenerateBlkAddr(blk));
}
return blk;