49 warn_once(
"Associativity higher than number of skewing functions. " \
50 "Expect sub-optimal skewing.\n");
56 "for the skewing functions.");
69 const uint8_t xor_bit = msb ^ lsb;
83 const uint8_t lsb = msb ^ xor_bit;
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) {
std::vector< std::vector< ReplaceableEntry * > > sets
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)
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
constexpr T mbits(T val, unsigned first, unsigned last)
Mask off the given bits in place like bits() but without shifting.
constexpr T insertBits(T val, unsigned first, unsigned last, B bit_val)
Returns val with bits first to last set to the LSBs of bit_val.
#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.
IndexingPolicyTemplate< AddrTypes > BaseIndexingPolicy
Declaration of a skewed associative indexing policy.