queued.hh (13422:4ec52da74cd5) queued.hh (13551:f352df8e2863)
1/*
2 * Copyright (c) 2014-2015 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

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

50#include "mem/packet.hh"
51
52struct QueuedPrefetcherParams;
53
54class QueuedPrefetcher : public BasePrefetcher
55{
56 protected:
57 struct DeferredPacket {
1/*
2 * Copyright (c) 2014-2015 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

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

50#include "mem/packet.hh"
51
52struct QueuedPrefetcherParams;
53
54class QueuedPrefetcher : public BasePrefetcher
55{
56 protected:
57 struct DeferredPacket {
58 /** Prefetch info corresponding to this packet */
59 PrefetchInfo pfInfo;
60 /** Time when this prefetch becomes ready */
58 Tick tick;
61 Tick tick;
62 /** The memory packet generated by this prefetch */
59 PacketPtr pkt;
63 PacketPtr pkt;
64 /** The priority of this prefetch */
60 int32_t priority;
65 int32_t priority;
61 DeferredPacket(Tick t, PacketPtr p, int32_t pr) : tick(t), pkt(p),
62 priority(pr) {}
66
67 /**
68 * Constructor
69 * @param pfi PrefechInfo object associated to this packet
70 * @param t Time when this prefetch becomes ready
71 * @param p PacketPtr with the memory request of the prefetch
72 * @param prio This prefetch priority
73 */
74 DeferredPacket(PrefetchInfo const &pfi, Tick t, PacketPtr p,
75 int32_t prio) : pfInfo(pfi), tick(t), pkt(p),
76 priority(prio) {
77 }
78
63 bool operator>(const DeferredPacket& that) const
64 {
65 return priority > that.priority;
66 }
67 bool operator<(const DeferredPacket& that) const
68 {
69 return priority < that.priority;
70 }

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

93
94 /** Snoop the cache before generating prefetch (cheating basically) */
95 const bool cacheSnoop;
96
97 /** Tag prefetch with PC of generating access? */
98 const bool tagPrefetch;
99
100 using const_iterator = std::list<DeferredPacket>::const_iterator;
79 bool operator>(const DeferredPacket& that) const
80 {
81 return priority > that.priority;
82 }
83 bool operator<(const DeferredPacket& that) const
84 {
85 return priority < that.priority;
86 }

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

109
110 /** Snoop the cache before generating prefetch (cheating basically) */
111 const bool cacheSnoop;
112
113 /** Tag prefetch with PC of generating access? */
114 const bool tagPrefetch;
115
116 using const_iterator = std::list<DeferredPacket>::const_iterator;
101 const_iterator inPrefetch(Addr address, bool is_secure) const;
117 const_iterator inPrefetch(const PrefetchInfo &pfi) const;
102 using iterator = std::list<DeferredPacket>::iterator;
118 using iterator = std::list<DeferredPacket>::iterator;
103 iterator inPrefetch(Addr address, bool is_secure);
119 iterator inPrefetch(const PrefetchInfo &pfi);
104
105 // STATS
106 Stats::Scalar pfIdentified;
107 Stats::Scalar pfBufferHit;
108 Stats::Scalar pfInCache;
109 Stats::Scalar pfRemovedFull;
110 Stats::Scalar pfSpanPage;
111
112 public:
113 QueuedPrefetcher(const QueuedPrefetcherParams *p);
114 virtual ~QueuedPrefetcher();
115
120
121 // STATS
122 Stats::Scalar pfIdentified;
123 Stats::Scalar pfBufferHit;
124 Stats::Scalar pfInCache;
125 Stats::Scalar pfRemovedFull;
126 Stats::Scalar pfSpanPage;
127
128 public:
129 QueuedPrefetcher(const QueuedPrefetcherParams *p);
130 virtual ~QueuedPrefetcher();
131
116 void notify(const PacketPtr &pkt) override;
132 void notify(const PacketPtr &pkt, const PrefetchInfo &pfi) override;
117
133
118 PacketPtr insert(AddrPriority& info, bool is_secure);
134 void insert(const PacketPtr &pkt, PrefetchInfo &new_pfi, int32_t priority);
119
135
120 virtual void calculatePrefetch(const PacketPtr &pkt,
136 virtual void calculatePrefetch(const PrefetchInfo &pfi,
121 std::vector<AddrPriority> &addresses) = 0;
122 PacketPtr getPacket() override;
123
124 Tick nextPrefetchReadyTime() const override
125 {
126 return pfq.empty() ? MaxTick : pfq.front().tick;
127 }
128
129 void regStats() override;
130};
131
132#endif //__MEM_CACHE_PREFETCH_QUEUED_HH__
133
137 std::vector<AddrPriority> &addresses) = 0;
138 PacketPtr getPacket() override;
139
140 Tick nextPrefetchReadyTime() const override
141 {
142 return pfq.empty() ? MaxTick : pfq.front().tick;
143 }
144
145 void regStats() override;
146};
147
148#endif //__MEM_CACHE_PREFETCH_QUEUED_HH__
149