ltage.cc (13443:a111cb197897) | ltage.cc (13444:26f81be73cb7) |
---|---|
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. --- 35 unchanged lines hidden (view full) --- 44#include "base/logging.hh" 45#include "base/random.hh" 46#include "base/trace.hh" 47#include "debug/Fetch.hh" 48#include "debug/LTage.hh" 49 50LTAGE::LTAGE(const LTAGEParams *params) 51 : BPredUnit(params), | 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. --- 35 unchanged lines hidden (view full) --- 44#include "base/logging.hh" 45#include "base/random.hh" 46#include "base/trace.hh" 47#include "debug/Fetch.hh" 48#include "debug/LTage.hh" 49 50LTAGE::LTAGE(const LTAGEParams *params) 51 : BPredUnit(params), |
52 logSizeBiMP(params->logSizeBiMP), | |
53 logRatioBiModalHystEntries(params->logRatioBiModalHystEntries), | 52 logRatioBiModalHystEntries(params->logRatioBiModalHystEntries), |
54 logSizeTagTables(params->logSizeTagTables), | |
55 logSizeLoopPred(params->logSizeLoopPred), 56 nHistoryTables(params->nHistoryTables), 57 tagTableCounterBits(params->tagTableCounterBits), 58 tagTableUBits(params->tagTableUBits), 59 histBufferSize(params->histBufferSize), 60 minHist(params->minHist), 61 maxHist(params->maxHist), | 53 logSizeLoopPred(params->logSizeLoopPred), 54 nHistoryTables(params->nHistoryTables), 55 tagTableCounterBits(params->tagTableCounterBits), 56 tagTableUBits(params->tagTableUBits), 57 histBufferSize(params->histBufferSize), 58 minHist(params->minHist), 59 maxHist(params->maxHist), |
62 minTagWidth(params->minTagWidth), | 60 pathHistBits(params->pathHistBits), |
63 loopTableAgeBits(params->loopTableAgeBits), 64 loopTableConfidenceBits(params->loopTableConfidenceBits), 65 loopTableTagBits(params->loopTableTagBits), 66 loopTableIterBits(params->loopTableIterBits), | 61 loopTableAgeBits(params->loopTableAgeBits), 62 loopTableConfidenceBits(params->loopTableConfidenceBits), 63 loopTableTagBits(params->loopTableTagBits), 64 loopTableIterBits(params->loopTableIterBits), |
65 logLoopTableAssoc(params->logLoopTableAssoc), |
|
67 confidenceThreshold((1 << loopTableConfidenceBits) - 1), 68 loopTagMask((1 << loopTableTagBits) - 1), 69 loopNumIterMask((1 << loopTableIterBits) - 1), | 66 confidenceThreshold((1 << loopTableConfidenceBits) - 1), 67 loopTagMask((1 << loopTableTagBits) - 1), 68 loopNumIterMask((1 << loopTableIterBits) - 1), |
70 threadHistory(params->numThreads) | 69 tagTableTagWidths(params->tagTableTagWidths), 70 logTagTableSizes(params->logTagTableSizes), 71 threadHistory(params->numThreads), 72 logUResetPeriod(params->logUResetPeriod), 73 useAltOnNaBits(params->useAltOnNaBits), 74 withLoopBits(params->withLoopBits) |
71{ 72 // Current method for periodically resetting the u counter bits only 73 // works for 1 or 2 bits 74 // Also make sure that it is not 0 75 assert(tagTableUBits <= 2 && (tagTableUBits > 0)); 76 77 // we use uint16_t type for these vales, so they cannot be more than 78 // 16 bits 79 assert(loopTableTagBits <= 16); 80 assert(loopTableIterBits <= 16); 81 | 75{ 76 // Current method for periodically resetting the u counter bits only 77 // works for 1 or 2 bits 78 // Also make sure that it is not 0 79 assert(tagTableUBits <= 2 && (tagTableUBits > 0)); 80 81 // we use uint16_t type for these vales, so they cannot be more than 82 // 16 bits 83 assert(loopTableTagBits <= 16); 84 assert(loopTableIterBits <= 16); 85 |
86 assert(logSizeLoopPred >= logLoopTableAssoc); 87 88 // we use int type for the path history, so it cannot be more than 89 // its size 90 assert(pathHistBits <= (sizeof(int)*8)); 91 92 // initialize the counter to half of the period 93 assert(logUResetPeriod != 0); 94 tCounter = ULL(1) << (logUResetPeriod - 1); 95 |
|
82 assert(params->histBufferSize > params->maxHist * 2); 83 useAltPredForNewlyAllocated = 0; | 96 assert(params->histBufferSize > params->maxHist * 2); 97 useAltPredForNewlyAllocated = 0; |
84 logTick = 19; 85 tCounter = ULL(1) << (logTick - 1); | |
86 87 for (auto& history : threadHistory) { 88 history.pathHist = 0; 89 history.globalHistory = new uint8_t[histBufferSize]; 90 history.gHist = history.globalHistory; 91 memset(history.gHist, 0, histBufferSize); 92 history.ptGhist = 0; 93 } --- 4 unchanged lines hidden (view full) --- 98 99 for (int i = 2; i <= nHistoryTables; i++) { 100 histLengths[i] = (int) (((double) minHist * 101 pow ((double) (maxHist) / (double) minHist, 102 (double) (i - 1) / (double) ((nHistoryTables- 1)))) 103 + 0.5); 104 } 105 | 98 99 for (auto& history : threadHistory) { 100 history.pathHist = 0; 101 history.globalHistory = new uint8_t[histBufferSize]; 102 history.gHist = history.globalHistory; 103 memset(history.gHist, 0, histBufferSize); 104 history.ptGhist = 0; 105 } --- 4 unchanged lines hidden (view full) --- 110 111 for (int i = 2; i <= nHistoryTables; i++) { 112 histLengths[i] = (int) (((double) minHist * 113 pow ((double) (maxHist) / (double) minHist, 114 (double) (i - 1) / (double) ((nHistoryTables- 1)))) 115 + 0.5); 116 } 117 |
106 tagWidths[1] = minTagWidth; 107 tagWidths[2] = minTagWidth; 108 tagWidths[3] = minTagWidth + 1; 109 tagWidths[4] = minTagWidth + 1; 110 tagWidths[5] = minTagWidth + 2; 111 tagWidths[6] = minTagWidth + 3; 112 tagWidths[7] = minTagWidth + 4; 113 tagWidths[8] = minTagWidth + 5; 114 tagWidths[9] = minTagWidth + 5; 115 tagWidths[10] = minTagWidth + 6; 116 tagWidths[11] = minTagWidth + 7; 117 tagWidths[12] = minTagWidth + 8; | 118 assert(tagTableTagWidths.size() == (nHistoryTables+1)); 119 assert(logTagTableSizes.size() == (nHistoryTables+1)); |
118 | 120 |
119 for (int i = 1; i <= 2; i++) 120 tagTableSizes[i] = logSizeTagTables - 1; 121 for (int i = 3; i <= 6; i++) 122 tagTableSizes[i] = logSizeTagTables; 123 for (int i = 7; i <= 10; i++) 124 tagTableSizes[i] = logSizeTagTables - 1; 125 for (int i = 11; i <= 12; i++) 126 tagTableSizes[i] = logSizeTagTables - 2; | 121 // First entry is for the Bimodal table and it is untagged in this 122 // implementation 123 assert(tagTableTagWidths[0] == 0); |
127 128 for (auto& history : threadHistory) { 129 history.computeIndices = new FoldedHistory[nHistoryTables+1]; 130 history.computeTags[0] = new FoldedHistory[nHistoryTables+1]; 131 history.computeTags[1] = new FoldedHistory[nHistoryTables+1]; 132 133 for (int i = 1; i <= nHistoryTables; i++) { | 124 125 for (auto& history : threadHistory) { 126 history.computeIndices = new FoldedHistory[nHistoryTables+1]; 127 history.computeTags[0] = new FoldedHistory[nHistoryTables+1]; 128 history.computeTags[1] = new FoldedHistory[nHistoryTables+1]; 129 130 for (int i = 1; i <= nHistoryTables; i++) { |
134 history.computeIndices[i].init(histLengths[i], (tagTableSizes[i])); | 131 history.computeIndices[i].init( 132 histLengths[i], (logTagTableSizes[i])); |
135 history.computeTags[0][i].init( | 133 history.computeTags[0][i].init( |
136 history.computeIndices[i].origLength, tagWidths[i]); | 134 history.computeIndices[i].origLength, tagTableTagWidths[i]); |
137 history.computeTags[1][i].init( | 135 history.computeTags[1][i].init( |
138 history.computeIndices[i].origLength, tagWidths[i] - 1); | 136 history.computeIndices[i].origLength, tagTableTagWidths[i]-1); |
139 DPRINTF(LTage, "HistLength:%d, TTSize:%d, TTTWidth:%d\n", | 137 DPRINTF(LTage, "HistLength:%d, TTSize:%d, TTTWidth:%d\n", |
140 histLengths[i], tagTableSizes[i], tagWidths[i]); | 138 histLengths[i], logTagTableSizes[i], tagTableTagWidths[i]); |
141 } 142 } 143 | 139 } 140 } 141 |
144 const uint64_t bimodalTableSize = ULL(1) << logSizeBiMP; | 142 const uint64_t bimodalTableSize = ULL(1) << logTagTableSizes[0]; |
145 btablePrediction.resize(bimodalTableSize, false); 146 btableHysteresis.resize(bimodalTableSize >> logRatioBiModalHystEntries, 147 true); 148 149 ltable = new LoopEntry[ULL(1) << logSizeLoopPred]; 150 gtable = new TageEntry*[nHistoryTables + 1]; 151 for (int i = 1; i <= nHistoryTables; i++) { | 143 btablePrediction.resize(bimodalTableSize, false); 144 btableHysteresis.resize(bimodalTableSize >> logRatioBiModalHystEntries, 145 true); 146 147 ltable = new LoopEntry[ULL(1) << logSizeLoopPred]; 148 gtable = new TageEntry*[nHistoryTables + 1]; 149 for (int i = 1; i <= nHistoryTables; i++) { |
152 gtable[i] = new TageEntry[1<<(tagTableSizes[i])]; | 150 gtable[i] = new TageEntry[1<<(logTagTableSizes[i])]; |
153 } 154 155 tableIndices = new int [nHistoryTables+1]; 156 tableTags = new int [nHistoryTables+1]; 157 158 loopUseCounter = 0; 159} 160 161int 162LTAGE::bindex(Addr pc_in) const 163{ | 151 } 152 153 tableIndices = new int [nHistoryTables+1]; 154 tableTags = new int [nHistoryTables+1]; 155 156 loopUseCounter = 0; 157} 158 159int 160LTAGE::bindex(Addr pc_in) const 161{ |
164 return ((pc_in >> instShiftAmt) & ((ULL(1) << (logSizeBiMP)) - 1)); | 162 return ((pc_in >> instShiftAmt) & ((ULL(1) << (logTagTableSizes[0])) - 1)); |
165} 166 167int 168LTAGE::lindex(Addr pc_in) const 169{ | 163} 164 165int 166LTAGE::lindex(Addr pc_in) const 167{ |
170 return (((pc_in >> instShiftAmt) & 171 ((ULL(1) << (logSizeLoopPred - 2)) - 1)) << 2); | 168 // The loop table is implemented as a linear table 169 // If associativity is N (N being 1 << logLoopTableAssoc), 170 // the first N entries are for set 0, the next N entries are for set 1, 171 // and so on. 172 // Thus, this function calculates the set and then it gets left shifted 173 // by logLoopTableAssoc in order to return the index of the first of the 174 // N entries of the set 175 Addr mask = (ULL(1) << (logSizeLoopPred - logLoopTableAssoc)) - 1; 176 return (((pc_in >> instShiftAmt) & mask) << logLoopTableAssoc); |
172} 173 174int 175LTAGE::F(int A, int size, int bank) const 176{ 177 int A1, A2; 178 179 A = A & ((ULL(1) << size) - 1); | 177} 178 179int 180LTAGE::F(int A, int size, int bank) const 181{ 182 int A1, A2; 183 184 A = A & ((ULL(1) << size) - 1); |
180 A1 = (A & ((ULL(1) << tagTableSizes[bank]) - 1)); 181 A2 = (A >> tagTableSizes[bank]); 182 A2 = ((A2 << bank) & ((ULL(1) << tagTableSizes[bank]) - 1)) 183 + (A2 >> (tagTableSizes[bank] - bank)); | 185 A1 = (A & ((ULL(1) << logTagTableSizes[bank]) - 1)); 186 A2 = (A >> logTagTableSizes[bank]); 187 A2 = ((A2 << bank) & ((ULL(1) << logTagTableSizes[bank]) - 1)) 188 + (A2 >> (logTagTableSizes[bank] - bank)); |
184 A = A1 ^ A2; | 189 A = A1 ^ A2; |
185 A = ((A << bank) & ((ULL(1) << tagTableSizes[bank]) - 1)) 186 + (A >> (tagTableSizes[bank] - bank)); | 190 A = ((A << bank) & ((ULL(1) << logTagTableSizes[bank]) - 1)) 191 + (A >> (logTagTableSizes[bank] - bank)); |
187 return (A); 188} 189 190 191// gindex computes a full hash of pc, ghist and pathHist 192int 193LTAGE::gindex(ThreadID tid, Addr pc, int bank) const 194{ 195 int index; | 192 return (A); 193} 194 195 196// gindex computes a full hash of pc, ghist and pathHist 197int 198LTAGE::gindex(ThreadID tid, Addr pc, int bank) const 199{ 200 int index; |
196 int hlen = (histLengths[bank] > 16) ? 16 : histLengths[bank]; | 201 int hlen = (histLengths[bank] > pathHistBits) ? pathHistBits : 202 histLengths[bank]; 203 const Addr shiftedPc = pc >> instShiftAmt; |
197 index = | 204 index = |
198 (pc >> instShiftAmt) ^ 199 ((pc >> instShiftAmt) >> ((int) abs(tagTableSizes[bank] - bank) + 1)) ^ | 205 shiftedPc ^ 206 (shiftedPc >> ((int) abs(logTagTableSizes[bank] - bank) + 1)) ^ |
200 threadHistory[tid].computeIndices[bank].comp ^ 201 F(threadHistory[tid].pathHist, hlen, bank); 202 | 207 threadHistory[tid].computeIndices[bank].comp ^ 208 F(threadHistory[tid].pathHist, hlen, bank); 209 |
203 return (index & ((ULL(1) << (tagTableSizes[bank])) - 1)); | 210 return (index & ((ULL(1) << (logTagTableSizes[bank])) - 1)); |
204} 205 206 207// Tag computation 208uint16_t 209LTAGE::gtag(ThreadID tid, Addr pc, int bank) const 210{ 211 int tag = (pc >> instShiftAmt) ^ 212 threadHistory[tid].computeTags[0][bank].comp ^ 213 (threadHistory[tid].computeTags[1][bank].comp << 1); 214 | 211} 212 213 214// Tag computation 215uint16_t 216LTAGE::gtag(ThreadID tid, Addr pc, int bank) const 217{ 218 int tag = (pc >> instShiftAmt) ^ 219 threadHistory[tid].computeTags[0][bank].comp ^ 220 (threadHistory[tid].computeTags[1][bank].comp << 1); 221 |
215 return (tag & ((ULL(1) << tagWidths[bank]) - 1)); | 222 return (tag & ((ULL(1) << tagTableTagWidths[bank]) - 1)); |
216} 217 218 219// Up-down saturating counter 220void 221LTAGE::ctrUpdate(int8_t & ctr, bool taken, int nbits) 222{ 223 assert(nbits <= sizeof(int8_t) << 3); --- 51 unchanged lines hidden (view full) --- 275 276//loop prediction: only used if high confidence 277bool 278LTAGE::getLoop(Addr pc, BranchInfo* bi) const 279{ 280 bi->loopHit = -1; 281 bi->loopPredValid = false; 282 bi->loopIndex = lindex(pc); | 223} 224 225 226// Up-down saturating counter 227void 228LTAGE::ctrUpdate(int8_t & ctr, bool taken, int nbits) 229{ 230 assert(nbits <= sizeof(int8_t) << 3); --- 51 unchanged lines hidden (view full) --- 282 283//loop prediction: only used if high confidence 284bool 285LTAGE::getLoop(Addr pc, BranchInfo* bi) const 286{ 287 bi->loopHit = -1; 288 bi->loopPredValid = false; 289 bi->loopIndex = lindex(pc); |
283 bi->loopTag = ((pc) >> (instShiftAmt + logSizeLoopPred - 2)) & loopTagMask; | 290 unsigned pcShift = instShiftAmt + logSizeLoopPred - logLoopTableAssoc; 291 bi->loopTag = ((pc) >> pcShift) & loopTagMask; |
284 | 292 |
285 for (int i = 0; i < 4; i++) { | 293 for (int i = 0; i < (1 << logLoopTableAssoc); i++) { |
286 if (ltable[bi->loopIndex + i].tag == bi->loopTag) { 287 bi->loopHit = i; 288 bi->loopPredValid = 289 ltable[bi->loopIndex + i].confidence == confidenceThreshold; 290 bi->currentIter = ltable[bi->loopIndex + i].currentIterSpec; 291 if (ltable[bi->loopIndex + i].currentIterSpec + 1 == 292 ltable[bi->loopIndex + i].numIter) { 293 return !(ltable[bi->loopIndex + i].dir); --- 80 unchanged lines hidden (view full) --- 374 } 375 } 376 ltable[idx].currentIter = 0; 377 } 378 379 } else if (taken) { 380 //try to allocate an entry on taken branch 381 int nrand = random_mt.random<int>(); | 294 if (ltable[bi->loopIndex + i].tag == bi->loopTag) { 295 bi->loopHit = i; 296 bi->loopPredValid = 297 ltable[bi->loopIndex + i].confidence == confidenceThreshold; 298 bi->currentIter = ltable[bi->loopIndex + i].currentIterSpec; 299 if (ltable[bi->loopIndex + i].currentIterSpec + 1 == 300 ltable[bi->loopIndex + i].numIter) { 301 return !(ltable[bi->loopIndex + i].dir); --- 80 unchanged lines hidden (view full) --- 382 } 383 } 384 ltable[idx].currentIter = 0; 385 } 386 387 } else if (taken) { 388 //try to allocate an entry on taken branch 389 int nrand = random_mt.random<int>(); |
382 for (int i = 0; i < 4; i++) { 383 int loop_hit = (nrand + i) & 3; | 390 for (int i = 0; i < (1 << logLoopTableAssoc); i++) { 391 int loop_hit = (nrand + i) & ((1 << logLoopTableAssoc) - 1); |
384 idx = bi->loopIndex + loop_hit; 385 if (ltable[idx].age == 0) { 386 DPRINTF(LTage, "Allocating loop pred entry for branch %lx\n", 387 pc); 388 ltable[idx].dir = !taken; 389 ltable[idx].tag = bi->loopTag; 390 ltable[idx].numIter = 0; 391 ltable[idx].age = (1 << loopTableAgeBits) - 1; --- 155 unchanged lines hidden (view full) --- 547 if (bi->condBranch) { 548 DPRINTF(LTage, "Updating tables for branch:%lx; taken?:%d\n", 549 branch_pc, taken); 550 // first update the loop predictor 551 loopUpdate(pc, taken, bi); 552 553 if (bi->loopPredValid) { 554 if (bi->tagePred != bi->loopPred) { | 392 idx = bi->loopIndex + loop_hit; 393 if (ltable[idx].age == 0) { 394 DPRINTF(LTage, "Allocating loop pred entry for branch %lx\n", 395 pc); 396 ltable[idx].dir = !taken; 397 ltable[idx].tag = bi->loopTag; 398 ltable[idx].numIter = 0; 399 ltable[idx].age = (1 << loopTableAgeBits) - 1; --- 155 unchanged lines hidden (view full) --- 555 if (bi->condBranch) { 556 DPRINTF(LTage, "Updating tables for branch:%lx; taken?:%d\n", 557 branch_pc, taken); 558 // first update the loop predictor 559 loopUpdate(pc, taken, bi); 560 561 if (bi->loopPredValid) { 562 if (bi->tagePred != bi->loopPred) { |
555 ctrUpdate(loopUseCounter, (bi->loopPred== taken), 7); | 563 ctrUpdate(loopUseCounter, 564 (bi->loopPred == taken), 565 withLoopBits); |
556 } 557 } 558 559 // TAGE UPDATE 560 // try to allocate a new entries only if prediction was wrong 561 bool longest_match_pred = false; 562 bool alloc = (bi->tagePred != taken) && (bi->hitBank < nHistoryTables); 563 if (bi->hitBank > 0) { --- 6 unchanged lines hidden (view full) --- 570 if (PseudoNewAlloc) { 571 if (longest_match_pred == taken) { 572 alloc = false; 573 } 574 // if it was delivering the correct prediction, no need to 575 // allocate new entry even if the overall prediction was false 576 if (longest_match_pred != bi->altTaken) { 577 ctrUpdate(useAltPredForNewlyAllocated, | 566 } 567 } 568 569 // TAGE UPDATE 570 // try to allocate a new entries only if prediction was wrong 571 bool longest_match_pred = false; 572 bool alloc = (bi->tagePred != taken) && (bi->hitBank < nHistoryTables); 573 if (bi->hitBank > 0) { --- 6 unchanged lines hidden (view full) --- 580 if (PseudoNewAlloc) { 581 if (longest_match_pred == taken) { 582 alloc = false; 583 } 584 // if it was delivering the correct prediction, no need to 585 // allocate new entry even if the overall prediction was false 586 if (longest_match_pred != bi->altTaken) { 587 ctrUpdate(useAltPredForNewlyAllocated, |
578 bi->altTaken == taken, 4); | 588 bi->altTaken == taken, useAltOnNaBits); |
579 } 580 } 581 } 582 583 if (alloc) { 584 // is there some "unuseful" entry to allocate 585 uint8_t min = 1; 586 for (int i = nHistoryTables; i > bi->hitBank; i--) { --- 25 unchanged lines hidden (view full) --- 612 gtable[i][bi->tableIndices[i]].tag = bi->tableTags[i]; 613 gtable[i][bi->tableIndices[i]].ctr = (taken) ? 0 : -1; 614 break; 615 } 616 } 617 } 618 //periodic reset of u: reset is not complete but bit by bit 619 tCounter++; | 589 } 590 } 591 } 592 593 if (alloc) { 594 // is there some "unuseful" entry to allocate 595 uint8_t min = 1; 596 for (int i = nHistoryTables; i > bi->hitBank; i--) { --- 25 unchanged lines hidden (view full) --- 622 gtable[i][bi->tableIndices[i]].tag = bi->tableTags[i]; 623 gtable[i][bi->tableIndices[i]].ctr = (taken) ? 0 : -1; 624 break; 625 } 626 } 627 } 628 //periodic reset of u: reset is not complete but bit by bit 629 tCounter++; |
620 if ((tCounter & ((ULL(1) << logTick) - 1)) == 0) { | 630 if ((tCounter & ((ULL(1) << logUResetPeriod) - 1)) == 0) { |
621 // reset least significant bit 622 // most significant bit becomes least significant bit 623 for (int i = 1; i <= nHistoryTables; i++) { | 631 // reset least significant bit 632 // most significant bit becomes least significant bit 633 for (int i = 1; i <= nHistoryTables; i++) { |
624 for (int j = 0; j < (ULL(1) << tagTableSizes[i]); j++) { | 634 for (int j = 0; j < (ULL(1) << logTagTableSizes[i]); j++) { |
625 gtable[i][j].u = gtable[i][j].u >> 1; 626 } 627 } 628 } 629 630 if (bi->hitBank > 0) { 631 DPRINTF(LTage, "Updating tag table entry (%d,%d) for branch %lx\n", 632 bi->hitBank, bi->hitBankIndex, branch_pc); --- 36 unchanged lines hidden (view full) --- 669 BranchInfo* bi = (BranchInfo*)(b); 670 ThreadHistory& tHist = threadHistory[tid]; 671 // UPDATE HISTORIES 672 bool pathbit = ((branch_pc >> instShiftAmt) & 1); 673 //on a squash, return pointers to this and recompute indices. 674 //update user history 675 updateGHist(tHist.gHist, taken, tHist.globalHistory, tHist.ptGhist); 676 tHist.pathHist = (tHist.pathHist << 1) + pathbit; | 635 gtable[i][j].u = gtable[i][j].u >> 1; 636 } 637 } 638 } 639 640 if (bi->hitBank > 0) { 641 DPRINTF(LTage, "Updating tag table entry (%d,%d) for branch %lx\n", 642 bi->hitBank, bi->hitBankIndex, branch_pc); --- 36 unchanged lines hidden (view full) --- 679 BranchInfo* bi = (BranchInfo*)(b); 680 ThreadHistory& tHist = threadHistory[tid]; 681 // UPDATE HISTORIES 682 bool pathbit = ((branch_pc >> instShiftAmt) & 1); 683 //on a squash, return pointers to this and recompute indices. 684 //update user history 685 updateGHist(tHist.gHist, taken, tHist.globalHistory, tHist.ptGhist); 686 tHist.pathHist = (tHist.pathHist << 1) + pathbit; |
677 tHist.pathHist = (tHist.pathHist & ((ULL(1) << 16) - 1)); | 687 tHist.pathHist = (tHist.pathHist & ((ULL(1) << pathHistBits) - 1)); |
678 679 bi->ptGhist = tHist.ptGhist; 680 bi->pathHist = tHist.pathHist; 681 //prepare next index and tag computations for user branchs 682 for (int i = 1; i <= nHistoryTables; i++) 683 { 684 bi->ci[i] = tHist.computeIndices[i].comp; 685 bi->ct0[i] = tHist.computeTags[0][i].comp; --- 100 unchanged lines hidden --- | 688 689 bi->ptGhist = tHist.ptGhist; 690 bi->pathHist = tHist.pathHist; 691 //prepare next index and tag computations for user branchs 692 for (int i = 1; i <= nHistoryTables; i++) 693 { 694 bi->ci[i] = tHist.computeIndices[i].comp; 695 bi->ct0[i] = tHist.computeTags[0][i].comp; --- 100 unchanged lines hidden --- |