/** vector containing the state of the cachelines in this zone */
std::vector<AccessMapState> states;
- AccessMapEntry(size_t num_entries) : states(num_entries, AM_INIT)
- {}
+ AccessMapEntry(size_t num_entries)
+ : TaggedEntry(), states(num_entries, AM_INIT)
+ {
+ }
- /** Reset the entries to their initial values */
- void reset() override
+ void
+ invalidate() override
{
+ TaggedEntry::invalidate();
for (auto &entry : states) {
entry = AM_INIT;
}
valid = true;
}
- /**
- * Sets the entry to invalid
- */
- void setInvalid() {
+ /** Invalidates the entry. */
+ virtual void
+ invalidate()
+ {
valid = false;
}
{
secure = s;
}
-
- /**
- * Resets the entry, this is called when an entry is evicted to allocate
- * a new one. Types inheriting this class should provide its own
- * implementation
- */
- virtual void reset () {
- }
};
/**
*/
void insertEntry(Addr addr, bool is_secure, Entry* entry);
+ /**
+ * Invalidate an entry and its respective replacement data.
+ *
+ * @param entry Entry to be invalidated.
+ */
+ void invalidate(Entry* entry);
+
/** Iterator types */
using const_iterator = typename std::vector<Entry>::const_iterator;
using iterator = typename std::vector<Entry>::iterator;
Entry* victim = static_cast<Entry*>(replacementPolicy->getVictim(
selected_entries));
// There is only one eviction for this replacement
- victim->reset();
+ invalidate(victim);
return victim;
}
replacementPolicy->reset(entry->replacementData);
}
+template<class Entry>
+void
+AssociativeSet<Entry>::invalidate(Entry* entry)
+{
+ entry->invalidate();
+ replacementPolicy->invalidate(entry->replacementData);
+}
+
#endif//__CACHE_PREFETCH_ASSOCIATIVE_SET_IMPL_HH__
}
void
-DeltaCorrelatingPredictionTables::DCPTEntry::reset()
+DeltaCorrelatingPredictionTables::DCPTEntry::invalidate()
{
+ TaggedEntry::invalidate();
+
for (auto &delta : deltas) {
delta = 0;
}
* Constructor
* @param num_deltas number of deltas stored in the entry
*/
- DCPTEntry(unsigned int num_deltas) : lastAddress(0), deltaPointer(0),
- deltas(num_deltas)
- {}
+ DCPTEntry(unsigned int num_deltas)
+ : TaggedEntry(), lastAddress(0), deltaPointer(0), deltas(num_deltas)
+ {
+ }
- /** Reset callback called when invalidating the entry */
- void reset() override;
+ void invalidate() override;
/**
* Adds an address to the entry, if the entry already existed, a delta
} else {
// Third access! no pattern has been found so far,
// release the IPD entry
- ipd_entry->reset();
+ ipd.invalidate(ipd_entry);
ipdEntryTrackingMisses = nullptr;
}
} else {
pt_entry->enabled = true;
pt_entry->indirectCounter.reset();
// Release the current IPD Entry
- entry->reset();
+ ipd.invalidate(entry);
// Do not track more misses
ipdEntryTrackingMisses = nullptr;
return;
increasedIndirectCounter(false)
{}
- void reset() override {
+ void
+ invalidate() override
+ {
+ TaggedEntry::invalidate();
address = 0;
secure = false;
streamCounter = 0;
IndirectPatternDetectorEntry(unsigned int num_addresses,
unsigned int num_shifts)
- : idx1(0), idx2(0), secondIndexSet(false), numMisses(0),
+ : TaggedEntry(), idx1(0), idx2(0), secondIndexSet(false),
+ numMisses(0),
baseAddr(num_addresses, std::vector<Addr>(num_shifts))
- {}
+ {
+ }
- void reset() override {
+ void
+ invalidate() override
+ {
+ TaggedEntry::invalidate();
idx1 = 0;
idx2 = 0;
secondIndexSet = false;
numMisses = 0;
- setInvalid();
}
};
/** Indirect Pattern Detector (IPD) table */
* Maps a set of contiguous addresses to another set of (not necessarily
* contiguos) addresses, with their corresponding confidence counters
*/
- struct AddressMappingEntry : public TaggedEntry {
+ struct AddressMappingEntry : public TaggedEntry
+ {
std::vector<AddressMapping> mappings;
AddressMappingEntry(size_t num_mappings, unsigned counter_bits)
- : mappings(num_mappings, counter_bits)
- {}
- void reset() override
+ : TaggedEntry(), mappings(num_mappings, counter_bits)
+ {
+ }
+
+ void
+ invalidate() override
{
+ TaggedEntry::invalidate();
for (auto &entry : mappings) {
entry.address = 0;
entry.counter.reset();
/** use counter, used by SPPv2 */
SatCounter counter;
PatternEntry(size_t num_strides, unsigned counter_bits)
- : strideEntries(num_strides, counter_bits), counter(counter_bits)
- {}
+ : TaggedEntry(), strideEntries(num_strides, counter_bits),
+ counter(counter_bits)
+ {
+ }
/** Reset the entries to their initial values */
- void reset() override
+ void
+ invalidate() override
{
+ TaggedEntry::invalidate();
for (auto &entry : strideEntries) {
entry.counter.reset();
entry.stride = 0;
// this also sets the values of the entry
pst_entry->update(agt_entry);
// Free the AGT entry
- agt_entry.setInvalid();
+ activeGenerationTable.invalidate(&agt_entry);
}
}
}
/** Sequence of accesses */
std::vector<SequenceEntry> sequence;
- ActiveGenerationTableEntry(int num_positions) : paddress(0), pc(0),
+ ActiveGenerationTableEntry(int num_positions)
+ : TaggedEntry(), paddress(0), pc(0),
seqCounter(0), sequence(num_positions)
- {}
+ {
+ }
- void reset() override
+ void
+ invalidate() override
{
+ TaggedEntry::invalidate();
paddress = 0;
pc = 0;
seqCounter = 0;