35a36
> #include "arch/isa_traits.hh"
46c47
< only_data(p->prefetch_data_accesses_only)
---
> onlyData(p->prefetch_data_accesses_only)
54a56
> _name = cache->name() + "-pf";
102c104,105
< .desc("number of hwpf that got squashed due to a miss aborting calculation time")
---
> .desc("number of hwpf that got squashed due to a miss "
> "aborting calculation time")
129c132
< DPRINTF(HWPrefetch, "%s:Requesting a hw_pf to issue\n", cache->name());
---
> DPRINTF(HWPrefetch, "Requesting a hw_pf to issue\n");
132c135
< DPRINTF(HWPrefetch, "%s:No HW_PF found\n", cache->name());
---
> DPRINTF(HWPrefetch, "No HW_PF found\n");
137c140
< bool keepTrying = false;
---
> bool keep_trying = false;
142c145
< keepTrying = cache->inCache(pkt->getAddr());
---
> keep_trying = cache->inCache(pkt->getAddr());
143a147,154
>
> if (keep_trying) {
> DPRINTF(HWPrefetch, "addr 0x%x in cache, skipping\n",
> pkt->getAddr());
> delete pkt->req;
> delete pkt;
> }
>
146c157,159
< if (keepTrying) return NULL; //None left, all were in cache
---
> if (keep_trying) {
> return NULL; // None left, all were in cache
> }
148c161
< } while (keepTrying);
---
> } while (keep_trying);
150a164,165
> assert(pkt != NULL);
> DPRINTF(HWPrefetch, "returning 0x%x\n", pkt->getAddr());
154,155c169,171
< void
< BasePrefetcher::handleMiss(PacketPtr &pkt, Tick time)
---
>
> Tick
> BasePrefetcher::notify(PacketPtr &pkt, Tick time)
157,160c173,175
< if (!pkt->req->isUncacheable() && !(pkt->req->isInstRead() && only_data))
< {
< //Calculate the blk address
< Addr blkAddr = pkt->getAddr() & ~(Addr)(blkSize-1);
---
> if (!pkt->req->isUncacheable() && !(pkt->req->isInstRead() && onlyData)) {
> // Calculate the blk address
> Addr blk_addr = pkt->getAddr() & ~(Addr)(blkSize-1);
162,163c177,178
< //Check if miss is in pfq, if so remove it
< std::list<PacketPtr>::iterator iter = inPrefetch(blkAddr);
---
> // Check if miss is in pfq, if so remove it
> std::list<PacketPtr>::iterator iter = inPrefetch(blk_addr);
165c180,181
< DPRINTF(HWPrefetch, "%s:Saw a miss to a queued prefetch, removing it\n", cache->name());
---
> DPRINTF(HWPrefetch, "Saw a miss to a queued prefetch addr: "
> "0x%x, removing it\n", blk_addr);
166a183,184
> delete (*iter)->req;
> delete (*iter);
172,176c190,194
< //Remove anything in queue with delay older than time
< //since everything is inserted in time order, start from end
< //and work until pf.empty() or time is earlier
< //This is done to emulate Aborting the previous work on a new miss
< //Needed for serial calculators like GHB
---
> // Remove anything in queue with delay older than time
> // since everything is inserted in time order, start from end
> // and work until pf.empty() or time is earlier
> // This is done to emulate Aborting the previous work on a new miss
> // Needed for serial calculators like GHB
182c200,204
< pf.pop_back();
---
> DPRINTF(HWPrefetch, "Squashing old prefetch addr: 0x%x\n",
> (*iter)->getAddr());
> delete (*iter)->req;
> delete (*iter);
> pf.erase(iter);
194,199c216,220
< std::list<Addr>::iterator addr = addresses.begin();
< std::list<Tick>::iterator delay = delays.begin();
< while (addr != addresses.end())
< {
< DPRINTF(HWPrefetch, "%s:Found a pf canidate, inserting into prefetch queue\n", cache->name());
< //temp calc this here...
---
> std::list<Addr>::iterator addrIter = addresses.begin();
> std::list<Tick>::iterator delayIter = delays.begin();
> for (; addrIter != addresses.end(); ++addrIter, ++delayIter) {
> Addr addr = *addrIter;
>
201,207d221
< //create a prefetch memreq
< Request * prefetchReq = new Request(*addr, blkSize, 0);
< PacketPtr prefetch;
< prefetch = new Packet(prefetchReq, MemCmd::HardPFReq, -1);
< prefetch->allocate();
< prefetch->req->setThreadContext(pkt->req->contextId(),
< pkt->req->threadId());
209,210c223,225
< prefetch->time = time + (*delay); //@todo ADD LATENCY HERE
< //... initialize
---
> DPRINTF(HWPrefetch, "Found a pf candidate addr: 0x%x, "
> "inserting into prefetch queue with delay %d time %d\n",
> addr, *delayIter, time);
212,218c227,230
< //Check if it is already in the cache
< if (cacheCheckPush) {
< if (cache->inCache(prefetch->getAddr())) {
< addr++;
< delay++;
< continue;
< }
---
> // Check if it is already in the cache
> if (cacheCheckPush && cache->inCache(addr)) {
> DPRINTF(HWPrefetch, "Prefetch addr already in cache\n");
> continue;
221,224c233,235
< //Check if it is already in the miss_queue
< if (cache->inMissQueue(prefetch->getAddr())) {
< addr++;
< delay++;
---
> // Check if it is already in the miss_queue
> if (cache->inMissQueue(addr)) {
> DPRINTF(HWPrefetch, "Prefetch addr already in miss queue\n");
228,229c239,240
< //Check if it is already in the pf buffer
< if (inPrefetch(prefetch->getAddr()) != pf.end()) {
---
> // Check if it is already in the pf buffer
> if (inPrefetch(addr) != pf.end()) {
231,232c242
< addr++;
< delay++;
---
> DPRINTF(HWPrefetch, "Prefetch addr already in pf buffer\n");
236,239c246,257
< //We just remove the head if we are full
< if (pf.size() == size)
< {
< DPRINTF(HWPrefetch, "%s:Inserting into prefetch queue, it was full removing oldest\n", cache->name());
---
> // create a prefetch memreq
> Request *prefetchReq = new Request(*addrIter, blkSize, 0);
> PacketPtr prefetch =
> new Packet(prefetchReq, MemCmd::HardPFReq, Packet::Broadcast);
> prefetch->allocate();
> prefetch->req->setThreadContext(pkt->req->contextId(),
> pkt->req->threadId());
>
> prefetch->time = time + (*delayIter); // @todo ADD LATENCY HERE
>
> // We just remove the head if we are full
> if (pf.size() == size) {
240a259,263
> PacketPtr old_pkt = *pf.begin();
> DPRINTF(HWPrefetch, "Prefetch queue full, "
> "removing oldest 0x%x\n", old_pkt->getAddr());
> delete old_pkt->req;
> delete old_pkt;
245,251d267
<
< //Make sure to request the bus, with proper delay
< cache->requestMemSideBus(BaseCache::Request_PF, prefetch->time);
<
< //Increment through the list
< addr++;
< delay++;
253a270,271
>
> return pf.empty() ? 0 : pf.front()->time;
259c277
< //Guaranteed to only be one match, we always check before inserting
---
> // Guaranteed to only be one match, we always check before inserting
261c279
< for (iter=pf.begin(); iter != pf.end(); iter++) {
---
> for (iter = pf.begin(); iter != pf.end(); iter++) {
269c287,291
<
---
> bool
> BasePrefetcher::samePage(Addr a, Addr b)
> {
> return roundDown(a, TheISA::VMPageSize) == roundDown(b, TheISA::VMPageSize);
> }