CS251 - Computer Organization and Design - Spring 2008

Lecture 29 - Data Hazards


Practical Details

  1. Assignment 7
  2. Control signals in pipelined execution

Hazards

Any condition that blocks the flow of instructions through the pipeline

Structural Hazards

Control Hazards

Data Hazards

Result of one instruction needed in the next one.

Example

sub $2, $1, $3
and $12, $2, $5
or $13, $6, $2
add $14, $2, $2
sw $15, 100($2)

Solution 1: Compiler

Ask the compiler to reorder instructions

Solution 2: Subphases

Write registers early in the phase

Solution 3: Forwarding

Classify remaining hazard types using the notation

Labels

Data actually produced in phase 3

Requires

Solves type 1 hazards

Solution 4: Stalls

Consider

lw  $2, 100($1)
and $12, $2, $5
or  $13, $6, $2
add $14, $2, $2
sw  $15, 100($2)

The result of the first instruction is available only at the end of the memory phase

Interesting sidelight.


Return to: