bpred_unit.hh (11433:72b075cdc336) | bpred_unit.hh (11434:b5aed9d2d54e) |
---|---|
1/* 2 * Copyright (c) 2011-2012, 2014 ARM Limited 3 * Copyright (c) 2010 The University of Edinburgh 4 * All rights reserved 5 * 6 * The license below extends only to copyright in the software and shall 7 * not be construed as granting a license to any other intellectual 8 * property including but not limited to intellectual property relating --- 84 unchanged lines hidden (view full) --- 93 */ 94 bool predict(const StaticInstPtr &inst, const InstSeqNum &seqNum, 95 TheISA::PCState &pc, ThreadID tid); 96 bool predictInOrder(const StaticInstPtr &inst, const InstSeqNum &seqNum, 97 int asid, TheISA::PCState &instPC, 98 TheISA::PCState &predPC, ThreadID tid); 99 100 // @todo: Rename this function. | 1/* 2 * Copyright (c) 2011-2012, 2014 ARM Limited 3 * Copyright (c) 2010 The University of Edinburgh 4 * All rights reserved 5 * 6 * The license below extends only to copyright in the software and shall 7 * not be construed as granting a license to any other intellectual 8 * property including but not limited to intellectual property relating --- 84 unchanged lines hidden (view full) --- 93 */ 94 bool predict(const StaticInstPtr &inst, const InstSeqNum &seqNum, 95 TheISA::PCState &pc, ThreadID tid); 96 bool predictInOrder(const StaticInstPtr &inst, const InstSeqNum &seqNum, 97 int asid, TheISA::PCState &instPC, 98 TheISA::PCState &predPC, ThreadID tid); 99 100 // @todo: Rename this function. |
101 virtual void uncondBranch(Addr pc, void * &bp_history) = 0; | 101 virtual void uncondBranch(ThreadID tid, Addr pc, void * &bp_history) = 0; |
102 103 /** 104 * Tells the branch predictor to commit any updates until the given 105 * sequence number. 106 * @param done_sn The sequence number to commit any older updates up until. 107 * @param tid The thread id. 108 */ 109 void update(const InstSeqNum &done_sn, ThreadID tid); --- 18 unchanged lines hidden (view full) --- 128 void squash(const InstSeqNum &squashed_sn, 129 const TheISA::PCState &corr_target, 130 bool actually_taken, ThreadID tid); 131 132 /** 133 * @param bp_history Pointer to the history object. The predictor 134 * will need to update any state and delete the object. 135 */ | 102 103 /** 104 * Tells the branch predictor to commit any updates until the given 105 * sequence number. 106 * @param done_sn The sequence number to commit any older updates up until. 107 * @param tid The thread id. 108 */ 109 void update(const InstSeqNum &done_sn, ThreadID tid); --- 18 unchanged lines hidden (view full) --- 128 void squash(const InstSeqNum &squashed_sn, 129 const TheISA::PCState &corr_target, 130 bool actually_taken, ThreadID tid); 131 132 /** 133 * @param bp_history Pointer to the history object. The predictor 134 * will need to update any state and delete the object. 135 */ |
136 virtual void squash(void *bp_history) = 0; | 136 virtual void squash(ThreadID tid, void *bp_history) = 0; |
137 138 /** 139 * Looks up a given PC in the BP to see if it is taken or not taken. 140 * @param inst_PC The PC to look up. 141 * @param bp_history Pointer that will be set to an object that 142 * has the branch predictor state associated with the lookup. 143 * @return Whether the branch is taken or not taken. 144 */ | 137 138 /** 139 * Looks up a given PC in the BP to see if it is taken or not taken. 140 * @param inst_PC The PC to look up. 141 * @param bp_history Pointer that will be set to an object that 142 * has the branch predictor state associated with the lookup. 143 * @return Whether the branch is taken or not taken. 144 */ |
145 virtual bool lookup(Addr instPC, void * &bp_history) = 0; | 145 virtual bool lookup(ThreadID tid, Addr instPC, void * &bp_history) = 0; |
146 147 /** 148 * If a branch is not taken, because the BTB address is invalid or missing, 149 * this function sets the appropriate counter in the global and local 150 * predictors to not taken. 151 * @param inst_PC The PC to look up the local predictor. 152 * @param bp_history Pointer that will be set to an object that 153 * has the branch predictor state associated with the lookup. 154 */ | 146 147 /** 148 * If a branch is not taken, because the BTB address is invalid or missing, 149 * this function sets the appropriate counter in the global and local 150 * predictors to not taken. 151 * @param inst_PC The PC to look up the local predictor. 152 * @param bp_history Pointer that will be set to an object that 153 * has the branch predictor state associated with the lookup. 154 */ |
155 virtual void btbUpdate(Addr instPC, void * &bp_history) = 0; | 155 virtual void btbUpdate(ThreadID tid, Addr instPC, void * &bp_history) = 0; |
156 157 /** 158 * Looks up a given PC in the BTB to see if a matching entry exists. 159 * @param inst_PC The PC to look up. 160 * @return Whether the BTB contains the given PC. 161 */ 162 bool BTBValid(Addr instPC) 163 { return BTB.valid(instPC, 0); } --- 11 unchanged lines hidden (view full) --- 175 * @param inst_PC The branch's PC that will be updated. 176 * @param taken Whether the branch was taken or not taken. 177 * @param bp_history Pointer to the branch predictor state that is 178 * associated with the branch lookup that is being updated. 179 * @param squashed Set to true when this function is called during a 180 * squash operation. 181 * @todo Make this update flexible enough to handle a global predictor. 182 */ | 156 157 /** 158 * Looks up a given PC in the BTB to see if a matching entry exists. 159 * @param inst_PC The PC to look up. 160 * @return Whether the BTB contains the given PC. 161 */ 162 bool BTBValid(Addr instPC) 163 { return BTB.valid(instPC, 0); } --- 11 unchanged lines hidden (view full) --- 175 * @param inst_PC The branch's PC that will be updated. 176 * @param taken Whether the branch was taken or not taken. 177 * @param bp_history Pointer to the branch predictor state that is 178 * associated with the branch lookup that is being updated. 179 * @param squashed Set to true when this function is called during a 180 * squash operation. 181 * @todo Make this update flexible enough to handle a global predictor. 182 */ |
183 virtual void update(Addr instPC, bool taken, void *bp_history, 184 bool squashed) = 0; | 183 virtual void update(ThreadID tid, Addr instPC, bool taken, 184 void *bp_history, bool squashed) = 0; |
185 /** 186 * Deletes the associated history with a branch, performs no predictor 187 * updates. Used for branches that mispredict and update tables but 188 * are still speculative and later retire. 189 * @param bp_history History to delete associated with this predictor 190 */ | 185 /** 186 * Deletes the associated history with a branch, performs no predictor 187 * updates. Used for branches that mispredict and update tables but 188 * are still speculative and later retire. 189 * @param bp_history History to delete associated with this predictor 190 */ |
191 virtual void retireSquashed(void *bp_history) = 0; | 191 virtual void retireSquashed(ThreadID tid, void *bp_history) = 0; |
192 193 /** 194 * Updates the BTB with the target of a branch. 195 * @param inst_PC The branch's PC that will be updated. 196 * @param target_PC The branch's target that will be added to the BTB. 197 */ 198 void BTBUpdate(Addr instPC, const TheISA::PCState &target) 199 { BTB.update(instPC, target, 0); } 200 201 | 192 193 /** 194 * Updates the BTB with the target of a branch. 195 * @param inst_PC The branch's PC that will be updated. 196 * @param target_PC The branch's target that will be added to the BTB. 197 */ 198 void BTBUpdate(Addr instPC, const TheISA::PCState &target) 199 { BTB.update(instPC, target, 0); } 200 201 |
202 virtual unsigned getGHR(void* bp_history) const { return 0; } | 202 virtual unsigned getGHR(ThreadID tid, void* bp_history) const { return 0; } |
203 204 void dump(); 205 206 private: 207 struct PredictorHistory { 208 /** 209 * Makes a predictor history struct that contains any 210 * information needed to update the predictor, BTB, and RAS. --- 142 unchanged lines hidden --- | 203 204 void dump(); 205 206 private: 207 struct PredictorHistory { 208 /** 209 * Makes a predictor history struct that contains any 210 * information needed to update the predictor, BTB, and RAS. --- 142 unchanged lines hidden --- |