CS274: Computer Architecture - In-Class Assessment: Pipelining (10 Points)

Assignment Goals

The goals of this assignment are:
  1. To schedule instructions through the five stage MIPS pipeline
  2. To identify data and control hazards and resolve them with forwarding, stalls, or reordering

Background Reading and References

Please refer to the following readings and examples offering templates to help get you started:

The Assignment

This is a short, low-stakes in-class assessment, completed individually on paper during class and graded on the basis of demonstrated reasoning (showing your work earns credit even when a slip occurs in one cycle of the table). It counts toward the Class Participation and Quizzes portion of your grade.

What to Expect

You will be given a short MIPS code sequence (3-5 instructions). In roughly 15 minutes, you will:

  1. Fill in a pipeline diagram table (instructions down the rows, clock cycles across the columns, stages IF/ID/EX/MEM/WB in the cells) for the sequence.
  2. Circle each data dependence between instructions, and state whether it causes a hazard.
  3. Show how the hazards are resolved: which can be fixed by forwarding, which require a stall (bubble), and whether reordering the instructions could avoid the stall entirely.
  4. Compute the total number of cycles for the sequence with and without forwarding.

How to Prepare

  • Practice drawing the stage/cycle table quickly: instruction i is in stage IF in cycle i, and moves one stage per cycle unless stalled.
  • Remember the two classic cases: an ALU result needed by the next instruction can be forwarded with no stall, but a lw result needed by the very next instruction always costs one bubble (the load-use hazard).
  • Be able to explain, in one sentence each, what forwarding hardware does and why a branch creates a control hazard.

Grading

Full credit requires a correct pipeline table, all dependences identified, correct stall/forwarding decisions with one-line justifications, and correct cycle counts. Partial credit is given for tables and hazard analyses that demonstrate understanding of the pipeline’s operation even if a cycle is misplaced.

Submission

In your submission, please include answers to any questions asked on the assignment page, as well as the questions listed below, in your README file. If you wrote code as part of this assignment, please describe your design, approach, and implementation in a separate document prepared using a word processor or typesetting program such as LaTeX. This document should include specific instructions on how to build and run your code, and a description of each code module or function that you created suitable for re-use by a colleague. In your README, please include answers to the following questions:
  • Describe what you did, how you did it, what challenges you encountered, and how you solved them.
  • Please answer any questions found throughout the narrative of this assignment.
  • If collaboration with a buddy was permitted, did you work with a buddy on this assignment? If so, who? If not, do you certify that this submission represents your own original work?
  • Please identify any and all portions of your submission that were not originally written by you (for example, code originally written by your buddy, or anything taken or adapted from a non-classroom resource). It is always OK to use your textbook and instructor notes; however, you are certifying that any portions not designated as coming from an outside person or source are your own original work.
  • Approximately how many hours it took you to finish this assignment (I will not judge you for this at all...I am simply using it to gauge if the assignments are too easy or hard)?
  • Your overall impression of the assignment. Did you love it, hate it, or were you neutral? One word answers are fine, but if you have any suggestions for the future let me know.
  • Using the grading specifications on this page, discuss briefly the grade you would give yourself and why. Discuss each item in the grading specification.
  • Any other concerns that you have. For instance, if you have a bug that you were unable to solve but you made progress, write that here. The more you articulate the problem the more partial credit you will receive (it is fine to leave this blank).

Please refer to the Style Guide for code quality examples and guidelines.