45 warn_once(
"Associativity higher than number of skewing functions. " \
46 "Expect sub-optimal skewing.\n");
52 "for the skewing functions.");
63 const uint8_t lsb = bits<Addr>(
addr, 0);
65 const uint8_t xor_bit = msb ^ lsb;
68 return insertBits<Addr, uint8_t>(addr >> 1,
msbShift, xor_bit);
79 const uint8_t lsb = msb ^ xor_bit;
83 return insertBits<Addr, uint8_t>(addr_no_msb << 1, 0, lsb);
96 const Addr addr2 = bits<Addr>(
addr, 2 * (msbShift + 1) - 1, msbShift + 1);
101 addr1 =
hash(addr1) ^
hash(addr2) ^ addr2;
104 addr1 =
hash(addr1) ^
hash(addr2) ^ addr1;
125 panic(
"A skewing function has not been implemented for this way.");
143 const Addr addr2 = bits<Addr>(
addr, 2 * (msbShift + 1) - 1, msbShift + 1);
157 addr1 = addr1 ^
hash(addr2);
165 addr1 = addr1 ^
dehash(addr2);
171 return hash(addr1 ^
hash(addr2) ^ addr2);
173 addr1 = addr1 ^
hash(addr2);
181 addr1 = addr1 ^
dehash(addr2);
187 panic(
"A skewing function has not been implemented for this way.");
212 for (uint32_t way = 0; way <
assoc; ++way) {
221 SkewedAssociativeParams::create()
#define panic(...)
This implements a cprintf based panic() function.
std::vector< std::vector< ReplaceableEntry * > > sets
The cache sets.
const int NUM_SKEWING_FUNCTIONS
The number of skewing functions implemented.
uint32_t extractSet(const Addr addr, const uint32_t way) const
Apply a skewing function to calculate address' set given a way.
Addr hash(const Addr addr) const
The hash function itself.
A skewed associative indexing policy.
Declaration of a skewed associative indexing policy.
std::enable_if< std::is_integral< T >::value, int >::type floorLog2(T x)
const unsigned setMask
Mask out all bits that aren't part of the set index.
Addr regenerateAddr(const Addr tag, const ReplaceableEntry *entry) const override
Regenerate an entry's address from its tag and assigned set and way.
Addr deskew(const Addr addr, const uint32_t way) const
Address deskewing function (inverse of the skew function) of the given way.
const int tagShift
The amount to shift the address to get the tag.
std::vector< ReplaceableEntry * > getPossibleEntries(const Addr addr) const override
Find all possible entries for insertion and replacement of an address.
SkewedAssociative(const Params *p)
Construct and initialize this policy.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
const uint32_t numSets
The number of sets in the cache.
const int msbShift
The amount to shift a set index to get its MSB.
BaseIndexingPolicyParams Params
Convenience typedef.
Addr skew(const Addr addr, const uint32_t way) const
Address skewing function selection.
const unsigned assoc
The associativity.
uint32_t getWay() const
Get way number.
const int setShift
The amount to shift the address to get the set.
Addr dehash(const Addr addr) const
Inverse of the hash function.
A replaceable entry is a basic entry in a 2d table-like structure that needs to have replacement func...
A common base class for indexing table locations.
uint32_t getSet() const
Get set number.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...