Control hazards (branches)
When do you know you have a branch?
When do you know if the branch is Taken or Not-Taken
- During EXE cycle (e.g., for the MIPS)
Easiest solution
- Stall one cycle after recognizing the branch (haz. det. unit)
- Fetch the instruction following the branch after EXE cycle
- Cost 2 cycles or contribution to CPI due to branches =
2 x Branch freq. ? 0.5