49 warn_once(
"Associativity higher than number of skewing functions. " \
50 "Expect sub-optimal skewing.\n");
56 "for the skewing functions.");
67 const uint8_t lsb = bits<Addr>(
addr, 0);
69 const uint8_t xor_bit = msb ^ lsb;
72 return insertBits<Addr, uint8_t>(
addr >> 1,
msbShift, xor_bit);
83 const uint8_t lsb = msb ^ xor_bit;
87 return insertBits<Addr, uint8_t>(addr_no_msb << 1, 0, lsb);
105 addr1 =
hash(addr1) ^
hash(addr2) ^ addr2;
108 addr1 =
hash(addr1) ^
hash(addr2) ^ addr1;
129 panic(
"A skewing function has not been implemented for this way.");
161 addr1 = addr1 ^
hash(addr2);
169 addr1 = addr1 ^
dehash(addr2);
175 return hash(addr1 ^
hash(addr2) ^ addr2);
177 addr1 = addr1 ^
hash(addr2);
185 addr1 = addr1 ^
dehash(addr2);
191 panic(
"A skewing function has not been implemented for this way.");
216 for (uint32_t way = 0; way <
assoc; ++way) {
A common base class for indexing table locations.
const int tagShift
The amount to shift the address to get the tag.
const uint32_t numSets
The number of sets in the cache.
std::vector< std::vector< ReplaceableEntry * > > sets
The cache sets.
const unsigned setMask
Mask out all bits that aren't part of the set index.
const unsigned assoc
The associativity.
const int setShift
The amount to shift the address to get the set.
A replaceable entry is a basic entry in a 2d table-like structure that needs to have replacement func...
uint32_t getWay() const
Get way number.
uint32_t getSet() const
Get set number.
Addr deskew(const Addr addr, const uint32_t way) const
Address deskewing function (inverse of the skew function) of the given way.
uint32_t extractSet(const Addr addr, const uint32_t way) const
Apply a skewing function to calculate address' set given a way.
std::vector< ReplaceableEntry * > getPossibleEntries(const Addr &addr) const override
Find all possible entries for insertion and replacement of an address.
const int msbShift
The amount to shift a set index to get its MSB.
Addr regenerateAddr(const Addr &tag, const ReplaceableEntry *entry) const override
Regenerate an entry's address from its tag and assigned set and way.
Addr skew(const Addr addr, const uint32_t way) const
Address skewing function selection.
SkewedAssociativeParams Params
Convenience typedef.
const int NUM_SKEWING_FUNCTIONS
The number of skewing functions implemented.
Addr hash(const Addr addr) const
The hash function itself.
SkewedAssociative(const Params &p)
Construct and initialize this policy.
Addr dehash(const Addr addr) const
Inverse of the hash function.
static constexpr std::enable_if_t< std::is_integral_v< T >, int > floorLog2(T x)
#define panic(...)
This implements a cprintf based panic() function.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Copyright (c) 2024 Arm Limited All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Declaration of a skewed associative indexing policy.