Pipelining/Problem11a

Explain what a control hazard is and how to avoid it.

Solution

Control hazard: Instruction fetch depends on some in-flight instruction being executed. For example, the target address of a branch or jump is not immediately available after the branch / jump exits from fetch stage.

  • design a hazard unit to detect the hazard and stall the pipeline
  • branch prediction
  • using delay slot in the instruction scheduling

Adapted from Anders Ardo, Dept. of Electrical and Information Technology, Lund University.