summaryrefslogtreecommitdiff
path: root/src/mem/cache/prefetch/stride_prefetcher.cc
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2006-12-18 21:53:06 -0800
committerSteve Reinhardt <stever@eecs.umich.edu>2006-12-18 21:53:06 -0800
commitf655932700dbe8d39ee618a2679cb43d2c41eaa1 (patch)
treeeff6791c7d601dd5e1f55b1ac551c231bcb80428 /src/mem/cache/prefetch/stride_prefetcher.cc
parent1428b0de7d3d8903e0674d671829219b554d7aa3 (diff)
downloadgem5-f655932700dbe8d39ee618a2679cb43d2c41eaa1.tar.xz
No need to template prefetcher on cache TagStore type.
--HG-- rename : src/mem/cache/prefetch/tagged_prefetcher_impl.hh => src/mem/cache/prefetch/tagged_prefetcher.cc extra : convert_revision : 56c0b51e424a3a6590332dba4866e69a1ad19598
Diffstat (limited to 'src/mem/cache/prefetch/stride_prefetcher.cc')
-rw-r--r--src/mem/cache/prefetch/stride_prefetcher.cc58
1 files changed, 52 insertions, 6 deletions
diff --git a/src/mem/cache/prefetch/stride_prefetcher.cc b/src/mem/cache/prefetch/stride_prefetcher.cc
index 847f2979e..8d957182a 100644
--- a/src/mem/cache/prefetch/stride_prefetcher.cc
+++ b/src/mem/cache/prefetch/stride_prefetcher.cc
@@ -34,13 +34,59 @@
* Stride Prefetcher template instantiations.
*/
-#include "mem/cache/tags/lru.hh"
-
#include "mem/cache/prefetch/stride_prefetcher.hh"
-// Template Instantiations
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
+void
+StridePrefetcher::calculatePrefetch(PacketPtr &pkt, std::list<Addr> &addresses,
+ std::list<Tick> &delays)
+{
+// Addr blkAddr = pkt->paddr & ~(Addr)(this->blkSize-1);
+ int cpuID = pkt->req->getCpuNum();
+ if (!useCPUId) cpuID = 0;
+
+ /* Scan Table for IAddr Match */
+/* std::list<strideEntry*>::iterator iter;
+ for (iter=table[cpuID].begin();
+ iter !=table[cpuID].end();
+ iter++) {
+ if ((*iter)->IAddr == pkt->pc) break;
+ }
+
+ if (iter != table[cpuID].end()) {
+ //Hit in table
+
+ int newStride = blkAddr - (*iter)->MAddr;
+ if (newStride == (*iter)->stride) {
+ (*iter)->confidence++;
+ }
+ else {
+ (*iter)->stride = newStride;
+ (*iter)->confidence--;
+ }
+
+ (*iter)->MAddr = blkAddr;
-template class StridePrefetcher<LRU >;
+ for (int d=1; d <= degree; d++) {
+ Addr newAddr = blkAddr + d * newStride;
+ if (this->pageStop &&
+ (blkAddr & ~(TheISA::VMPageSize - 1)) !=
+ (newAddr & ~(TheISA::VMPageSize - 1)))
+ {
+ //Spanned the page, so now stop
+ this->pfSpanPage += degree - d + 1;
+ return;
+ }
+ else
+ {
+ addresses.push_back(newAddr);
+ delays.push_back(latency);
+ }
+ }
+ }
+ else {
+ //Miss in table
+ //Find lowest confidence and replace
-#endif //DOXYGEN_SHOULD_SKIP_THIS
+ }
+*/
+}