tournament.hh (11427:fb512311295e) | tournament.hh (11429:cf5af0cc3be4) |
---|---|
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 --- 63 unchanged lines hidden (view full) --- 72 /** 73 * Looks up the given address in the branch predictor and returns 74 * a true/false value as to whether it is taken. Also creates a 75 * BPHistory object to store any state it will need on squash/update. 76 * @param branch_addr The address of the branch to look up. 77 * @param bp_history Pointer that will be set to the BPHistory object. 78 * @return Whether or not the branch is taken. 79 */ | 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 --- 63 unchanged lines hidden (view full) --- 72 /** 73 * Looks up the given address in the branch predictor and returns 74 * a true/false value as to whether it is taken. Also creates a 75 * BPHistory object to store any state it will need on squash/update. 76 * @param branch_addr The address of the branch to look up. 77 * @param bp_history Pointer that will be set to the BPHistory object. 78 * @return Whether or not the branch is taken. 79 */ |
80 bool lookup(ThreadID tid, Addr branch_addr, void * &bp_history); | 80 bool lookup(Addr branch_addr, void * &bp_history); |
81 82 /** 83 * Records that there was an unconditional branch, and modifies 84 * the bp history to point to an object that has the previous 85 * global history stored in it. 86 * @param bp_history Pointer that will be set to the BPHistory object. 87 */ | 81 82 /** 83 * Records that there was an unconditional branch, and modifies 84 * the bp history to point to an object that has the previous 85 * global history stored in it. 86 * @param bp_history Pointer that will be set to the BPHistory object. 87 */ |
88 void uncondBranch(ThreadID tid, Addr pc, void * &bp_history); | 88 void uncondBranch(Addr pc, void * &bp_history); |
89 /** 90 * Updates the branch predictor to Not Taken if a BTB entry is 91 * invalid or not found. 92 * @param branch_addr The address of the branch to look up. 93 * @param bp_history Pointer to any bp history state. 94 * @return Whether or not the branch is taken. 95 */ | 89 /** 90 * Updates the branch predictor to Not Taken if a BTB entry is 91 * invalid or not found. 92 * @param branch_addr The address of the branch to look up. 93 * @param bp_history Pointer to any bp history state. 94 * @return Whether or not the branch is taken. 95 */ |
96 void btbUpdate(ThreadID tid, Addr branch_addr, void * &bp_history); | 96 void btbUpdate(Addr branch_addr, void * &bp_history); |
97 /** 98 * Updates the branch predictor with the actual result of a branch. 99 * @param branch_addr The address of the branch to update. 100 * @param taken Whether or not the branch was taken. 101 * @param bp_history Pointer to the BPHistory object that was created 102 * when the branch was predicted. 103 * @param squashed is set when this function is called during a squash 104 * operation. 105 */ | 97 /** 98 * Updates the branch predictor with the actual result of a branch. 99 * @param branch_addr The address of the branch to update. 100 * @param taken Whether or not the branch was taken. 101 * @param bp_history Pointer to the BPHistory object that was created 102 * when the branch was predicted. 103 * @param squashed is set when this function is called during a squash 104 * operation. 105 */ |
106 void update(ThreadID tid, Addr branch_addr, bool taken, void *bp_history, 107 bool squashed); | 106 void update(Addr branch_addr, bool taken, void *bp_history, bool squashed); |
108 | 107 |
109 void retireSquashed(ThreadID tid, void *bp_history); | 108 void retireSquashed(void *bp_history); |
110 111 /** 112 * Restores the global branch history on a squash. 113 * @param bp_history Pointer to the BPHistory object that has the 114 * previous global branch history in it. 115 */ | 109 110 /** 111 * Restores the global branch history on a squash. 112 * @param bp_history Pointer to the BPHistory object that has the 113 * previous global branch history in it. 114 */ |
116 void squash(ThreadID tid, void *bp_history); | 115 void squash(void *bp_history); |
117 | 116 |
118 unsigned getGHR(ThreadID tid, void *bp_history) const; | 117 /** Returns the global history. */ 118 inline unsigned readGlobalHist() { return globalHistory; } |
119 120 private: 121 /** 122 * Returns if the branch should be taken or not, given a counter 123 * value. 124 * @param count The counter value. 125 */ 126 inline bool getPrediction(uint8_t &count); 127 128 /** 129 * Returns the local history index, given a branch address. 130 * @param branch_addr The branch's PC address. 131 */ 132 inline unsigned calcLocHistIdx(Addr &branch_addr); 133 134 /** Updates global history as taken. */ | 119 120 private: 121 /** 122 * Returns if the branch should be taken or not, given a counter 123 * value. 124 * @param count The counter value. 125 */ 126 inline bool getPrediction(uint8_t &count); 127 128 /** 129 * Returns the local history index, given a branch address. 130 * @param branch_addr The branch's PC address. 131 */ 132 inline unsigned calcLocHistIdx(Addr &branch_addr); 133 134 /** Updates global history as taken. */ |
135 inline void updateGlobalHistTaken(ThreadID tid); | 135 inline void updateGlobalHistTaken(); |
136 137 /** Updates global history as not taken. */ | 136 137 /** Updates global history as not taken. */ |
138 inline void updateGlobalHistNotTaken(ThreadID tid); | 138 inline void updateGlobalHistNotTaken(); |
139 140 /** 141 * Updates local histories as taken. 142 * @param local_history_idx The local history table entry that 143 * will be updated. 144 */ 145 inline void updateLocalHistTaken(unsigned local_history_idx); 146 --- 57 unchanged lines hidden (view full) --- 204 unsigned globalPredictorSize; 205 206 /** Number of bits of the global predictor's counters. */ 207 unsigned globalCtrBits; 208 209 /** Global history register. Contains as much history as specified by 210 * globalHistoryBits. Actual number of bits used is determined by 211 * globalHistoryMask and choiceHistoryMask. */ | 139 140 /** 141 * Updates local histories as taken. 142 * @param local_history_idx The local history table entry that 143 * will be updated. 144 */ 145 inline void updateLocalHistTaken(unsigned local_history_idx); 146 --- 57 unchanged lines hidden (view full) --- 204 unsigned globalPredictorSize; 205 206 /** Number of bits of the global predictor's counters. */ 207 unsigned globalCtrBits; 208 209 /** Global history register. Contains as much history as specified by 210 * globalHistoryBits. Actual number of bits used is determined by 211 * globalHistoryMask and choiceHistoryMask. */ |
212 std::vector<unsigned> globalHistory; | 212 unsigned globalHistory; |
213 214 /** Number of bits for the global history. Determines maximum number of 215 entries in global and choice predictor tables. */ 216 unsigned globalHistoryBits; 217 218 /** Mask to apply to globalHistory to access global history table. 219 * Based on globalPredictorSize.*/ 220 unsigned globalHistoryMask; --- 27 unchanged lines hidden --- | 213 214 /** Number of bits for the global history. Determines maximum number of 215 entries in global and choice predictor tables. */ 216 unsigned globalHistoryBits; 217 218 /** Mask to apply to globalHistory to access global history table. 219 * Based on globalPredictorSize.*/ 220 unsigned globalHistoryMask; --- 27 unchanged lines hidden --- |