Go to the documentation of this file.
41 #include "params/TreePLRURP.hh"
52 return std::floor((
index-1)/2);
93 const uint64_t
index, std::shared_ptr<PLRUTree> tree)
103 "Number of leaves must be non-zero and a power of 2");
108 const std::shared_ptr<ReplacementData>& replacement_data)
const
111 std::shared_ptr<TreePLRUReplData> treePLRU_replacement_data =
112 std::static_pointer_cast<TreePLRUReplData>(replacement_data);
113 PLRUTree* tree = treePLRU_replacement_data->tree.get();
117 uint64_t tree_index = treePLRU_replacement_data->index;
128 tree->at(tree_index) = right;
129 }
while (tree_index != 0);
137 std::shared_ptr<TreePLRUReplData> treePLRU_replacement_data =
138 std::static_pointer_cast<TreePLRUReplData>(replacement_data);
139 PLRUTree* tree = treePLRU_replacement_data->tree.get();
143 uint64_t tree_index = treePLRU_replacement_data->index;
154 tree->at(tree_index) = !right;
155 }
while (tree_index != 0);
163 touch(replacement_data);
170 assert(candidates.size() > 0);
173 const PLRUTree* tree = std::static_pointer_cast<TreePLRUReplData>(
174 candidates[0]->replacementData)->tree.get();
177 uint64_t tree_index = 0;
180 while (tree_index < tree->size()) {
182 if (tree->at(tree_index)) {
191 return candidates[tree_index - (
numLeaves - 1)];
194 std::shared_ptr<ReplacementData>
210 return std::shared_ptr<ReplacementData>(treePLRUReplData);
214 TreePLRURPParams::create()
A replaceable entry is a basic entry in a 2d table-like structure that needs to have replacement func...
std::vector< bool > PLRUTree
Instead of implementing the tree itself with pointers, it is implemented as an array of bits.
BaseReplacementPolicyParams Params
Convenience typedef.
Tree-PLRU-specific implementation of replacement data.
ReplaceableEntry * getVictim(const ReplacementCandidates &candidates) const override
Find replacement victim using TreePLRU bits.
void touch(const std::shared_ptr< ReplacementData > &replacement_data) const override
Touch an entry to update its replacement data.
static uint64_t leftSubtreeIndex(const uint64_t index)
Get index of the subtree on the left of the given indexed tree.
Copyright (c) 2018 Inria All rights reserved.
TreePLRUReplData(const uint64_t index, std::shared_ptr< PLRUTree > tree)
Default constructor.
A common base class of cache replacement policy objects.
static uint64_t parentIndex(const uint64_t index)
Get the index of the parent of the given indexed subtree.
void reset(const std::shared_ptr< ReplacementData > &replacement_data) const override
Reset replacement data.
std::shared_ptr< ReplacementData > instantiateEntry() override
Instantiate a replacement data entry.
void invalidate(const std::shared_ptr< ReplacementData > &replacement_data) const override
Invalidate replacement data to set it as the next probable victim.
const uint64_t numLeaves
Number of leaves that share a single replacement data.
uint64_t count
Count of the number of sharers of a replacement data.
static uint64_t rightSubtreeIndex(const uint64_t index)
Get index of the subtree on the right of the given indexed tree.
static bool isRightSubtree(const uint64_t index)
Find out if the subtree at index corresponds to the right or left subtree of its parent tree.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
PLRUTree * treeInstance
Holds the latest temporary tree instance created by instantiateEntry().
TreePLRURP(const Params *p)
Construct and initiliaze this replacement policy.
bool isPowerOf2(const T &n)
Generated on Wed Sep 30 2020 14:02:12 for gem5 by doxygen 1.8.17