From a628afedade8d7b7cab108a81e714fc2755b4af3 Mon Sep 17 00:00:00 2001 From: Anthony Gutierrez Date: Mon, 28 Jul 2014 12:23:23 -0400 Subject: 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() --- src/mem/cache/base.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/mem/cache/base.cc') diff --git a/src/mem/cache/base.cc b/src/mem/cache/base.cc index af324527f..dd1306270 100644 --- a/src/mem/cache/base.cc +++ b/src/mem/cache/base.cc @@ -49,6 +49,7 @@ #include "debug/Drain.hh" #include "mem/cache/tags/fa_lru.hh" #include "mem/cache/tags/lru.hh" +#include "mem/cache/tags/random_repl.hh" #include "mem/cache/base.hh" #include "mem/cache/cache.hh" #include "mem/cache/mshr.hh" @@ -783,6 +784,8 @@ BaseCacheParams::create() if (numSets == 1) warn("Consider using FALRU tags for a fully associative cache\n"); return new Cache(this); + } else if (dynamic_cast(tags)) { + return new Cache(this); } else { fatal("No suitable tags selected\n"); } -- cgit v1.2.3