inorder: fix squash bug in branch predictor
authorMaximilien Breughe <Maximilien.Breughe@elis.ugent.be>
Mon, 22 Mar 2010 20:59:12 +0000 (16:59 -0400)
committerMaximilien Breughe <Maximilien.Breughe@elis.ugent.be>
Mon, 22 Mar 2010 20:59:12 +0000 (16:59 -0400)
src/cpu/inorder/resources/bpred_unit.cc
src/cpu/inorder/resources/branch_predictor.cc

index 0e8526fa137b248552ae1ccbc40f27ce701a332f..c9674a0b56f951b8e9d6ea157d311c0fc5b37dbe 100644 (file)
@@ -343,6 +343,8 @@ BPredUnit::squash(const InstSeqNum &squashed_sn,
     // corresponding to the squash.  In that case, don't bother trying to
     // fix up the entry.
     if (!pred_hist.empty()) {
+       if(pred_hist.front().seqNum==squashed_sn){
+
         assert(pred_hist.front().seqNum == squashed_sn);
         if (pred_hist.front().usedRAS) {
             ++RASIncorrect;
@@ -353,6 +355,7 @@ BPredUnit::squash(const InstSeqNum &squashed_sn,
 
         BTB.update(pred_hist.front().PC, corr_target, tid);
         pred_hist.pop_front();
+        }
     }
 }
 
index ecac5fff0b3dbeb5dad0ca62cd6f117927b028ba..ea9cf720771e0175dab2d36d1140516c61b40310 100644 (file)
@@ -56,6 +56,8 @@ BranchPredictor::regStats()
         .desc("Number of Branches Predicted As Not Taken (False).");
 
     Resource::regStats();
+   
+    branchPred.regStats();
 }
 
 void
@@ -140,7 +142,9 @@ BranchPredictor::squash(DynInstPtr inst, int squash_stage,
                         InstSeqNum squash_seq_num, ThreadID tid)
 {
     DPRINTF(InOrderBPred, "Squashing...\n");
-    branchPred.squash(squash_seq_num, tid);
+    Addr corr_targ=inst->readPredPC();
+    bool taken=inst->predTaken();
+    branchPred.squash(squash_seq_num,corr_targ,taken,tid);
 }
 
 void