summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mem/cache/prefetch/stride.cc21
-rw-r--r--src/mem/cache/prefetch/stride.hh8
2 files changed, 25 insertions, 4 deletions
diff --git a/src/mem/cache/prefetch/stride.cc b/src/mem/cache/prefetch/stride.cc
index c09facef0..4520f12c2 100644
--- a/src/mem/cache/prefetch/stride.cc
+++ b/src/mem/cache/prefetch/stride.cc
@@ -57,6 +57,21 @@
#include "debug/HWPrefetch.hh"
#include "params/StridePrefetcher.hh"
+StridePrefetcher::StrideEntry::StrideEntry()
+{
+ invalidate();
+}
+
+void
+StridePrefetcher::StrideEntry::invalidate()
+{
+ instAddr = 0;
+ lastAddr = 0;
+ isSecure = false;
+ stride = 0;
+ confidence = 0;
+}
+
StridePrefetcher::StridePrefetcher(const StridePrefetcherParams *p)
: QueuedPrefetcher(p),
maxConf(p->max_conf),
@@ -182,10 +197,14 @@ StridePrefetcher::calculatePrefetch(const PacketPtr &pkt,
is_secure ? "s" : "ns");
StrideEntry* entry = pcTable->findVictim(pc);
+
+ // Invalidate victim
+ entry->invalidate();
+
+ // Insert new entry's data
entry->instAddr = pc;
entry->lastAddr = pkt_addr;
entry->isSecure= is_secure;
- entry->stride = 0;
entry->confidence = startConf;
}
}
diff --git a/src/mem/cache/prefetch/stride.hh b/src/mem/cache/prefetch/stride.hh
index ec22ca63f..772c3a511 100644
--- a/src/mem/cache/prefetch/stride.hh
+++ b/src/mem/cache/prefetch/stride.hh
@@ -75,9 +75,11 @@ class StridePrefetcher : public QueuedPrefetcher
struct StrideEntry
{
- StrideEntry() : instAddr(0), lastAddr(0), isSecure(false), stride(0),
- confidence(0)
- { }
+ /** Default constructor */
+ StrideEntry();
+
+ /** Invalidate the entry */
+ void invalidate();
Addr instAddr;
Addr lastAddr;