title: Computer Organization - How does "Predict taken"(always taken) branch prediction work?
body: <p>I can understand how "predict untaken" work. It just move on fetching PC+4 instruction. Until the branch is resolved, if the branch is taken, then flushes all the instructions fetched before.</p>
  
  <p>But I don't understand how does "predict taken" work. I think the branch instruction needs to be at decode stage(and the branch target address calculation need to be completed) before the processor can predict that it will be taken, right?</p>
  
  <p>Then how does the "predict taken" be implemented on machine like MIPS 5-stage pipeline? (branch target address calculation and the branch is taken or not is decided at ID(instruction decode) stage)</p>
  
  <p>If the branch can be resolved at ID stage, is it means prediction is done at IF(instruction fetch) stage?</p>
  
  <p>I'm get confused because someone said "predict taken" or "predict untaken" are called "static branch prediction", compiler will do all the things. So in the "predict taken" case, compiler will insert the branch target instruction into the position after branch instruction.</p>
  
  <p>Is my thought correct? or his phrase is correct?</p>