* Authors: Kevin Lim
*/
+#include "cpu/pred/2bit_local.hh"
+
#include "base/intmath.hh"
-#include "base/misc.hh"
+#include "base/logging.hh"
#include "base/trace.hh"
-#include "cpu/pred/2bit_local.hh"
#include "debug/Fetch.hh"
-LocalBP::LocalBP(const Params *params)
+LocalBP::LocalBP(const LocalBPParams *params)
: BPredUnit(params),
localPredictorSize(params->localPredictorSize),
- localCtrBits(params->localCtrBits),
- instShiftAmt(params->instShiftAmt)
+ localCtrBits(params->localCtrBits)
{
if (!isPowerOf2(localPredictorSize)) {
fatal("Invalid local predictor size!\n");
}
void
-LocalBP::btbUpdate(Addr branch_addr, void * &bp_history)
+LocalBP::btbUpdate(ThreadID tid, Addr branch_addr, void * &bp_history)
{
// Place holder for a function that is called to update predictor history when
// a BTB entry is invalid or not found.
bool
-LocalBP::lookup(Addr branch_addr, void * &bp_history)
+LocalBP::lookup(ThreadID tid, Addr branch_addr, void * &bp_history)
{
bool taken;
uint8_t counter_val;
}
void
-LocalBP::update(Addr branch_addr, bool taken, void *bp_history, bool squashed)
+LocalBP::update(ThreadID tid, Addr branch_addr, bool taken, void *bp_history,
+ bool squashed)
{
assert(bp_history == NULL);
unsigned local_predictor_idx;
+ // No state to restore, and we do not update on the wrong
+ // path.
+ if (squashed) {
+ return;
+ }
+
// Update the local predictor.
local_predictor_idx = getLocalIndex(branch_addr);
}
void
-LocalBP::uncondBranch(void *&bp_history)
+LocalBP::uncondBranch(ThreadID tid, Addr pc, void *&bp_history)
+{
+}
+
+LocalBP*
+LocalBPParams::create()
{
+ return new LocalBP(this);
}