mem-cache: Use CacheBlk parameter on address regeneration

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>
This commit is contained in:
Daniel R. Carvalho
2018-03-06 11:48:21 +01:00
committed by Daniel Carvalho
parent a883aef55f
commit ee16a95ec8
6 changed files with 29 additions and 23 deletions

View File

@@ -1659,8 +1659,8 @@ Cache::writebackBlk(CacheBlk *blk)
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);
@@ -1694,8 +1694,8 @@ Cache::writebackBlk(CacheBlk *blk)
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);
}
@@ -1737,7 +1737,7 @@ Cache::cleanEvictBlk(CacheBlk *blk)
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);
@@ -1780,8 +1780,8 @@ Cache::writebackVisitor(CacheBlk &blk)
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);
@@ -1823,7 +1823,7 @@ Cache::allocateBlock(Addr addr, bool is_secure, PacketList &writebacks)
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

View File

@@ -255,7 +255,13 @@ class BaseTags : public ClockedObject
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;

View File

@@ -301,14 +301,14 @@ public:
}
/**
* 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));
}
/**

View File

@@ -242,14 +242,14 @@ public:
}
/**
* 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;
}
/**

View File

@@ -64,7 +64,7 @@ LRU::accessBlock(Addr addr, bool is_secure, Cycles &lat)
// 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");
}
@@ -88,7 +88,7 @@ LRU::findVictim(Addr addr)
if (blk && blk->isValid()) {
DPRINTF(CacheRepl, "set %x: selecting blk %x for replacement\n",
set, regenerateBlkAddr(blk->tag, set));
set, regenerateBlkAddr(blk));
}
return blk;

View File

@@ -86,7 +86,7 @@ RandomRepl::findVictim(Addr addr)
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;