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 >> instShiftAmt) & ((ULL(1) << (logSizeBiMP)) - 1)); |
142} 143 144int 145LTAGE::lindex(Addr pc_in) const 146{ |
147 return (((pc_in >> instShiftAmt) & 148 ((ULL(1) << (logSizeLoopPred - 2)) - 1)) << 2); |
149} 150 151int 152LTAGE::F(int A, int size, int bank) const 153{ 154 int A1, A2; 155 156 A = A & ((ULL(1) << size) - 1); --- 10 unchanged lines hidden (view full) --- 167 168// gindex computes a full hash of pc, ghist and pathHist 169int 170LTAGE::gindex(ThreadID tid, Addr pc, int bank) const 171{ 172 int index; 173 int hlen = (histLengths[bank] > 16) ? 16 : histLengths[bank]; 174 index = |
175 (pc >> instShiftAmt) ^ 176 ((pc >> instShiftAmt) >> ((int) abs(tagTableSizes[bank] - bank) + 1)) ^ |
177 threadHistory[tid].computeIndices[bank].comp ^ 178 F(threadHistory[tid].pathHist, hlen, bank); 179 180 return (index & ((ULL(1) << (tagTableSizes[bank])) - 1)); 181} 182 183 184// Tag computation 185uint16_t 186LTAGE::gtag(ThreadID tid, Addr pc, int bank) const 187{ |
188 int tag = (pc >> instShiftAmt) ^ 189 threadHistory[tid].computeTags[0][bank].comp ^ 190 (threadHistory[tid].computeTags[1][bank].comp << 1); |
191 192 return (tag & ((ULL(1) << tagWidths[bank]) - 1)); 193} 194 195 196// Up-down saturating counter 197void 198LTAGE::ctrUpdate(int8_t & ctr, bool taken, int nbits) --- 38 unchanged lines hidden (view full) --- 237 238//loop prediction: only used if high confidence 239bool 240LTAGE::getLoop(Addr pc, BranchInfo* bi) const 241{ 242 bi->loopHit = -1; 243 bi->loopPredValid = false; 244 bi->loopIndex = lindex(pc); |
245 bi->loopTag = ((pc) >> (instShiftAmt + logSizeLoopPred - 2)); |
246 247 for (int i = 0; i < 4; i++) { 248 if (ltable[bi->loopIndex + i].tag == bi->loopTag) { 249 bi->loopHit = i; 250 bi->loopPredValid = (ltable[bi->loopIndex + i].confidence >= 3); 251 bi->currentIter = ltable[bi->loopIndex + i].currentIterSpec; 252 if (ltable[bi->loopIndex + i].currentIterSpec + 1 == 253 ltable[bi->loopIndex + i].numIter) { --- 374 unchanged lines hidden (view full) --- 628} 629 630void 631LTAGE::updateHistories(ThreadID tid, Addr branch_pc, bool taken, void* b) 632{ 633 BranchInfo* bi = (BranchInfo*)(b); 634 ThreadHistory& tHist = threadHistory[tid]; 635 // UPDATE HISTORIES |
636 bool pathbit = ((branch_pc >> instShiftAmt) & 1); |
637 //on a squash, return pointers to this and recompute indices. 638 //update user history 639 updateGHist(tHist.gHist, taken, tHist.globalHistory, tHist.ptGhist); 640 tHist.pathHist = (tHist.pathHist << 1) + pathbit; 641 tHist.pathHist = (tHist.pathHist & ((ULL(1) << 16) - 1)); 642 643 bi->ptGhist = tHist.ptGhist; 644 bi->pathHist = tHist.pathHist; --- 105 unchanged lines hidden --- |