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.
How is it supposed to do so?
What if some value is written to some register?
Then how can I bring that register to its previous value? Same thing goes for flags?