47 warn_once(
"Associativity higher than number of skewing functions. " \
48 "Expect sub-optimal skewing.\n");
54 "for the skewing functions.");
65 const uint8_t lsb = bits<Addr>(
addr, 0);
67 const uint8_t xor_bit = msb ^ lsb;
70 return insertBits<Addr, uint8_t>(addr >> 1,
msbShift, xor_bit);
81 const uint8_t lsb = msb ^ xor_bit;
85 return insertBits<Addr, uint8_t>(addr_no_msb << 1, 0, lsb);
98 const Addr addr2 = bits<Addr>(
addr, 2 * (msbShift + 1) - 1, msbShift + 1);
103 addr1 =
hash(addr1) ^
hash(addr2) ^ addr2;
106 addr1 =
hash(addr1) ^
hash(addr2) ^ addr1;
127 panic(
"A skewing function has not been implemented for this way.");
145 const Addr addr2 = bits<Addr>(
addr, 2 * (msbShift + 1) - 1, msbShift + 1);
159 addr1 = addr1 ^
hash(addr2);
167 addr1 = addr1 ^
dehash(addr2);
173 return hash(addr1 ^
hash(addr2) ^ addr2);
175 addr1 = addr1 ^
hash(addr2);
183 addr1 = addr1 ^
dehash(addr2);
189 panic(
"A skewing function has not been implemented for this way.");
214 for (uint32_t way = 0; way <
assoc; ++way) {
223 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.
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.
int floorLog2(unsigned x)
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...