summaryrefslogtreecommitdiff
path: root/src/mem/cache/cache_impl.hh
diff options
context:
space:
mode:
authorDavid Guillen-Fandos <david.guillen@arm.com>2015-07-30 03:41:42 -0400
committerDavid Guillen-Fandos <david.guillen@arm.com>2015-07-30 03:41:42 -0400
commit0c89c15b23d4db50eb08f8ebf2a40b569f41dd29 (patch)
tree9f5e2bcf48d88e940b9fea6b2fa9f37d05ea2741 /src/mem/cache/cache_impl.hh
parent5a18e181ffb8fbef5f4aca8fb9a63ee6a7c9e0d6 (diff)
downloadgem5-0c89c15b23d4db50eb08f8ebf2a40b569f41dd29.tar.xz
mem: Make caches way aware
This patch makes cache sets aware of the way number. This enables some nice features such as the ablity to restrict way allocation. The implemented mechanism allows to set a maximum way number to be allocated 'k' which must fulfill 0 < k <= N (where N is the number of ways). In the future more sophisticated mechasims can be implemented.
Diffstat (limited to 'src/mem/cache/cache_impl.hh')
-rw-r--r--src/mem/cache/cache_impl.hh4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mem/cache/cache_impl.hh b/src/mem/cache/cache_impl.hh
index 040b49464..4c602478f 100644
--- a/src/mem/cache/cache_impl.hh
+++ b/src/mem/cache/cache_impl.hh
@@ -1581,6 +1581,10 @@ Cache::allocateBlock(Addr addr, bool is_secure, PacketList &writebacks)
{
CacheBlk *blk = tags->findVictim(addr);
+ // It is valid to return NULL if there is no victim
+ if (!blk)
+ return nullptr;
+
if (blk->isValid()) {
Addr repl_addr = tags->regenerateBlkAddr(blk->tag, blk->set);
MSHR *repl_mshr = mshrQueue.findMatch(repl_addr, blk->isSecure());