Go to the documentation of this file.
41 #include "params/TreePLRURP.hh"
47 namespace replacement_policy
59 return std::floor((
index-1)/2);
100 const uint64_t
index, std::shared_ptr<PLRUTree> tree)
109 "Number of leaves must be non-zero and a power of 2");
116 std::shared_ptr<TreePLRUReplData> treePLRU_replacement_data =
117 std::static_pointer_cast<TreePLRUReplData>(replacement_data);
118 PLRUTree* tree = treePLRU_replacement_data->tree.get();
122 uint64_t tree_index = treePLRU_replacement_data->index;
133 tree->at(tree_index) = right;
134 }
while (tree_index != 0);
142 std::shared_ptr<TreePLRUReplData> treePLRU_replacement_data =
143 std::static_pointer_cast<TreePLRUReplData>(replacement_data);
144 PLRUTree* tree = treePLRU_replacement_data->tree.get();
148 uint64_t tree_index = treePLRU_replacement_data->index;
159 tree->at(tree_index) = !right;
160 }
while (tree_index != 0);
168 touch(replacement_data);
175 assert(candidates.size() > 0);
178 const PLRUTree* tree = std::static_pointer_cast<TreePLRUReplData>(
179 candidates[0]->replacementData)->tree.get();
182 uint64_t tree_index = 0;
185 while (tree_index < tree->size()) {
187 if (tree->at(tree_index)) {
196 return candidates[tree_index - (
numLeaves - 1)];
199 std::shared_ptr<ReplacementData>
215 return std::shared_ptr<ReplacementData>(treePLRUReplData);
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.
static uint64_t rightSubtreeIndex(const uint64_t index)
Get index of the subtree on the right of the given indexed tree.
TreePLRU(const Params &p)
static uint64_t leftSubtreeIndex(const uint64_t index)
Get index of the subtree on the left of the given indexed tree.
PLRUTree * treeInstance
Holds the latest temporary tree instance created by instantiateEntry().
BaseReplacementPolicyParams Params
const uint64_t numLeaves
Number of leaves that share a single replacement data.
void invalidate(const std::shared_ptr< ReplacementData > &replacement_data) override
Invalidate replacement data to set it as the next probable victim.
static uint64_t parentIndex(const uint64_t index)
Get the index of the parent of the given indexed subtree.
TreePLRUReplData(const uint64_t index, std::shared_ptr< PLRUTree > tree)
Default constructor.
uint64_t count
Count of the number of sharers of a replacement data.
static constexpr bool isPowerOf2(const T &n)
void reset(const std::shared_ptr< ReplacementData > &replacement_data) const override
Reset replacement data.
void touch(const std::shared_ptr< ReplacementData > &replacement_data) const override
Touch an entry to update its replacement data.
Copyright (c) 2018-2020 Inria All rights reserved.
std::vector< bool > PLRUTree
Instead of implementing the tree itself with pointers, it is implemented as an array of bits.
ReplaceableEntry * getVictim(const ReplacementCandidates &candidates) const override
Find replacement victim using TreePLRU bits.
Tree-PLRU-specific implementation of replacement data.
A common base class of cache replacement policy objects.
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
std::shared_ptr< ReplacementData > instantiateEntry() override
Instantiate a replacement data entry.
A replaceable entry is a basic entry in a 2d table-like structure that needs to have replacement func...
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Generated on Tue Sep 21 2021 12:25:30 for gem5 by doxygen 1.8.17