52d51
< logSizeBiMP(params->logSizeBiMP),
54d52
< logSizeTagTables(params->logSizeTagTables),
62c60
< minTagWidth(params->minTagWidth),
---
> pathHistBits(params->pathHistBits),
66a65
> logLoopTableAssoc(params->logLoopTableAssoc),
70c69,74
< threadHistory(params->numThreads)
---
> tagTableTagWidths(params->tagTableTagWidths),
> logTagTableSizes(params->logTagTableSizes),
> threadHistory(params->numThreads),
> logUResetPeriod(params->logUResetPeriod),
> useAltOnNaBits(params->useAltOnNaBits),
> withLoopBits(params->withLoopBits)
81a86,95
> assert(logSizeLoopPred >= logLoopTableAssoc);
>
> // we use int type for the path history, so it cannot be more than
> // its size
> assert(pathHistBits <= (sizeof(int)*8));
>
> // initialize the counter to half of the period
> assert(logUResetPeriod != 0);
> tCounter = ULL(1) << (logUResetPeriod - 1);
>
84,85d97
< logTick = 19;
< tCounter = ULL(1) << (logTick - 1);
106,117c118,119
< tagWidths[1] = minTagWidth;
< tagWidths[2] = minTagWidth;
< tagWidths[3] = minTagWidth + 1;
< tagWidths[4] = minTagWidth + 1;
< tagWidths[5] = minTagWidth + 2;
< tagWidths[6] = minTagWidth + 3;
< tagWidths[7] = minTagWidth + 4;
< tagWidths[8] = minTagWidth + 5;
< tagWidths[9] = minTagWidth + 5;
< tagWidths[10] = minTagWidth + 6;
< tagWidths[11] = minTagWidth + 7;
< tagWidths[12] = minTagWidth + 8;
---
> assert(tagTableTagWidths.size() == (nHistoryTables+1));
> assert(logTagTableSizes.size() == (nHistoryTables+1));
119,126c121,123
< for (int i = 1; i <= 2; i++)
< tagTableSizes[i] = logSizeTagTables - 1;
< for (int i = 3; i <= 6; i++)
< tagTableSizes[i] = logSizeTagTables;
< for (int i = 7; i <= 10; i++)
< tagTableSizes[i] = logSizeTagTables - 1;
< for (int i = 11; i <= 12; i++)
< tagTableSizes[i] = logSizeTagTables - 2;
---
> // First entry is for the Bimodal table and it is untagged in this
> // implementation
> assert(tagTableTagWidths[0] == 0);
134c131,132
< history.computeIndices[i].init(histLengths[i], (tagTableSizes[i]));
---
> history.computeIndices[i].init(
> histLengths[i], (logTagTableSizes[i]));
136c134
< history.computeIndices[i].origLength, tagWidths[i]);
---
> history.computeIndices[i].origLength, tagTableTagWidths[i]);
138c136
< history.computeIndices[i].origLength, tagWidths[i] - 1);
---
> history.computeIndices[i].origLength, tagTableTagWidths[i]-1);
140c138
< histLengths[i], tagTableSizes[i], tagWidths[i]);
---
> histLengths[i], logTagTableSizes[i], tagTableTagWidths[i]);
144c142
< const uint64_t bimodalTableSize = ULL(1) << logSizeBiMP;
---
> const uint64_t bimodalTableSize = ULL(1) << logTagTableSizes[0];
152c150
< gtable[i] = new TageEntry[1<<(tagTableSizes[i])];
---
> gtable[i] = new TageEntry[1<<(logTagTableSizes[i])];
164c162
< return ((pc_in >> instShiftAmt) & ((ULL(1) << (logSizeBiMP)) - 1));
---
> return ((pc_in >> instShiftAmt) & ((ULL(1) << (logTagTableSizes[0])) - 1));
170,171c168,176
< return (((pc_in >> instShiftAmt) &
< ((ULL(1) << (logSizeLoopPred - 2)) - 1)) << 2);
---
> // The loop table is implemented as a linear table
> // If associativity is N (N being 1 << logLoopTableAssoc),
> // the first N entries are for set 0, the next N entries are for set 1,
> // and so on.
> // Thus, this function calculates the set and then it gets left shifted
> // by logLoopTableAssoc in order to return the index of the first of the
> // N entries of the set
> Addr mask = (ULL(1) << (logSizeLoopPred - logLoopTableAssoc)) - 1;
> return (((pc_in >> instShiftAmt) & mask) << logLoopTableAssoc);
180,183c185,188
< A1 = (A & ((ULL(1) << tagTableSizes[bank]) - 1));
< A2 = (A >> tagTableSizes[bank]);
< A2 = ((A2 << bank) & ((ULL(1) << tagTableSizes[bank]) - 1))
< + (A2 >> (tagTableSizes[bank] - bank));
---
> A1 = (A & ((ULL(1) << logTagTableSizes[bank]) - 1));
> A2 = (A >> logTagTableSizes[bank]);
> A2 = ((A2 << bank) & ((ULL(1) << logTagTableSizes[bank]) - 1))
> + (A2 >> (logTagTableSizes[bank] - bank));
185,186c190,191
< A = ((A << bank) & ((ULL(1) << tagTableSizes[bank]) - 1))
< + (A >> (tagTableSizes[bank] - bank));
---
> A = ((A << bank) & ((ULL(1) << logTagTableSizes[bank]) - 1))
> + (A >> (logTagTableSizes[bank] - bank));
196c201,203
< int hlen = (histLengths[bank] > 16) ? 16 : histLengths[bank];
---
> int hlen = (histLengths[bank] > pathHistBits) ? pathHistBits :
> histLengths[bank];
> const Addr shiftedPc = pc >> instShiftAmt;
198,199c205,206
< (pc >> instShiftAmt) ^
< ((pc >> instShiftAmt) >> ((int) abs(tagTableSizes[bank] - bank) + 1)) ^
---
> shiftedPc ^
> (shiftedPc >> ((int) abs(logTagTableSizes[bank] - bank) + 1)) ^
203c210
< return (index & ((ULL(1) << (tagTableSizes[bank])) - 1));
---
> return (index & ((ULL(1) << (logTagTableSizes[bank])) - 1));
215c222
< return (tag & ((ULL(1) << tagWidths[bank]) - 1));
---
> return (tag & ((ULL(1) << tagTableTagWidths[bank]) - 1));
283c290,291
< bi->loopTag = ((pc) >> (instShiftAmt + logSizeLoopPred - 2)) & loopTagMask;
---
> unsigned pcShift = instShiftAmt + logSizeLoopPred - logLoopTableAssoc;
> bi->loopTag = ((pc) >> pcShift) & loopTagMask;
285c293
< for (int i = 0; i < 4; i++) {
---
> for (int i = 0; i < (1 << logLoopTableAssoc); i++) {
382,383c390,391
< for (int i = 0; i < 4; i++) {
< int loop_hit = (nrand + i) & 3;
---
> for (int i = 0; i < (1 << logLoopTableAssoc); i++) {
> int loop_hit = (nrand + i) & ((1 << logLoopTableAssoc) - 1);
555c563,565
< ctrUpdate(loopUseCounter, (bi->loopPred== taken), 7);
---
> ctrUpdate(loopUseCounter,
> (bi->loopPred == taken),
> withLoopBits);
578c588
< bi->altTaken == taken, 4);
---
> bi->altTaken == taken, useAltOnNaBits);
620c630
< if ((tCounter & ((ULL(1) << logTick) - 1)) == 0) {
---
> if ((tCounter & ((ULL(1) << logUResetPeriod) - 1)) == 0) {
624c634
< for (int j = 0; j < (ULL(1) << tagTableSizes[i]); j++) {
---
> for (int j = 0; j < (ULL(1) << logTagTableSizes[i]); j++) {
677c687
< tHist.pathHist = (tHist.pathHist & ((ULL(1) << 16) - 1));
---
> tHist.pathHist = (tHist.pathHist & ((ULL(1) << pathHistBits) - 1));