summaryrefslogtreecommitdiff
path: root/src/mem/cache/prefetch/stride.hh
diff options
context:
space:
mode:
authorMitch Hayenga <mitch.hayenga@arm.com>2014-12-23 09:31:18 -0500
committerMitch Hayenga <mitch.hayenga@arm.com>2014-12-23 09:31:18 -0500
commitdf82a2d00311b96ec7fefc901232ba01bbf26d39 (patch)
treeef7d4ac6cc316d9a67eada5df423d32cef97173d /src/mem/cache/prefetch/stride.hh
parent6cb58b2bd2ffd19a667e3b9473ff4a0ccfd14c81 (diff)
downloadgem5-df82a2d00311b96ec7fefc901232ba01bbf26d39.tar.xz
mem: Rework the structuring of the prefetchers
Re-organizes the prefetcher class structure. Previously the BasePrefetcher forced multiple assumptions on the prefetchers that inherited from it. This patch makes the BasePrefetcher class truly representative of base functionality. For example, the base class no longer enforces FIFO order. Instead, prefetchers with FIFO requests (like the existing stride and tagged prefetchers) now inherit from a new QueuedPrefetcher base class. Finally, the stride-based prefetcher now assumes a custimizable lookup table (sets/ways) rather than the previous fully associative structure.
Diffstat (limited to 'src/mem/cache/prefetch/stride.hh')
-rw-r--r--src/mem/cache/prefetch/stride.hh55
1 files changed, 29 insertions, 26 deletions
diff --git a/src/mem/cache/prefetch/stride.hh b/src/mem/cache/prefetch/stride.hh
index a491eb687..7d8f12110 100644
--- a/src/mem/cache/prefetch/stride.hh
+++ b/src/mem/cache/prefetch/stride.hh
@@ -45,51 +45,54 @@
* Describes a strided prefetcher.
*/
-#ifndef __MEM_CACHE_PREFETCH_STRIDE_PREFETCHER_HH__
-#define __MEM_CACHE_PREFETCH_STRIDE_PREFETCHER_HH__
+#ifndef __MEM_CACHE_PREFETCH_STRIDE_HH__
+#define __MEM_CACHE_PREFETCH_STRIDE_HH__
-#include <climits>
-
-#include "mem/cache/prefetch/base.hh"
+#include "mem/cache/prefetch/queued.hh"
#include "params/StridePrefetcher.hh"
-class StridePrefetcher : public BasePrefetcher
+class StridePrefetcher : public QueuedPrefetcher
{
protected:
+ static const int maxContexts = 64;
+
+ const int maxConf;
+ const int threshConf;
+ const int minConf;
+ const int startConf;
+
+ const int pcTableAssoc;
+ const int pcTableSets;
- static const int Max_Contexts = 64;
+ const bool useMasterId;
- // These constants need to be changed with the type of the
- // 'confidence' field below.
- static const int Max_Conf = INT_MAX;
- static const int Min_Conf = INT_MIN;
+ const int degree;
- class StrideEntry
+ struct StrideEntry
{
- public:
+ StrideEntry() : instAddr(0), lastAddr(0), isSecure(false), stride(0),
+ confidence(0)
+ { }
+
Addr instAddr;
- Addr missAddr;
+ Addr lastAddr;
bool isSecure;
int stride;
int confidence;
- bool tolerance;
};
- std::list<StrideEntry*> table[Max_Contexts];
+ StrideEntry **pcTable[maxContexts];
- bool instTagged;
+ bool pcTableHit(Addr pc, bool is_secure, int master_id, StrideEntry* &entry);
+ StrideEntry* pcTableVictim(Addr pc, int master_id);
+ Addr pcHash(Addr pc) const;
public:
- StridePrefetcher(const Params *p)
- : BasePrefetcher(p), instTagged(p->inst_tagged)
- {
- }
-
- ~StridePrefetcher() {}
+ StridePrefetcher(const StridePrefetcherParams *p);
+ ~StridePrefetcher();
- void calculatePrefetch(PacketPtr &pkt, std::list<Addr> &addresses,
- std::list<Cycles> &delays);
+ void calculatePrefetch(const PacketPtr &pkt, std::vector<Addr> &addresses);
};
-#endif // __MEM_CACHE_PREFETCH_STRIDE_PREFETCHER_HH__
+#endif // __MEM_CACHE_PREFETCH_STRIDE_HH__