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>
This commit is contained in:
Daniel
2018-11-11 17:56:08 +01:00
committed by Daniel Carvalho
parent 2b619afba1
commit d7a1db5cc4
2 changed files with 25 additions and 4 deletions

View File

@@ -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;
}
}

View File

@@ -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;