title: How to flush pipeline?
body: <p>This is a theoretical question and I feel stuck.Suppose I take ARM ISA and pipelined datapath. I am using a branch predictor, which for simplicity, always predicts that a branch is taken. As it is evident, it works if the branch was indeed to be taken, but fails otherwise. If it fails, it has to roll back and undo all the changes , i.e. flush the pipeline. </p>
  
  <p>How is it supposed to do so? </p>
  
  <p>What if some value is written to some register? </p>
  
  <p>Then how can I bring that register to its previous value? Same thing goes for flags?</p>