summaryrefslogtreecommitdiff
path: root/src/mem/cache/tags/Tags.py
diff options
context:
space:
mode:
authorAnthony Gutierrez <atgutier@umich.edu>2014-07-28 12:23:23 -0400
committerAnthony Gutierrez <atgutier@umich.edu>2014-07-28 12:23:23 -0400
commita628afedade8d7b7cab108a81e714fc2755b4af3 (patch)
tree82ed5c90e74e3e3e0038e418c1281517ea55f62e /src/mem/cache/tags/Tags.py
parent0ac462459522771c7836f5f53e82c6a679c256ca (diff)
downloadgem5-a628afedade8d7b7cab108a81e714fc2755b4af3.tar.xz
mem: refactor LRU cache tags and add random replacement tags
this patch implements a new tags class that uses a random replacement policy. these tags prefer to evict invalid blocks first, if none are available a replacement candidate is chosen at random. this patch factors out the common code in the LRU class and creates a new abstract class: the BaseSetAssoc class. any set associative tag class must implement the functionality related to the actual replacement policy in the following methods: accessBlock() findVictim() insertBlock() invalidate()
Diffstat (limited to 'src/mem/cache/tags/Tags.py')
-rw-r--r--src/mem/cache/tags/Tags.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/mem/cache/tags/Tags.py b/src/mem/cache/tags/Tags.py
index 7c0dded32..ab1282ac9 100644
--- a/src/mem/cache/tags/Tags.py
+++ b/src/mem/cache/tags/Tags.py
@@ -53,14 +53,24 @@ class BaseTags(ClockedObject):
hit_latency = Param.Cycles(Parent.hit_latency,
"The hit latency for this cache")
-class LRU(BaseTags):
- type = 'LRU'
- cxx_class = 'LRU'
- cxx_header = "mem/cache/tags/lru.hh"
+class BaseSetAssoc(BaseTags):
+ type = 'BaseSetAssoc'
+ abstract = True
+ cxx_header = "mem/cache/tags/base_set_assoc.hh"
assoc = Param.Int(Parent.assoc, "associativity")
sequential_access = Param.Bool(Parent.sequential_access,
"Whether to access tags and data sequentially")
+class LRU(BaseSetAssoc):
+ type = 'LRU'
+ cxx_class = 'LRU'
+ cxx_header = "mem/cache/tags/lru.hh"
+
+class RandomRepl(BaseSetAssoc):
+ type = 'RandomRepl'
+ cxx_class = 'RandomRepl'
+ cxx_header = "mem/cache/tags/random_repl.hh"
+
class FALRU(BaseTags):
type = 'FALRU'
cxx_class = 'FALRU'