Deleted Added
sdiff udiff text old ( 10627:63edd4a1243f ) new ( 10771:ea35886cd847 )
full compact
1/*
2 * Copyright (c) 2012-2013 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
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

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

54 : QueuedPrefetcher(p),
55 maxConf(p->max_conf),
56 threshConf(p->thresh_conf),
57 minConf(p->min_conf),
58 startConf(p->start_conf),
59 pcTableAssoc(p->table_assoc),
60 pcTableSets(p->table_sets),
61 useMasterId(p->use_master_id),
62 degree(p->degree)
63{
64 // Don't consult stride prefetcher on instruction accesses
65 onInst = false;
66
67 assert(isPowerOf2(pcTableSets));
68
69 for (int c = 0; c < maxContexts; c++) {
70 pcTable[c] = new StrideEntry*[pcTableSets];
71 for (int s = 0; s < pcTableSets; s++) {
72 pcTable[c][s] = new StrideEntry[pcTableAssoc];
73 }
74 }
75}
76
77StridePrefetcher::~StridePrefetcher()
78{
79 for (int c = 0; c < maxContexts; c++) {
80 for (int s = 0; s < pcTableSets; s++) {
81 delete[] pcTable[c][s];
82 }
83 }
84}
85
86void
87StridePrefetcher::calculatePrefetch(const PacketPtr &pkt,
88 std::vector<Addr> &addresses)
89{
90 if (!pkt->req->hasPC()) {
91 DPRINTF(HWPrefetch, "Ignoring request with no PC.\n");
92 return;
93 }
94
95 // Get required packet info
96 Addr pkt_addr = pkt->getAddr();
97 Addr pc = pkt->req->getPC();
98 bool is_secure = pkt->isSecure();
99 MasterID master_id = useMasterId ? pkt->req->masterId() : 0;
100
101 assert(master_id < maxContexts);
102
103 // Lookup pc-based information
104 StrideEntry *entry;
105
106 if(pcTableHit(pc, is_secure, master_id, entry)) {
107 // Hit in table
108 int new_stride = pkt_addr - entry->lastAddr;
109 bool stride_match = (new_stride == entry->stride);
110

--- 98 unchanged lines hidden ---