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];
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) {
101 unsigned int idx = 0;
102 for (
auto &entry : selected_entries) {
103 entries[idx++] =
static_cast<Entry *
>(entry);
108 template<
class Entry>
114 entry->setSecure(is_secure);
118 template<
class Entry>
126 #endif//__CACHE_PREFETCH_ASSOCIATIVE_SET_IMPL_HH__
Entry * findEntry(Addr addr, bool is_secure) const
Find an entry within the set.
BaseIndexingPolicy *const indexingPolicy
Pointer to the indexing policy.
void invalidate(Entry *entry)
Invalidate an entry and its respective replacement data.
BaseReplacementPolicy *const replacementPolicy
Pointer to the replacement policy.
virtual std::vector< ReplaceableEntry * > getPossibleEntries(const Addr addr) const =0
Find all possible entries for insertion and replacement of an address.
virtual void touch(const std::shared_ptr< ReplacementData > &replacement_data) const =0
Update replacement data.
std::vector< Entry > entries
Vector containing the entries of the container.
virtual ReplaceableEntry * getVictim(const ReplacementCandidates &candidates) const =0
Find replacement victim among candidates.
A common base class of cache replacement policy objects.
virtual Addr extractTag(const Addr addr) const
Generate the tag from the given address.
Entry * findVictim(Addr addr)
Find a victim to be replaced.
void accessEntry(Entry *entry)
Do an access to the entry, this is required to update the replacement information data...
bool isPowerOf2(const T &n)
#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.
virtual std::shared_ptr< ReplacementData > instantiateEntry()=0
Instantiate a replacement data entry.
void setEntry(ReplaceableEntry *entry, const uint64_t index)
Associate a pointer to an entry to its physical counterpart.
virtual void invalidate(const std::shared_ptr< ReplacementData > &replacement_data) const =0
Invalidate replacement data to set it as the next probable victim.
virtual void reset(const std::shared_ptr< ReplacementData > &replacement_data) const =0
Reset replacement data.
void insertEntry(Addr addr, bool is_secure, Entry *entry)
Indicate that an entry has just been inserted.
A common base class for indexing table locations.
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...
const int numEntries
Total number of entries, entries are organized in sets of the provided associativity.
AssociativeSet(int assoc, int num_entries, BaseIndexingPolicy *idx_policy, BaseReplacementPolicy *rpl_policy, Entry const &init_value=Entry())
Public constructor.