base.cc (13551:f352df8e2863) base.cc (13624:3d8220c2d41d)
1/*
2 * Copyright (c) 2013-2014 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

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

76}
77
78BasePrefetcher::BasePrefetcher(const BasePrefetcherParams *p)
79 : ClockedObject(p), listeners(), cache(nullptr), blkSize(p->block_size),
80 lBlkSize(floorLog2(blkSize)), onMiss(p->on_miss), onRead(p->on_read),
81 onWrite(p->on_write), onData(p->on_data), onInst(p->on_inst),
82 masterId(p->sys->getMasterId(this)), pageBytes(p->sys->getPageBytes()),
83 prefetchOnAccess(p->prefetch_on_access),
1/*
2 * Copyright (c) 2013-2014 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

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

76}
77
78BasePrefetcher::BasePrefetcher(const BasePrefetcherParams *p)
79 : ClockedObject(p), listeners(), cache(nullptr), blkSize(p->block_size),
80 lBlkSize(floorLog2(blkSize)), onMiss(p->on_miss), onRead(p->on_read),
81 onWrite(p->on_write), onData(p->on_data), onInst(p->on_inst),
82 masterId(p->sys->getMasterId(this)), pageBytes(p->sys->getPageBytes()),
83 prefetchOnAccess(p->prefetch_on_access),
84 useVirtualAddresses(p->use_virtual_addresses)
84 useVirtualAddresses(p->use_virtual_addresses), issuedPrefetches(0),
85 usefulPrefetches(0)
85{
86}
87
88void
89BasePrefetcher::setCache(BaseCache *_cache)
90{
91 assert(!cache);
92 cache = _cache;

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

141
142bool
143BasePrefetcher::inMissQueue(Addr addr, bool is_secure) const
144{
145 return cache->inMissQueue(addr, is_secure);
146}
147
148bool
86{
87}
88
89void
90BasePrefetcher::setCache(BaseCache *_cache)
91{
92 assert(!cache);
93 cache = _cache;

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

142
143bool
144BasePrefetcher::inMissQueue(Addr addr, bool is_secure) const
145{
146 return cache->inMissQueue(addr, is_secure);
147}
148
149bool
150BasePrefetcher::hasBeenPrefetched(Addr addr, bool is_secure) const
151{
152 return cache->hasBeenPrefetched(addr, is_secure);
153}
154
155bool
149BasePrefetcher::samePage(Addr a, Addr b) const
150{
151 return roundDown(a, pageBytes) == roundDown(b, pageBytes);
152}
153
154Addr
155BasePrefetcher::blockAddress(Addr a) const
156{

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

185BasePrefetcher::probeNotify(const PacketPtr &pkt)
186{
187 // Don't notify prefetcher on SWPrefetch, cache maintenance
188 // operations or for writes that we are coaslescing.
189 if (pkt->cmd.isSWPrefetch()) return;
190 if (pkt->req->isCacheMaintenance()) return;
191 if (pkt->isWrite() && cache != nullptr && cache->coalesce()) return;
192
156BasePrefetcher::samePage(Addr a, Addr b) const
157{
158 return roundDown(a, pageBytes) == roundDown(b, pageBytes);
159}
160
161Addr
162BasePrefetcher::blockAddress(Addr a) const
163{

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

192BasePrefetcher::probeNotify(const PacketPtr &pkt)
193{
194 // Don't notify prefetcher on SWPrefetch, cache maintenance
195 // operations or for writes that we are coaslescing.
196 if (pkt->cmd.isSWPrefetch()) return;
197 if (pkt->req->isCacheMaintenance()) return;
198 if (pkt->isWrite() && cache != nullptr && cache->coalesce()) return;
199
200 if (hasBeenPrefetched(pkt->getAddr(), pkt->isSecure())) {
201 usefulPrefetches += 1;
202 }
203
193 // Verify this access type is observed by prefetcher
194 if (observeAccess(pkt)) {
195 if (useVirtualAddresses && pkt->req->hasVaddr()) {
196 PrefetchInfo pfi(pkt, pkt->req->getVaddr());
197 notify(pkt, pfi);
198 } else if (!useVirtualAddresses && pkt->req->hasPaddr()) {
199 PrefetchInfo pfi(pkt, pkt->req->getPaddr());
200 notify(pkt, pfi);

--- 27 unchanged lines hidden ---
204 // Verify this access type is observed by prefetcher
205 if (observeAccess(pkt)) {
206 if (useVirtualAddresses && pkt->req->hasVaddr()) {
207 PrefetchInfo pfi(pkt, pkt->req->getVaddr());
208 notify(pkt, pfi);
209 } else if (!useVirtualAddresses && pkt->req->hasPaddr()) {
210 PrefetchInfo pfi(pkt, pkt->req->getPaddr());
211 notify(pkt, pfi);

--- 27 unchanged lines hidden ---