title: Branch Prediction and CPI
body: <p>This is a problem from an exam I took recently and I'm just curious to know if I was on the right track with my answer.</p>
  
  <p>If I remember correctly it was:  Consider a machine that resolves all branches in the ID stage of the datapath.  There are 14% branches and 86% other instructions.  The branch prediction is incorrect 45% of the time.  Ignore all other possible hazards.  What is the CPI of this machine?</p>
  
  <p>Here's what I did (assuming base CPI of 1):  (.86)(1) + (.14)((.55)(1)+(.45)(1+1))) = 1.063</p>
  
  <p>Did I get the answer correct, or did I miss something about that problem?</p>