41 #ifndef __MEM_STACK_DIST_CALC_HH__
42 #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);
417 #endif //__STACK_DIST_CALC_HH__
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...
std::pair< uint64_t, bool > calcStackDistAndUpdate(const Addr r_address, bool addNewNode=true)
Process the given address:
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.
uint64_t verifyStackDist(const Addr r_address, bool update_stack=false)
This is an alternative implementation of the stack-distance in a naive way.
std::map< Addr, uint64_t > AddressIndexMap
Node which takes form of Leaf, INode or Root.
StackDistCalc(bool verify_stack=false)
std::vector< uint64_t > stack
uint64_t getIndex() const
Return the counter for address accesses (unique and non-unique).
static constexpr uint64_t Infinity
A convenient way of refering to infinity.
Node()
The discard flags are false by default they become true if the node is reached again in a future look...
void updateTree()
updateTree is a tree balancing operation, which maintains the binary tree structure.
std::vector< IndexNodeMap > TreeType
std::map< uint64_t, Node * > IndexNodeMap
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
The stack distance calculator is a passive object that merely observes the addresses pass to it...
std::vector< uint64_t > nextIndex
uint64_t index
Internal counter for address accesses (unique and non-unique) This counter increments everytime the c...
bool isMarked
Flag to indicate if this address is marked.
uint64_t getTreeDepth() const
Query depth of the tree (tree[0] represents leaf layer while tree[treeDepth] represents the root laye...
uint64_t getSumsLeavesToRoot(Node *node) const
Gets the sum from the leaf node specified.
void printStack(int n=5) const
Print the last n items on the stack.
std::pair< uint64_t, bool > calcStackDist(const Addr r_address, bool mark=false)
Process the given address.
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.