Deleted Added
sdiff udiff text old ( 12334:e0ab29a34764 ) new ( 13413:b84a7c832ead )
full compact
1/*
2 * Copyright (c) 2014 The University of Wisconsin
3 *
4 * Copyright (c) 2006 INRIA (Institut National de Recherche en
5 * Informatique et en Automatique / French National Research Institute
6 * for Computer Science and Applied Mathematics)
7 *
8 * All rights reserved.

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

133 tableTags = new int [nHistoryTables+1];
134
135 loopUseCounter = 0;
136}
137
138int
139LTAGE::bindex(Addr pc_in) const
140{
141 return ((pc_in) & ((ULL(1) << (logSizeBiMP)) - 1));
142}
143
144int
145LTAGE::lindex(Addr pc_in) const
146{
147 return (((pc_in) & ((ULL(1) << (logSizeLoopPred - 2)) - 1)) << 2);
148}
149
150int
151LTAGE::F(int A, int size, int bank) const
152{
153 int A1, A2;
154
155 A = A & ((ULL(1) << size) - 1);

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

166
167// gindex computes a full hash of pc, ghist and pathHist
168int
169LTAGE::gindex(ThreadID tid, Addr pc, int bank) const
170{
171 int index;
172 int hlen = (histLengths[bank] > 16) ? 16 : histLengths[bank];
173 index =
174 (pc) ^ ((pc) >> ((int) abs(tagTableSizes[bank] - bank) + 1)) ^
175 threadHistory[tid].computeIndices[bank].comp ^
176 F(threadHistory[tid].pathHist, hlen, bank);
177
178 return (index & ((ULL(1) << (tagTableSizes[bank])) - 1));
179}
180
181
182// Tag computation
183uint16_t
184LTAGE::gtag(ThreadID tid, Addr pc, int bank) const
185{
186 int tag = (pc) ^ threadHistory[tid].computeTags[0][bank].comp
187 ^ (threadHistory[tid].computeTags[1][bank].comp << 1);
188
189 return (tag & ((ULL(1) << tagWidths[bank]) - 1));
190}
191
192
193// Up-down saturating counter
194void
195LTAGE::ctrUpdate(int8_t & ctr, bool taken, int nbits)

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

234
235//loop prediction: only used if high confidence
236bool
237LTAGE::getLoop(Addr pc, BranchInfo* bi) const
238{
239 bi->loopHit = -1;
240 bi->loopPredValid = false;
241 bi->loopIndex = lindex(pc);
242 bi->loopTag = ((pc) >> (logSizeLoopPred - 2));
243
244 for (int i = 0; i < 4; i++) {
245 if (ltable[bi->loopIndex + i].tag == bi->loopTag) {
246 bi->loopHit = i;
247 bi->loopPredValid = (ltable[bi->loopIndex + i].confidence >= 3);
248 bi->currentIter = ltable[bi->loopIndex + i].currentIterSpec;
249 if (ltable[bi->loopIndex + i].currentIterSpec + 1 ==
250 ltable[bi->loopIndex + i].numIter) {

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

625}
626
627void
628LTAGE::updateHistories(ThreadID tid, Addr branch_pc, bool taken, void* b)
629{
630 BranchInfo* bi = (BranchInfo*)(b);
631 ThreadHistory& tHist = threadHistory[tid];
632 // UPDATE HISTORIES
633 bool pathbit = ((branch_pc) & 1);
634 //on a squash, return pointers to this and recompute indices.
635 //update user history
636 updateGHist(tHist.gHist, taken, tHist.globalHistory, tHist.ptGhist);
637 tHist.pathHist = (tHist.pathHist << 1) + pathbit;
638 tHist.pathHist = (tHist.pathHist & ((ULL(1) << 16) - 1));
639
640 bi->ptGhist = tHist.ptGhist;
641 bi->pathHist = tHist.pathHist;

--- 105 unchanged lines hidden ---