-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsample.cc
36 lines (29 loc) · 958 Bytes
/
sample.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
* A sample prefetcher which does sequential one-block lookahead.
* This means that the prefetcher fetches the next block _after_ the one that
* was just accessed. It also ignores requests to blocks already in the cache.
*/
#include "interface.hh"
void prefetch_init(void)
{
/* Called before any calls to prefetch_access. */
/* This is the place to initialize data structures. */
DPRINTF(HWPrefetch, "Initialized sequential-on-access prefetcher\n");
}
void prefetch_access(AccessStat stat)
{
/* pf_addr is now an address within the _next_ cache block */
Addr pf_addr = stat.mem_addr + BLOCK_SIZE;
/*
* Issue a prefetch request if a demand miss occured,
* and the block is not already in cache.
*/
if (stat.miss && !in_cache(pf_addr)) {
issue_prefetch(pf_addr);
}
}
void prefetch_complete(Addr addr) {
/*
* Called when a block requested by the prefetcher has been loaded.
*/
}