tournament.cc (10330:f54586c894e3) | tournament.cc (10785:f56c10663a01) |
---|---|
1/* 2 * Copyright (c) 2011, 2014 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 30 unchanged lines hidden (view full) --- 39 * 40 * Authors: Kevin Lim 41 */ 42 43#include "base/bitfield.hh" 44#include "base/intmath.hh" 45#include "cpu/pred/tournament.hh" 46 | 1/* 2 * Copyright (c) 2011, 2014 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 30 unchanged lines hidden (view full) --- 39 * 40 * Authors: Kevin Lim 41 */ 42 43#include "base/bitfield.hh" 44#include "base/intmath.hh" 45#include "cpu/pred/tournament.hh" 46 |
47TournamentBP::TournamentBP(const Params *params) | 47TournamentBP::TournamentBP(const TournamentBPParams *params) |
48 : BPredUnit(params), 49 localPredictorSize(params->localPredictorSize), 50 localCtrBits(params->localCtrBits), 51 localHistoryTableSize(params->localHistoryTableSize), 52 localHistoryBits(ceilLog2(params->localPredictorSize)), 53 globalPredictorSize(params->globalPredictorSize), 54 globalCtrBits(params->globalCtrBits), 55 globalHistoryBits( 56 ceilLog2(params->globalPredictorSize) > 57 ceilLog2(params->choicePredictorSize) ? 58 ceilLog2(params->globalPredictorSize) : 59 ceilLog2(params->choicePredictorSize)), 60 choicePredictorSize(params->choicePredictorSize), | 48 : BPredUnit(params), 49 localPredictorSize(params->localPredictorSize), 50 localCtrBits(params->localCtrBits), 51 localHistoryTableSize(params->localHistoryTableSize), 52 localHistoryBits(ceilLog2(params->localPredictorSize)), 53 globalPredictorSize(params->globalPredictorSize), 54 globalCtrBits(params->globalCtrBits), 55 globalHistoryBits( 56 ceilLog2(params->globalPredictorSize) > 57 ceilLog2(params->choicePredictorSize) ? 58 ceilLog2(params->globalPredictorSize) : 59 ceilLog2(params->choicePredictorSize)), 60 choicePredictorSize(params->choicePredictorSize), |
61 choiceCtrBits(params->choiceCtrBits), 62 instShiftAmt(params->instShiftAmt) | 61 choiceCtrBits(params->choiceCtrBits) |
63{ 64 if (!isPowerOf2(localPredictorSize)) { 65 fatal("Invalid local predictor size!\n"); 66 } 67 68 if (!isPowerOf2(globalPredictorSize)) { 69 fatal("Invalid global predictor size!\n"); 70 } --- 173 unchanged lines hidden (view full) --- 244 updateGlobalHistNotTaken(); 245 updateLocalHistNotTaken(local_history_idx); 246 return false; 247 } 248 } 249} 250 251void | 62{ 63 if (!isPowerOf2(localPredictorSize)) { 64 fatal("Invalid local predictor size!\n"); 65 } 66 67 if (!isPowerOf2(globalPredictorSize)) { 68 fatal("Invalid global predictor size!\n"); 69 } --- 173 unchanged lines hidden (view full) --- 243 updateGlobalHistNotTaken(); 244 updateLocalHistNotTaken(local_history_idx); 245 return false; 246 } 247 } 248} 249 250void |
252TournamentBP::uncondBranch(void * &bp_history) | 251TournamentBP::uncondBranch(Addr pc, void * &bp_history) |
253{ 254 // Create BPHistory and pass it back to be recorded. 255 BPHistory *history = new BPHistory; 256 history->globalHistory = globalHistory; 257 history->localPredTaken = true; 258 history->globalPredTaken = true; 259 history->globalUsed = true; 260 history->localHistory = invalidPredictorIndex; --- 110 unchanged lines hidden (view full) --- 371 372 // Restore global history to state prior to this branch. 373 globalHistory = history->globalHistory; 374 375 // Delete this BPHistory now that we're done with it. 376 delete history; 377} 378 | 252{ 253 // Create BPHistory and pass it back to be recorded. 254 BPHistory *history = new BPHistory; 255 history->globalHistory = globalHistory; 256 history->localPredTaken = true; 257 history->globalPredTaken = true; 258 history->globalUsed = true; 259 history->localHistory = invalidPredictorIndex; --- 110 unchanged lines hidden (view full) --- 370 371 // Restore global history to state prior to this branch. 372 globalHistory = history->globalHistory; 373 374 // Delete this BPHistory now that we're done with it. 375 delete history; 376} 377 |
378TournamentBP* 379TournamentBPParams::create() 380{ 381 return new TournamentBP(this); 382} 383 |
|
379#ifdef DEBUG 380int 381TournamentBP::BPHistory::newCount = 0; 382#endif | 384#ifdef DEBUG 385int 386TournamentBP::BPHistory::newCount = 0; 387#endif |