23 virtual uint32_t
getVictim(uint32_t set_idx) {
return 0; }
28 virtual void touch(uint32_t set_idx, uint32_t way_idx) {}
47 #define ADD_REPLACER_TO_CMD_LINE(rep_pol) static int register_replacement = []() { \
48 if (replacement_map == nullptr) replacement_map = new std::map<std::string, rep_factory_t, ci_less>(); \
49 (*replacement_map)[#rep_pol] = [](CacheABC& cache, uint32_t num_sets, uint32_t assoc) \
50 { return new rep_pol(cache, num_sets, assoc); }; return 0; }()
Declaration of the cache interface class.
The cache interface.
Definition: cache_abc.h:9
The base class for replacement policies.
Definition: replacement_policy.h:9
virtual uint32_t getVictim(uint32_t set_idx)
Determine which line of a range of lines to replace.
Definition: replacement_policy.h:23
virtual void touch(uint32_t set_idx, uint32_t way_idx)
Notify the replacement policy that a line was just accessed.
Definition: replacement_policy.h:28
ReplacementPolicy(CacheABC &cache, uint32_t num_sets, uint32_t assoc)
Construct a new replacement policy.
Definition: replacement_policy.h:16
uint32_t num_sets
The number of sets in the cache.
Definition: replacement_policy.h:40
virtual void printState(uint32_t set_idx)
Print out the replacer's internal state.
Definition: replacement_policy.h:32
uint32_t assoc
The associativity of the cache.
Definition: replacement_policy.h:42
CacheABC & cache
The parent cache.
Definition: replacement_policy.h:37