Deleted Added
sdiff udiff text old ( 13413:b84a7c832ead ) new ( 13420:5cb2b90e1cb5 )
full compact
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.

--- 36 unchanged lines hidden (view full) ---

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 logSizeTagTables(params->logSizeTagTables),
54 logSizeLoopPred(params->logSizeLoopPred),
55 nHistoryTables(params->nHistoryTables),
56 tagTableCounterBits(params->tagTableCounterBits),
57 histBufferSize(params->histBufferSize),
58 minHist(params->minHist),
59 maxHist(params->maxHist),
60 minTagWidth(params->minTagWidth),

--- 56 unchanged lines hidden (view full) ---

117 history.computeIndices[i].origLength, tagWidths[i]);
118 history.computeTags[1][i].init(
119 history.computeIndices[i].origLength, tagWidths[i] - 1);
120 DPRINTF(LTage, "HistLength:%d, TTSize:%d, TTTWidth:%d\n",
121 histLengths[i], tagTableSizes[i], tagWidths[i]);
122 }
123 }
124
125 btable = new BimodalEntry[ULL(1) << logSizeBiMP];
126 ltable = new LoopEntry[ULL(1) << logSizeLoopPred];
127 gtable = new TageEntry*[nHistoryTables + 1];
128 for (int i = 1; i <= nHistoryTables; i++) {
129 gtable[i] = new TageEntry[1<<(tagTableSizes[i])];
130 }
131
132 tableIndices = new int [nHistoryTables+1];
133 tableTags = new int [nHistoryTables+1];

--- 72 unchanged lines hidden (view full) ---

206 ctr--;
207 }
208}
209
210// Bimodal prediction
211bool
212LTAGE::getBimodePred(Addr pc, BranchInfo* bi) const
213{
214 return (btable[bi->bimodalIndex].pred > 0);
215}
216
217
218// Update the bimodal predictor: a hysteresis bit is shared among 4 prediction
219// bits
220void
221LTAGE::baseUpdate(Addr pc, bool taken, BranchInfo* bi)
222{
223 int inter = (btable[bi->bimodalIndex].pred << 1)
224 + btable[bi->bimodalIndex ].hyst;
225 if (taken) {
226 if (inter < 3)
227 inter++;
228 } else if (inter > 0) {
229 inter--;
230 }
231 btable[bi->bimodalIndex].pred = inter >> 1;
232 btable[bi->bimodalIndex].hyst = (inter & 1);
233 DPRINTF(LTage, "Updating branch %lx, pred:%d, hyst:%d\n",
234 pc, btable[bi->bimodalIndex].pred,btable[bi->bimodalIndex].hyst);
235}
236
237
238//loop prediction: only used if high confidence
239bool
240LTAGE::getLoop(Addr pc, BranchInfo* bi) const
241{
242 bi->loopHit = -1;

--- 507 unchanged lines hidden ---