mem-cache: Add match functions to QueueEntry
Having the caller decide the matching logic is error-prone, and frequently ends up with the secure bit being forgotten. This change adds matching functions to the QueueEntry to avoid this problem. As a side effect the signature of findPending has been changed. Change-Id: I6e494a821c1e6e841ab103ec69632c0e1b269a08 Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17530 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
This commit is contained in:
committed by
Daniel Carvalho
parent
d4cee4dc66
commit
2d84dc46ba
24
src/mem/cache/write_queue_entry.cc
vendored
24
src/mem/cache/write_queue_entry.cc
vendored
@@ -112,6 +112,9 @@ WriteQueueEntry::allocate(Addr blk_addr, unsigned blk_size, PacketPtr target,
|
||||
"a cacheable eviction or a writeclean");
|
||||
|
||||
targets.add(target, when_ready, _order);
|
||||
|
||||
// All targets must refer to the same block
|
||||
assert(target->matchBlockAddr(targets.front().pkt, blkSize));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -141,6 +144,27 @@ WriteQueueEntry::sendPacket(BaseCache &cache)
|
||||
return cache.sendWriteQueuePacket(this);
|
||||
}
|
||||
|
||||
bool
|
||||
WriteQueueEntry::matchBlockAddr(const Addr addr, const bool is_secure) const
|
||||
{
|
||||
assert(hasTargets());
|
||||
return (blkAddr == addr) && (isSecure == is_secure);
|
||||
}
|
||||
|
||||
bool
|
||||
WriteQueueEntry::matchBlockAddr(const PacketPtr pkt) const
|
||||
{
|
||||
assert(hasTargets());
|
||||
return pkt->matchBlockAddr(blkAddr, isSecure, blkSize);
|
||||
}
|
||||
|
||||
bool
|
||||
WriteQueueEntry::conflictAddr(const QueueEntry* entry) const
|
||||
{
|
||||
assert(hasTargets());
|
||||
return entry->matchBlockAddr(blkAddr, isSecure);
|
||||
}
|
||||
|
||||
void
|
||||
WriteQueueEntry::print(std::ostream &os, int verbosity,
|
||||
const std::string &prefix) const
|
||||
|
||||
Reference in New Issue
Block a user