36 #include "params/BRRIPRP.hh"
41 :
Base(
p), numRRPVBits(
p.num_bits), hitPriority(
p.hit_priority),
51 std::shared_ptr<BRRIPReplData> casted_replacement_data =
52 std::static_pointer_cast<BRRIPReplData>(replacement_data);
55 casted_replacement_data->valid =
false;
59 BRRIP::touch(
const std::shared_ptr<ReplacementData>& replacement_data)
const
61 std::shared_ptr<BRRIPReplData> casted_replacement_data =
62 std::static_pointer_cast<BRRIPReplData>(replacement_data);
68 casted_replacement_data->rrpv.reset();
70 casted_replacement_data->rrpv--;
75 BRRIP::reset(
const std::shared_ptr<ReplacementData>& replacement_data)
const
77 std::shared_ptr<BRRIPReplData> casted_replacement_data =
78 std::static_pointer_cast<BRRIPReplData>(replacement_data);
83 casted_replacement_data->rrpv.saturate();
85 casted_replacement_data->rrpv--;
89 casted_replacement_data->valid =
true;
96 assert(candidates.size() > 0);
102 int victim_RRPV = std::static_pointer_cast<BRRIPReplData>(
106 for (
const auto& candidate : candidates) {
107 std::shared_ptr<BRRIPReplData> candidate_repl_data =
108 std::static_pointer_cast<BRRIPReplData>(
109 candidate->replacementData);
112 if (!candidate_repl_data->valid) {
117 int candidate_RRPV = candidate_repl_data->rrpv;
118 if (candidate_RRPV > victim_RRPV) {
120 victim_RRPV = candidate_RRPV;
126 int diff = std::static_pointer_cast<BRRIPReplData>(
132 for (
const auto& candidate : candidates) {
133 std::static_pointer_cast<BRRIPReplData>(
134 candidate->replacementData)->rrpv += diff;
141 std::shared_ptr<ReplacementData>