base.cc (8991:69fad6658160) base.cc (9288:3d6da8559605)
1/*
2 * Copyright (c) 2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

40#include "config/the_isa.hh"
41#include "debug/HWPrefetch.hh"
42#include "mem/cache/prefetch/base.hh"
43#include "mem/cache/base.hh"
44#include "mem/request.hh"
45#include "sim/system.hh"
46
47BasePrefetcher::BasePrefetcher(const Params *p)
1/*
2 * Copyright (c) 2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

40#include "config/the_isa.hh"
41#include "debug/HWPrefetch.hh"
42#include "mem/cache/prefetch/base.hh"
43#include "mem/cache/base.hh"
44#include "mem/request.hh"
45#include "sim/system.hh"
46
47BasePrefetcher::BasePrefetcher(const Params *p)
48 : SimObject(p), size(p->size), latency(p->latency), degree(p->degree),
48 : ClockedObject(p), size(p->size), latency(p->latency), degree(p->degree),
49 useMasterId(p->use_master_id), pageStop(!p->cross_pages),
50 serialSquash(p->serial_squash), onlyData(p->data_accesses_only),
51 system(p->sys), masterId(system->getMasterId(name()))
52{
53}
54
55void
56BasePrefetcher::setCache(BaseCache *_cache)

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

207 iter--;
208 }
209 if (pf.empty())
210 cache->deassertMemSideBusRequest(BaseCache::Request_PF);
211 }
212
213
214 std::list<Addr> addresses;
49 useMasterId(p->use_master_id), pageStop(!p->cross_pages),
50 serialSquash(p->serial_squash), onlyData(p->data_accesses_only),
51 system(p->sys), masterId(system->getMasterId(name()))
52{
53}
54
55void
56BasePrefetcher::setCache(BaseCache *_cache)

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

207 iter--;
208 }
209 if (pf.empty())
210 cache->deassertMemSideBusRequest(BaseCache::Request_PF);
211 }
212
213
214 std::list<Addr> addresses;
215 std::list<Tick> delays;
215 std::list<Cycles> delays;
216 calculatePrefetch(pkt, addresses, delays);
217
218 std::list<Addr>::iterator addrIter = addresses.begin();
216 calculatePrefetch(pkt, addresses, delays);
217
218 std::list<Addr>::iterator addrIter = addresses.begin();
219 std::list<Tick>::iterator delayIter = delays.begin();
219 std::list<Cycles>::iterator delayIter = delays.begin();
220 for (; addrIter != addresses.end(); ++addrIter, ++delayIter) {
221 Addr addr = *addrIter;
222
223 pfIdentified++;
224
225 DPRINTF(HWPrefetch, "Found a pf candidate addr: 0x%x, "
226 "inserting into prefetch queue with delay %d time %d\n",
227 addr, *delayIter, time);

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

236 // create a prefetch memreq
237 Request *prefetchReq = new Request(*addrIter, blkSize, 0, masterId);
238 PacketPtr prefetch =
239 new Packet(prefetchReq, MemCmd::HardPFReq);
240 prefetch->allocate();
241 prefetch->req->setThreadContext(pkt->req->contextId(),
242 pkt->req->threadId());
243
220 for (; addrIter != addresses.end(); ++addrIter, ++delayIter) {
221 Addr addr = *addrIter;
222
223 pfIdentified++;
224
225 DPRINTF(HWPrefetch, "Found a pf candidate addr: 0x%x, "
226 "inserting into prefetch queue with delay %d time %d\n",
227 addr, *delayIter, time);

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

236 // create a prefetch memreq
237 Request *prefetchReq = new Request(*addrIter, blkSize, 0, masterId);
238 PacketPtr prefetch =
239 new Packet(prefetchReq, MemCmd::HardPFReq);
240 prefetch->allocate();
241 prefetch->req->setThreadContext(pkt->req->contextId(),
242 pkt->req->threadId());
243
244 prefetch->time = time + (*delayIter); // @todo ADD LATENCY HERE
244 prefetch->time = time + clock * *delayIter;
245
246 // We just remove the head if we are full
247 if (pf.size() == size) {
248 pfRemovedFull++;
249 PacketPtr old_pkt = *pf.begin();
250 DPRINTF(HWPrefetch, "Prefetch queue full, "
251 "removing oldest 0x%x\n", old_pkt->getAddr());
252 delete old_pkt->req;

--- 31 unchanged lines hidden ---
245
246 // We just remove the head if we are full
247 if (pf.size() == size) {
248 pfRemovedFull++;
249 PacketPtr old_pkt = *pf.begin();
250 DPRINTF(HWPrefetch, "Prefetch queue full, "
251 "removing oldest 0x%x\n", old_pkt->getAddr());
252 delete old_pkt->req;

--- 31 unchanged lines hidden ---