A pipeline simulator

The problem

Write a simulator for the five-stage pipeline that reads a short assembly program, finds the data hazards, and reports the cycles with and without forwarding, together with a pipeline diagram.

Requirements

Technologies

Step by step

  1. Parse the program into a list of instructions with destination and source registers.
  2. Compute the ID cycle of every instruction with the stall rules from the lesson.
  3. Add the branch penalty and compute the cycle count and CPI.
  4. Draw the diagram and compare the result with the pipeline widget in the lesson.

Expected result

A tool that explains where each stall in a small program comes from, and what forwarding saves.

How it is evaluated

Ways to improve it