They refer to the possibility of erroneous computation when a CPU tries to simultaneously execute multiple instructions which exhibit data dependence.There are typically three types of hazards: (i) data hazards, (ii) control hazards, and (iii) structural hazards.
Data hazards occur when data is modified.
For example, consider the following instructions:
sub $1, $2, $3 # $1=$2–$3 andi $2, $1, 3 # $2=$1∧3 |
$1
will be used in the Execute step (red) by the andi
before the sub
operation performs WriteBack on it (green).
Branch |
IF | ID | EX | MEM | WB | ||||
---|---|---|---|---|---|---|---|---|---|
Branch successor |
IF (stall) | stall | IF | ID | EX | MEM | WB | ||
Branch successor+1 |
IF | ID | EX | MEM | WB |
“Most things break, including hearts. The lessons of life amount not to wisdom, but to scar tissue and callus.” ― Wallace Stegner, The Spectator Bird |