Pipelining a Datapath

Tom Kelliher, CS 220

Nov. 28, 2011

Administrivia

Announcements

Assignment

Read 5.1-5.2.

From Last Time

Overview of pipelining.

Outline

  1. Pipelining: a pipelined datapath. Hazards.

  2. Simple example: a single lw.

Coming Up

Introduction to caches.

Pipelining

A pipelined datapath:

\begin{figure}\centering\includegraphics[]{Figures/f0612.eps}\end{figure}

Consider four instructions: R-mode, a branch, LW, SW.

Observations:

  1. Not a true pipeline: feedback.

  2. How do we re-design control?

Hazards

  1. Structural hazards.

    Example: unified L1 cache/memory.

  2. Control hazards. Consider the following example:

    \begin{figure}\centering\includegraphics[]{Figures/f0605.eps}\end{figure}

    Solutions:

    1. Stall.

    2. Predict.

      Static prediction. Truly static. Compile-time determined.

      Dynamic prediction. Branch history tables. One-, two-bit counters.

    3. Delayed branch.

      Assumes you know branch outcome early.

      Code scheduling:

      \begin{figure}\centering\includegraphics[]{Figures/f0654.eps}\end{figure}

    Consideration: deeper pipelines.

  3. Data hazards.

    Data not available when needed.

    ALU example:

    \begin{figure}\centering\includegraphics[]{Figures/f0636.eps}\end{figure}

    Fixed by forwarding.

    Memory example:

    \begin{figure}\centering\includegraphics[]{Figures/f0644.eps}\end{figure}

    How can this be fixed?

Simple Example

Let's follow a lw. What's going on during each clock cycle?

\begin{figure}\centering\includegraphics[]{Figures/f0613.eps}\end{figure}

\begin{figure}\centering\includegraphics[]{Figures/f0614.eps}\end{figure}

\begin{figure}\centering\includegraphics[]{Figures/f0615.eps}\end{figure}



Thomas P. Kelliher 2011-11-17
Tom Kelliher