MIPS pipeline: control hazards

Change in program flow

Execution of an instruction depends on another instruction

  • Control Dependency: Control flow is the cause

    E.g. branch instructions

Definition

An instruction j is control dependent on i if i controls whether or not j executes.

Example

i1: beq $3, $5, label # Branch
i2: add $1, $2, $4    # depends on i1
i3: ...

If we allow i3 to execute before i2 is determined, register $1 maybe be incorrectly modified.

Solutions

MIPS early branch

MIPS branch prediction

MIPS Delayed branching