stride.hh (10054:baaed1733069) stride.hh (10623:b9646f4546ad)
1/*
2 * Copyright (c) 2012-2013 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 31 unchanged lines hidden (view full) ---

40 * Authors: Ron Dreslinski
41 */
42
43/**
44 * @file
45 * Describes a strided prefetcher.
46 */
47
1/*
2 * Copyright (c) 2012-2013 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 31 unchanged lines hidden (view full) ---

40 * Authors: Ron Dreslinski
41 */
42
43/**
44 * @file
45 * Describes a strided prefetcher.
46 */
47
48#ifndef __MEM_CACHE_PREFETCH_STRIDE_PREFETCHER_HH__
49#define __MEM_CACHE_PREFETCH_STRIDE_PREFETCHER_HH__
48#ifndef __MEM_CACHE_PREFETCH_STRIDE_HH__
49#define __MEM_CACHE_PREFETCH_STRIDE_HH__
50
50
51#include <climits>
52
53#include "mem/cache/prefetch/base.hh"
51#include "mem/cache/prefetch/queued.hh"
54#include "params/StridePrefetcher.hh"
55
52#include "params/StridePrefetcher.hh"
53
56class StridePrefetcher : public BasePrefetcher
54class StridePrefetcher : public QueuedPrefetcher
57{
58 protected:
55{
56 protected:
57 static const int maxContexts = 64;
59
58
60 static const int Max_Contexts = 64;
59 const int maxConf;
60 const int threshConf;
61 const int minConf;
62 const int startConf;
61
63
62 // These constants need to be changed with the type of the
63 // 'confidence' field below.
64 static const int Max_Conf = INT_MAX;
65 static const int Min_Conf = INT_MIN;
64 const int pcTableAssoc;
65 const int pcTableSets;
66
66
67 class StrideEntry
67 const bool useMasterId;
68
69 const int degree;
70
71 struct StrideEntry
68 {
72 {
69 public:
73 StrideEntry() : instAddr(0), lastAddr(0), isSecure(false), stride(0),
74 confidence(0)
75 { }
76
70 Addr instAddr;
77 Addr instAddr;
71 Addr missAddr;
78 Addr lastAddr;
72 bool isSecure;
73 int stride;
74 int confidence;
79 bool isSecure;
80 int stride;
81 int confidence;
75 bool tolerance;
76 };
77
82 };
83
78 std::list<StrideEntry*> table[Max_Contexts];
84 StrideEntry **pcTable[maxContexts];
79
85
80 bool instTagged;
86 bool pcTableHit(Addr pc, bool is_secure, int master_id, StrideEntry* &entry);
87 StrideEntry* pcTableVictim(Addr pc, int master_id);
81
88
89 Addr pcHash(Addr pc) const;
82 public:
83
90 public:
91
84 StridePrefetcher(const Params *p)
85 : BasePrefetcher(p), instTagged(p->inst_tagged)
86 {
87 }
92 StridePrefetcher(const StridePrefetcherParams *p);
93 ~StridePrefetcher();
88
94
89 ~StridePrefetcher() {}
90
91 void calculatePrefetch(PacketPtr &pkt, std::list<Addr> &addresses,
92 std::list<Cycles> &delays);
95 void calculatePrefetch(const PacketPtr &pkt, std::vector<Addr> &addresses);
93};
94
96};
97
95#endif // __MEM_CACHE_PREFETCH_STRIDE_PREFETCHER_HH__
98#endif // __MEM_CACHE_PREFETCH_STRIDE_HH__