60 numSets(
p.size / (
p.entry_size * assoc)),
61 setShift(
floorLog2(
p.entry_size)), setMask(numSets - 1), sets(numSets),
66 fatal_if(
assoc <= 0,
"associativity must be greater than zero");
84 const std::lldiv_t div_result = std::div((
long long)
index,
assoc);
85 const uint32_t
set = div_result.quot;
86 const uint32_t way = div_result.rem;
std::vector< std::vector< ReplaceableEntry * > > sets
The cache sets.
void setEntry(ReplaceableEntry *entry, const uint64_t index)
Associate a pointer to an entry to its physical counterpart.
BaseIndexingPolicyParams Params
Convenience typedef.
const uint32_t numSets
The number of sets in the cache.
virtual Addr extractTag(const Addr addr) const
Generate the tag from the given address.
BaseIndexingPolicy(const Params &p)
Construct and initialize this policy.
const int tagShift
The amount to shift the address to get the tag.
const unsigned assoc
The associativity.
ReplaceableEntry * getEntry(const uint32_t set, const uint32_t way) const
Get an entry based on its set and way.
A replaceable entry is a basic entry in a 2d table-like structure that needs to have replacement func...
virtual void setPosition(const uint32_t set, const uint32_t way)
Set both the set and way.
Abstract superclass for simulation objects.
static constexpr std::enable_if_t< std::is_integral_v< T >, int > floorLog2(T x)
static constexpr bool isPowerOf2(const T &n)
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
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.