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. --- 41 unchanged lines hidden (view full) --- 50LTAGE::LTAGE(const LTAGEParams *params) 51 : BPredUnit(params), 52 logSizeBiMP(params->logSizeBiMP), 53 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), 62 minTagWidth(params->minTagWidth), 63 loopTableAgeBits(params->loopTableAgeBits), 64 loopTableConfidenceBits(params->loopTableConfidenceBits), 65 loopTableTagBits(params->loopTableTagBits), 66 loopTableIterBits(params->loopTableIterBits), 67 confidenceThreshold((1 << loopTableConfidenceBits) - 1), 68 loopTagMask((1 << loopTableTagBits) - 1), 69 loopNumIterMask((1 << loopTableIterBits) - 1), 70 threadHistory(params->numThreads) 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 82 assert(params->histBufferSize > params->maxHist * 2); 83 useAltPredForNewlyAllocated = 0; 84 logTick = 19; --- 492 unchanged lines hidden (view full) --- 577 ctrUpdate(useAltPredForNewlyAllocated, 578 bi->altTaken == taken, 4); 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--) { 587 if (gtable[i][bi->tableIndices[i]].u < min) { 588 min = gtable[i][bi->tableIndices[i]].u; 589 } 590 } 591 592 // we allocate an entry with a longer history 593 // to avoid ping-pong, we do not choose systematically the next --- 12 unchanged lines hidden (view full) --- 606 } 607 608 609 //Allocate only one entry 610 for (int i = X; i <= nHistoryTables; i++) { 611 if ((gtable[i][bi->tableIndices[i]].u == 0)) { 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++; 620 if ((tCounter & ((ULL(1) << logTick) - 1)) == 0) { 621 // reset least significant bit --- 21 unchanged lines hidden (view full) --- 643 branch_pc); 644 } 645 if (bi->altBank == 0) { 646 baseUpdate(pc, taken, bi); 647 } 648 } 649 650 // update the u counter |
651 if (bi->tagePred != bi->altTaken) { 652 unsignedCtrUpdate(gtable[bi->hitBank][bi->hitBankIndex].u, 653 bi->tagePred == taken, tagTableUBits); |
654 } 655 } else { 656 baseUpdate(pc, taken, bi); 657 } 658 659 //END PREDICTOR UPDATE 660 } 661 if (!squashed) { --- 124 unchanged lines hidden --- |