tage.hh (13454:19a5b4fb1f1f) | tage.hh (13455:56e25a5f9603) |
---|---|
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 | 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 |
|
74 protected: 75 // Prediction Structures 76 77 // Tage Entry 78 struct TageEntry 79 { 80 int8_t ctr; 81 uint16_t tag; --- 23 unchanged lines hidden (view full) --- 105 { 106 comp = (comp << 1) | h[0]; 107 comp ^= h[origLength] << outpoint; 108 comp ^= (comp >> compLength); 109 comp &= (ULL(1) << compLength) - 1; 110 } 111 }; 112 | 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 |
|
113 // Primary branch history entry 114 struct TageBranchInfo 115 { 116 int pathHist; 117 int ptGhist; 118 int hitBank; 119 int hitBankIndex; 120 int altBank; --- 15 unchanged lines hidden (view full) --- 136 // Pointers to actual saved array within the dynamically 137 // allocated storage. 138 int *tableIndices; 139 int *tableTags; 140 int *ci; 141 int *ct0; 142 int *ct1; 143 | 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 |
|
144 TageBranchInfo(int sz) 145 : pathHist(0), ptGhist(0), 146 hitBank(0), hitBankIndex(0), 147 altBank(0), altBankIndex(0), 148 bimodalIndex(0), 149 tagePred(false), altTaken(false), 150 condBranch(false), longestMatchPred(false), | 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), |
151 pseudoNewAlloc(false), branchPC(0) | 165 pseudoNewAlloc(false), branchPC(0), 166 provider(-1) |
152 { 153 storage = new int [sz * 5]; 154 tableIndices = storage; 155 tableTags = storage + sz; 156 ci = tableTags + sz; 157 ct0 = ci + sz; 158 ct1 = ct0 + sz; 159 } --- 155 unchanged lines hidden (view full) --- 315 * histories to use. 316 * @param branch_pc The unshifted branch PC. 317 * @param cond_branch True if the branch is conditional. 318 * @param bi Pointer to the TageBranchInfo 319 */ 320 bool tagePredict( 321 ThreadID tid, Addr branch_pc, bool cond_branch, TageBranchInfo* bi); 322 | 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 |
|
323 const unsigned logRatioBiModalHystEntries; 324 const unsigned nHistoryTables; 325 const unsigned tagTableCounterBits; 326 const unsigned tagTableUBits; 327 const unsigned histBufferSize; 328 const unsigned minHist; 329 const unsigned maxHist; 330 const unsigned pathHistBits; --- 33 unchanged lines hidden (view full) --- 364 int *histLengths; 365 int *tableIndices; 366 int *tableTags; 367 368 int8_t useAltPredForNewlyAllocated; 369 uint64_t tCounter; 370 uint64_t logUResetPeriod; 371 unsigned useAltOnNaBits; | 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; |
|
372}; 373 374#endif // __CPU_PRED_TAGE | 410}; 411 412#endif // __CPU_PRED_TAGE |