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. --- 57 unchanged lines hidden (view full) --- 66 void uncondBranch(ThreadID tid, Addr br_pc, void* &bp_history) override; 67 bool lookup(ThreadID tid, Addr branch_addr, void* &bp_history) override; 68 void btbUpdate(ThreadID tid, Addr branch_addr, void* &bp_history) override; 69 void update(ThreadID tid, Addr branch_addr, bool taken, void *bp_history, 70 bool squashed) override; 71 virtual void squash(ThreadID tid, void *bp_history) override; 72 unsigned getGHR(ThreadID tid, void *bp_history) const override; 73 |
74 virtual void regStats() override; 75 |
76 protected: 77 // Prediction Structures 78 79 // Tage Entry 80 struct TageEntry 81 { 82 int8_t ctr; 83 uint16_t tag; --- 23 unchanged lines hidden (view full) --- 107 { 108 comp = (comp << 1) | h[0]; 109 comp ^= h[origLength] << outpoint; 110 comp ^= (comp >> compLength); 111 comp &= (ULL(1) << compLength) - 1; 112 } 113 }; 114 |
115 // provider type 116 enum { 117 BIMODAL_ONLY = 0, 118 TAGE_LONGEST_MATCH, 119 BIMODAL_ALT_MATCH, 120 TAGE_ALT_MATCH, 121 LAST_TAGE_PROVIDER_TYPE = TAGE_ALT_MATCH 122 }; 123 |
124 // Primary branch history entry 125 struct TageBranchInfo 126 { 127 int pathHist; 128 int ptGhist; 129 int hitBank; 130 int hitBankIndex; 131 int altBank; --- 15 unchanged lines hidden (view full) --- 147 // Pointers to actual saved array within the dynamically 148 // allocated storage. 149 int *tableIndices; 150 int *tableTags; 151 int *ci; 152 int *ct0; 153 int *ct1; 154 |
155 // for stats purposes 156 unsigned provider; 157 |
158 TageBranchInfo(int sz) 159 : pathHist(0), ptGhist(0), 160 hitBank(0), hitBankIndex(0), 161 altBank(0), altBankIndex(0), 162 bimodalIndex(0), 163 tagePred(false), altTaken(false), 164 condBranch(false), longestMatchPred(false), |
165 pseudoNewAlloc(false), branchPC(0), 166 provider(-1) |
167 { 168 storage = new int [sz * 5]; 169 tableIndices = storage; 170 tableTags = storage + sz; 171 ci = tableTags + sz; 172 ct0 = ci + sz; 173 ct1 = ct0 + sz; 174 } --- 155 unchanged lines hidden (view full) --- 330 * histories to use. 331 * @param branch_pc The unshifted branch PC. 332 * @param cond_branch True if the branch is conditional. 333 * @param bi Pointer to the TageBranchInfo 334 */ 335 bool tagePredict( 336 ThreadID tid, Addr branch_pc, bool cond_branch, TageBranchInfo* bi); 337 |
338 /** 339 * Update the stats 340 * @param taken Actual branch outcome 341 * @param bi Pointer to information on the prediction 342 * recorded at prediction time. 343 */ 344 virtual void updateStats(bool taken, TageBranchInfo* bi); 345 |
346 const unsigned logRatioBiModalHystEntries; 347 const unsigned nHistoryTables; 348 const unsigned tagTableCounterBits; 349 const unsigned tagTableUBits; 350 const unsigned histBufferSize; 351 const unsigned minHist; 352 const unsigned maxHist; 353 const unsigned pathHistBits; --- 33 unchanged lines hidden (view full) --- 387 int *histLengths; 388 int *tableIndices; 389 int *tableTags; 390 391 int8_t useAltPredForNewlyAllocated; 392 uint64_t tCounter; 393 uint64_t logUResetPeriod; 394 unsigned useAltOnNaBits; |
395 396 // stats 397 Stats::Scalar tageLongestMatchProviderCorrect; 398 Stats::Scalar tageAltMatchProviderCorrect; 399 Stats::Scalar bimodalAltMatchProviderCorrect; 400 Stats::Scalar tageBimodalProviderCorrect; 401 Stats::Scalar tageLongestMatchProviderWrong; 402 Stats::Scalar tageAltMatchProviderWrong; 403 Stats::Scalar bimodalAltMatchProviderWrong; 404 Stats::Scalar tageBimodalProviderWrong; 405 Stats::Scalar tageAltMatchProviderWouldHaveHit; 406 Stats::Scalar tageLongestMatchProviderWouldHaveHit; 407 408 Stats::Vector tageLongestMatchProvider; 409 Stats::Vector tageAltMatchProvider; |
410}; 411 412#endif // __CPU_PRED_TAGE |