36 #include "params/BRRIPRP.hh"
42 namespace replacement_policy
46 :
Base(
p), numRRPVBits(
p.num_bits), hitPriority(
p.hit_priority),
55 std::shared_ptr<BRRIPReplData> casted_replacement_data =
56 std::static_pointer_cast<BRRIPReplData>(replacement_data);
59 casted_replacement_data->valid =
false;
63 BRRIP::touch(
const std::shared_ptr<ReplacementData>& replacement_data)
const
65 std::shared_ptr<BRRIPReplData> casted_replacement_data =
66 std::static_pointer_cast<BRRIPReplData>(replacement_data);
72 casted_replacement_data->rrpv.reset();
74 casted_replacement_data->rrpv--;
79 BRRIP::reset(
const std::shared_ptr<ReplacementData>& replacement_data)
const
81 std::shared_ptr<BRRIPReplData> casted_replacement_data =
82 std::static_pointer_cast<BRRIPReplData>(replacement_data);
87 casted_replacement_data->rrpv.saturate();
89 casted_replacement_data->rrpv--;
93 casted_replacement_data->valid =
true;
100 assert(candidates.size() > 0);
106 int victim_RRPV = std::static_pointer_cast<BRRIPReplData>(
110 for (
const auto& candidate : candidates) {
111 std::shared_ptr<BRRIPReplData> candidate_repl_data =
112 std::static_pointer_cast<BRRIPReplData>(
113 candidate->replacementData);
116 if (!candidate_repl_data->valid) {
121 int candidate_RRPV = candidate_repl_data->rrpv;
122 if (candidate_RRPV > victim_RRPV) {
124 victim_RRPV = candidate_RRPV;
130 int diff = std::static_pointer_cast<BRRIPReplData>(
136 for (
const auto& candidate : candidates) {
137 std::static_pointer_cast<BRRIPReplData>(
138 candidate->replacementData)->rrpv += diff;
145 std::shared_ptr<ReplacementData>