summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel <odanrc@yahoo.com.br>2018-11-11 17:56:08 +0100
committerDaniel Carvalho <odanrc@yahoo.com.br>2018-11-15 16:53:16 +0000
commitd7a1db5cc44ad9a1bd5742f9fc4ffa5ea2e3b2f4 (patch)
treed85442687ba2120dd7c1e28e636147f671273300
parent2b619afba17e8aaac90d105e691bd901aff10994 (diff)
downloadgem5-d7a1db5cc44ad9a1bd5742f9fc4ffa5ea2e3b2f4.tar.xz
mem-cache: Add invalidation function to StrideEntry
Add invalidation function to StrideEntry so that every entry can be invalidated appropriately. Change-Id: I38c42b7d7c93d839f797d116f1d2c88572123c0e Signed-off-by: Daniel <odanrc@yahoo.com.br> Reviewed-on: https://gem5-review.googlesource.com/c/14359 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
-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;