38#ifndef __MEM_STACK_DIST_CALC_HH__
39#define __MEM_STACK_DIST_CALC_HH__
199 uint64_t
getSum(
Node* node,
bool from_left, uint64_t sum_from_below,
200 uint64_t stack_dist, uint64_t
level)
const;
228 bool from_left, uint64_t sum_from_below, uint64_t
level,
229 uint64_t stack_dist,
bool discard_node);
305 bool update_stack =
false);
315 static constexpr uint64_t
Infinity = std::numeric_limits<uint64_t>::max();
344 bool addNewNode =
true);
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
The stack distance calculator is a passive object that merely observes the addresses pass to it.
std::map< uint64_t, Node * > IndexNodeMap
std::vector< uint64_t > nextIndex
void updateTree()
updateTree is a tree balancing operation, which maintains the binary tree structure.
uint64_t getTreeDepth() const
Query depth of the tree (tree[0] represents leaf layer while tree[treeDepth] represents the root laye...
std::vector< IndexNodeMap > TreeType
std::map< Addr, uint64_t > AddressIndexMap
std::pair< uint64_t, bool > calcStackDist(const Addr r_address, bool mark=false)
Process the given address.
uint64_t getSumsLeavesToRoot(Node *node) const
Gets the sum from the leaf node specified.
static constexpr uint64_t Infinity
A convenient way of refering to infinity.
uint64_t getSum(Node *node, bool from_left, uint64_t sum_from_below, uint64_t stack_dist, uint64_t level) const
Gets sum from the node upwards recursively till the root.
uint64_t updateSumsLeavesToRoot(Node *node, bool is_new_leaf)
Updates the leaf nodes and nodes above.
std::pair< uint64_t, bool > calcStackDistAndUpdate(const Addr r_address, bool addNewNode=true)
Process the given address:
uint64_t verifyStackDist(const Addr r_address, bool update_stack=false)
This is an alternative implementation of the stack-distance in a naive way.
void sanityCheckTree(const Node *node, uint64_t level=0) const
This method is used for verification purposes It recursively traverses upwards from the given node ti...
uint64_t updateSum(Node *node, bool from_left, uint64_t sum_from_below, uint64_t level, uint64_t stack_dist, bool discard_node)
Updates the nodes upwards recursively till the root.
uint64_t getIndex() const
Return the counter for address accesses (unique and non-unique).
StackDistCalc(bool verify_stack=false)
std::vector< uint64_t > stack
void printStack(int n=5) const
Print the last n items on the stack.
uint64_t index
Internal counter for address accesses (unique and non-unique) This counter increments everytime the c...
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Node which takes form of Leaf, INode or Root.
bool isMarked
Flag to indicate if this address is marked.
Node()
The discard flags are false by default they become true if the node is reached again in a future look...