38 #include "params/WeightedLRURP.hh"
47 WeightedLRURPParams::create()
54 replacement_data)
const
56 std::static_pointer_cast<WeightedLRUReplData>(replacement_data)->
62 replacement_data,
int occupancy)
const
64 std::static_pointer_cast<WeightedLRUReplData>(replacement_data)->
66 std::static_pointer_cast<WeightedLRUReplData>(replacement_data)->
67 last_occ_ptr = occupancy;
73 assert(candidates.size() > 0);
79 for (
const auto& candidate : candidates) {
81 std::shared_ptr<WeightedLRUReplData> candidate_replacement_data =
82 std::static_pointer_cast<WeightedLRUReplData>(
83 candidate->replacementData);
85 std::shared_ptr<WeightedLRUReplData> victim_replacement_data =
86 std::static_pointer_cast<WeightedLRUReplData>(
89 if (candidate_replacement_data->last_occ_ptr <
90 victim_replacement_data->last_occ_ptr) {
92 }
else if (candidate_replacement_data->last_occ_ptr ==
93 victim_replacement_data->last_occ_ptr) {
95 Tick time = candidate_replacement_data->last_touch_tick;
96 if (time < victim_replacement_data->last_touch_tick) {
104 std::shared_ptr<ReplacementData>
112 replacement_data)
const
115 std::static_pointer_cast<WeightedLRUReplData>(
116 replacement_data)->last_touch_tick =
curTick();
121 replacement_data)
const
124 std::static_pointer_cast<WeightedLRUReplData>(
125 replacement_data)->last_touch_tick =
Tick(0);