summaryrefslogtreecommitdiff
path: root/src/cpu/pred/2bit_local.hh
diff options
context:
space:
mode:
authorNilay Vaish ext:(%2C%20Timothy%20Jones%20%3Ctimothy.jones%40cl.cam.ac.uk%3E) <nilay@cs.wisc.edu>2013-01-24 12:28:51 -0600
committerNilay Vaish ext:(%2C%20Timothy%20Jones%20%3Ctimothy.jones%40cl.cam.ac.uk%3E) <nilay@cs.wisc.edu>2013-01-24 12:28:51 -0600
commitdbeabedaf0f8d9ec0ea3331db2e44b1add53f79f (patch)
tree568d3b6007adf1a8d3ba6568fc5635e56afd3d53 /src/cpu/pred/2bit_local.hh
parent11d5ffa108983d5d9742f0aad23f80c691f285ee (diff)
downloadgem5-dbeabedaf0f8d9ec0ea3331db2e44b1add53f79f.tar.xz
branch predictor: move out of o3 and inorder cpus
This patch moves the branch predictor files in the o3 and inorder directories to src/cpu/pred. This allows sharing the branch predictor across different cpu models. This patch was originally posted by Timothy Jones in July 2010 but never made it to the repository. --HG-- rename : src/cpu/o3/bpred_unit.cc => src/cpu/pred/bpred_unit.cc rename : src/cpu/o3/bpred_unit.hh => src/cpu/pred/bpred_unit.hh rename : src/cpu/o3/bpred_unit_impl.hh => src/cpu/pred/bpred_unit_impl.hh rename : src/cpu/o3/sat_counter.hh => src/cpu/pred/sat_counter.hh
Diffstat (limited to 'src/cpu/pred/2bit_local.hh')
-rw-r--r--src/cpu/pred/2bit_local.hh26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/cpu/pred/2bit_local.hh b/src/cpu/pred/2bit_local.hh
index 01a0b64db..23683cc67 100644
--- a/src/cpu/pred/2bit_local.hh
+++ b/src/cpu/pred/2bit_local.hh
@@ -38,15 +38,17 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Authors: Kevin Lim
+ * Timothy M. Jones
*/
-#ifndef __CPU_O3_2BIT_LOCAL_PRED_HH__
-#define __CPU_O3_2BIT_LOCAL_PRED_HH__
+#ifndef __CPU_PRED_2BIT_LOCAL_PRED_HH__
+#define __CPU_PRED_2BIT_LOCAL_PRED_HH__
#include <vector>
#include "base/types.hh"
-#include "cpu/o3/sat_counter.hh"
+#include "cpu/pred/bpred_unit.hh"
+#include "cpu/pred/sat_counter.hh"
/**
* Implements a local predictor that uses the PC to index into a table of
@@ -55,17 +57,15 @@
* predictor state that needs to be recorded or updated; the update can be
* determined solely by the branch being taken or not taken.
*/
-class LocalBP
+class LocalBP : public BPredUnit
{
public:
/**
* Default branch predictor constructor.
- * @param localPredictorSize Size of the local predictor.
- * @param localCtrBits Number of bits per counter.
- * @param instShiftAmt Offset amount for instructions to ignore alignment.
*/
- LocalBP(unsigned localPredictorSize, unsigned localCtrBits,
- unsigned instShiftAmt);
+ LocalBP(const Params *params);
+
+ virtual void uncondBranch(void * &bp_history);
/**
* Looks up the given address in the branch predictor and returns
@@ -74,7 +74,7 @@ class LocalBP
* @param bp_history Pointer to any bp history state.
* @return Whether or not the branch is taken.
*/
- bool lookup(Addr &branch_addr, void * &bp_history);
+ bool lookup(Addr branch_addr, void * &bp_history);
/**
* Updates the branch predictor to Not Taken if a BTB entry is
@@ -83,14 +83,14 @@ class LocalBP
* @param bp_history Pointer to any bp history state.
* @return Whether or not the branch is taken.
*/
- void BTBUpdate(Addr &branch_addr, void * &bp_history);
+ void btbUpdate(Addr branch_addr, void * &bp_history);
/**
* Updates the branch predictor with the actual result of a branch.
* @param branch_addr The address of the branch to update.
* @param taken Whether or not the branch was taken.
*/
- void update(Addr &branch_addr, bool taken, void *bp_history);
+ void update(Addr branch_addr, bool taken, void *bp_history, bool squashed);
void squash(void *bp_history)
{ assert(bp_history == NULL); }
@@ -128,4 +128,4 @@ class LocalBP
unsigned indexMask;
};
-#endif // __CPU_O3_2BIT_LOCAL_PRED_HH__
+#endif // __CPU_PRED_2BIT_LOCAL_PRED_HH__