ltage.cc (13442:5314c50529a5) | ltage.cc (13443:a111cb197897) |
---|---|
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), | 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), |
|
58 histBufferSize(params->histBufferSize), 59 minHist(params->minHist), 60 maxHist(params->maxHist), 61 minTagWidth(params->minTagWidth), 62 loopTableAgeBits(params->loopTableAgeBits), 63 loopTableConfidenceBits(params->loopTableConfidenceBits), 64 loopTableTagBits(params->loopTableTagBits), 65 loopTableIterBits(params->loopTableIterBits), 66 confidenceThreshold((1 << loopTableConfidenceBits) - 1), 67 loopTagMask((1 << loopTableTagBits) - 1), 68 loopNumIterMask((1 << loopTableIterBits) - 1), 69 threadHistory(params->numThreads) 70{ | 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 |
|
71 // we use uint16_t type for these vales, so they cannot be more than 72 // 16 bits 73 assert(loopTableTagBits <= 16); 74 assert(loopTableIterBits <= 16); 75 76 assert(params->histBufferSize > params->maxHist * 2); 77 useAltPredForNewlyAllocated = 0; 78 logTick = 19; --- 492 unchanged lines hidden (view full) --- 571 ctrUpdate(useAltPredForNewlyAllocated, 572 bi->altTaken == taken, 4); 573 } 574 } 575 } 576 577 if (alloc) { 578 // is there some "unuseful" entry to allocate | 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 |
579 int8_t min = 1; | 585 uint8_t min = 1; |
580 for (int i = nHistoryTables; i > bi->hitBank; i--) { 581 if (gtable[i][bi->tableIndices[i]].u < min) { 582 min = gtable[i][bi->tableIndices[i]].u; 583 } 584 } 585 586 // we allocate an entry with a longer history 587 // to avoid ping-pong, we do not choose systematically the next --- 12 unchanged lines hidden (view full) --- 600 } 601 602 603 //Allocate only one entry 604 for (int i = X; i <= nHistoryTables; i++) { 605 if ((gtable[i][bi->tableIndices[i]].u == 0)) { 606 gtable[i][bi->tableIndices[i]].tag = bi->tableTags[i]; 607 gtable[i][bi->tableIndices[i]].ctr = (taken) ? 0 : -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; |
608 gtable[i][bi->tableIndices[i]].u = 0; //? | |
609 break; 610 } 611 } 612 } 613 //periodic reset of u: reset is not complete but bit by bit 614 tCounter++; 615 if ((tCounter & ((ULL(1) << logTick) - 1)) == 0) { 616 // reset least significant bit --- 21 unchanged lines hidden (view full) --- 638 branch_pc); 639 } 640 if (bi->altBank == 0) { 641 baseUpdate(pc, taken, bi); 642 } 643 } 644 645 // update the u counter | 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 |
646 if (longest_match_pred != bi->altTaken) { 647 if (longest_match_pred == taken) { 648 if (gtable[bi->hitBank][bi->hitBankIndex].u < 1) { 649 gtable[bi->hitBank][bi->hitBankIndex].u++; 650 } 651 } | 651 if (bi->tagePred != bi->altTaken) { 652 unsignedCtrUpdate(gtable[bi->hitBank][bi->hitBankIndex].u, 653 bi->tagePred == taken, tagTableUBits); |
652 } 653 } else { 654 baseUpdate(pc, taken, bi); 655 } 656 657 //END PREDICTOR UPDATE 658 } 659 if (!squashed) { --- 124 unchanged lines hidden --- | 654 } 655 } else { 656 baseUpdate(pc, taken, bi); 657 } 658 659 //END PREDICTOR UPDATE 660 } 661 if (!squashed) { --- 124 unchanged lines hidden --- |