34c34
< #include "debug/CacheRepl.hh"
---
> #include "mem/cache/blk.hh"
41,42c41,43
< CacheBlk*
< RandomRP::getVictim(const ReplacementCandidates& candidates)
---
> void
> RandomRP::invalidate(const std::shared_ptr<ReplacementData>& replacement_data)
> const
43a45,65
> // Unprioritize replacement data victimization
> std::static_pointer_cast<RandomReplData>(
> replacement_data)->valid = false;
> }
>
> void
> RandomRP::touch(const std::shared_ptr<ReplacementData>& replacement_data) const
> {
> }
>
> void
> RandomRP::reset(const std::shared_ptr<ReplacementData>& replacement_data) const
> {
> // Unprioritize replacement data victimization
> std::static_pointer_cast<RandomReplData>(
> replacement_data)->valid = true;
> }
>
> ReplaceableEntry*
> RandomRP::getVictim(const ReplacementCandidates& candidates) const
> {
48c70
< CacheBlk* blk = candidates[random_mt.random<unsigned>(0,
---
> ReplaceableEntry* victim = candidates[random_mt.random<unsigned>(0,
51c73,74
< // Visit all candidates to find an invalid entry
---
> // Visit all candidates to search for an invalid entry. If one is found,
> // its eviction is prioritized
53,55c76,78
< // Give priority to victimise invalid entries
< if (!candidate->isValid()){
< blk = candidate;
---
> if (!std::static_pointer_cast<RandomReplData>(
> candidate->replacementData)->valid) {
> victim = candidate;
60,62c83,84
< // If no invalid blocks were found, choose one of the candidates randomly
< DPRINTF(CacheRepl, "set %x, way %x: selecting blk for replacement\n",
< blk->set, blk->way);
---
> return victim;
> }
64c86,89
< return blk;
---
> std::shared_ptr<ReplacementData>
> RandomRP::instantiateEntry()
> {
> return std::shared_ptr<ReplacementData>(new ReplacementData());