61a62
> #include "mem/cache/tags/indexing_policies/base.hh"
65c66
< * A BaseSetAssoc cache tag store.
---
> * A basic cache tag store.
69,70c70
< * cache lines (ways). A cache line is mapped onto a set, and can be placed
< * into any of the ways of this set.
---
> * cache lines (ways).
77,78d76
< /** Typedef the set type used in this tag store. */
< typedef std::vector<CacheBlk*> SetType;
81,82d78
< /** The associativity of the cache. */
< const unsigned assoc;
89,91d84
< /** The number of sets in the cache. */
< const unsigned numSets;
<
95,104d87
< /** The cache sets. */
< std::vector<SetType> sets;
<
< /** The amount to shift the address to get the set. */
< int setShift;
< /** The amount to shift the address to get the tag. */
< int tagShift;
< /** Mask out all bits that aren't part of the set index. */
< unsigned setMask;
<
108,126d90
< /**
< * Find all possible block locations for insertion and replacement of
< * an address. Should be called immediately before ReplacementPolicy's
< * findVictim() not to break cache resizing.
< * Returns blocks in all ways belonging to the set of the address.
< *
< * @param addr The addr to a find possible locations for.
< * @return The possible locations.
< */
< std::vector<ReplaceableEntry*> getPossibleLocations(const Addr addr) const
< override
< {
< std::vector<ReplaceableEntry*> locations;
< for (const auto& blk : sets[extractSet(addr)]) {
< locations.push_back(static_cast<ReplaceableEntry*>(blk));
< }
< return locations;
< }
<
208,216d171
< * Find a block given set and way.
< *
< * @param set The set of the block.
< * @param way The way of the block.
< * @return The block.
< */
< ReplaceableEntry* findBlockBySetAndWay(int set, int way) const override;
<
< /**
228,229c183,185
< // Get possible locations for the victim block
< std::vector<ReplaceableEntry*> locations = getPossibleLocations(addr);
---
> // Get possible entries to be victimized
> const std::vector<ReplaceableEntry*> entries =
> indexingPolicy->getPossibleEntries(addr);
233,234c189
< std::vector<ReplaceableEntry*>(
< locations.begin(), locations.end())));
---
> entries));
288,298c243
< * Generate the tag from the given address.
< * @param addr The address to get the tag from.
< * @return The tag of the address.
< */
< Addr extractTag(Addr addr) const override
< {
< return (addr >> tagShift);
< }
<
< /**
< * Regenerate the block address from the tag and set.
---
> * Regenerate the block address from the tag and indexing location.
305,306c250
< const Addr set = blk->getSet() << setShift;
< return ((blk->tag << tagShift) | set);
---
> return indexingPolicy->regenerateAddr(blk->tag, blk);
323,334d266
<
< private:
< /**
< * Calculate the set index from the address.
< *
< * @param addr The address to get the set from.
< * @return The set index of the address.
< */
< int extractSet(Addr addr) const
< {
< return ((addr >> setShift) & setMask);
< }