summaryrefslogtreecommitdiff
path: root/src/mem/cache/tags/base_set_assoc.cc
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/tags/base_set_assoc.cc
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/tags/base_set_assoc.cc')
-rw-r--r--src/mem/cache/tags/base_set_assoc.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mem/cache/tags/base_set_assoc.cc b/src/mem/cache/tags/base_set_assoc.cc
index c5ef9cc4b..8c48337bc 100644
--- a/src/mem/cache/tags/base_set_assoc.cc
+++ b/src/mem/cache/tags/base_set_assoc.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2013 ARM Limited
+ * Copyright (c) 2012-2014 ARM Limited
* All rights reserved.
*
* The license below extends only to copyright in the software and shall
@@ -54,7 +54,7 @@
using namespace std;
BaseSetAssoc::BaseSetAssoc(const Params *p)
- :BaseTags(p), assoc(p->assoc),
+ :BaseTags(p), assoc(p->assoc), allocAssoc(p->assoc),
numSets(p->size / (p->block_size * p->assoc)),
sequentialAccess(p->sequential_access)
{
@@ -108,6 +108,7 @@ BaseSetAssoc::BaseSetAssoc(const Params *p)
blk->size = blkSize;
sets[i].blks[j]=blk;
blk->set = i;
+ blk->way = j;
}
}
}
@@ -128,6 +129,12 @@ BaseSetAssoc::findBlock(Addr addr, bool is_secure) const
return blk;
}
+CacheBlk*
+BaseSetAssoc::findBlockBySetAndWay(int set, int way) const
+{
+ return sets[set].blks[way];
+}
+
void
BaseSetAssoc::clearLocks()
{