Go to the documentation of this file.
29 #ifndef __CACHE_PREFETCH_ASSOCIATIVE_SET_IMPL_HH__
30 #define __CACHE_PREFETCH_ASSOCIATIVE_SET_IMPL_HH__
38 Entry
const &init_value)
39 : associativity(assoc), numEntries(num_entries), indexingPolicy(idx_policy),
40 replacementPolicy(rpl_policy), entries(numEntries, init_value)
43 "AssociativeSet<> must be a power of 2");
45 "must be a power of 2");
46 for (
unsigned int entry_idx = 0; entry_idx <
numEntries; entry_idx += 1) {
47 Entry* entry = &
entries[entry_idx];
57 Addr tag = indexingPolicy->extractTag(
addr);
59 indexingPolicy->getPossibleEntries(
addr);
61 for (
const auto& location : selected_entries) {
62 Entry* entry =
static_cast<Entry *
>(location);
63 if ((entry->getTag() == tag) && entry->isValid() &&
64 entry->isSecure() == is_secure) {
75 replacementPolicy->touch(entry->replacementData);
84 indexingPolicy->getPossibleEntries(
addr);
85 Entry* victim =
static_cast<Entry*
>(replacementPolicy->getVictim(
98 indexingPolicy->getPossibleEntries(
addr);
101 unsigned int idx = 0;
102 for (
auto &entry : selected_entries) {
103 entries[idx++] =
static_cast<Entry *
>(entry);
108 template<
class Entry>
113 entry->setTag(indexingPolicy->extractTag(
addr));
114 entry->setSecure(is_secure);
115 replacementPolicy->reset(entry->replacementData);
118 template<
class Entry>
123 replacementPolicy->invalidate(entry->replacementData);
126 #endif//__CACHE_PREFETCH_ASSOCIATIVE_SET_IMPL_HH__
virtual std::shared_ptr< ReplacementData > instantiateEntry()=0
Instantiate a replacement data entry.
Entry * findEntry(Addr addr, bool is_secure) const
Find an entry within the set.
std::vector< Entry > entries
Vector containing the entries of the container.
void accessEntry(Entry *entry)
Do an access to the entry, this is required to update the replacement information data.
A common base class of cache replacement policy objects.
std::vector< Entry * > getPossibleEntries(const Addr addr) const
Find the set of entries that could be replaced given that we want to add a new entry with the provide...
void setEntry(ReplaceableEntry *entry, const uint64_t index)
Associate a pointer to an entry to its physical counterpart.
void insertEntry(Addr addr, bool is_secure, Entry *entry)
Indicate that an entry has just been inserted.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Entry * findVictim(Addr addr)
Find a victim to be replaced.
const int numEntries
Total number of entries, entries are organized in sets of the provided associativity.
void invalidate(Entry *entry)
Invalidate an entry and its respective replacement data.
A common base class for indexing table locations.
BaseIndexingPolicy *const indexingPolicy
Pointer to the indexing policy.
BaseReplacementPolicy *const replacementPolicy
Pointer to the replacement policy.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
AssociativeSet(int assoc, int num_entries, BaseIndexingPolicy *idx_policy, BaseReplacementPolicy *rpl_policy, Entry const &init_value=Entry())
Public constructor.
bool isPowerOf2(const T &n)
Generated on Wed Sep 30 2020 14:02:12 for gem5 by doxygen 1.8.17