Activity 3, Investigating Hazards

Short Description:

In a group or as an individual, perform the following activities related to data hazards in a pipelined architecture.

Goals

When you finish this homework, you should have:

Formal Description

For this group activity you will construct a document that explains your explorations into the impact of different aspects of data hazards. Respond to each part in your document as appropriate. I.E. if you are asked to compute/trace/comment on something, put it in your document.

Please start a word document and record the following, one per group

  1. Record the names of all members of the group.
    • Only one group member need submit this homework, but at least one must.
    • Record if you employed any outside sources to solve this problem, including all AI use.
  2. How would a pipeline that ignores hazards "work"?
    1. Assume the 5 stage pipelined LEG 8 architecture from our notes.
    2. Assume
      • x1 holds 11
      • x2 holds 22
    3. Assume the the following code is running in a pipeline with no hazard detection/mitigation:
      • I1 Addi x1, x2, #5
        I2 Addi x2, x1, #5
        I3 Add  x3, x1, x2
        I4 Add  x4, x1, x2
        I5 Add  x5, x1, x2
    4. In your document, create a pipeline diagram like the one in these notes, but
      •   
        Time IF ID EX MEMWB
        0I1   
        1I2I1  
        3 I2I1  
        ...
        ?    I5
    5. Build a table of the values of X1 through x5 as the instruction exits the ID stage.
      • InstructionRegister Values on exit from ID
        I1 11,22,?,?,?
        I2  
        I3  
        I4  
        I5  
      • ? means unknown value.
      • Remember, the data is not committed to a register until the first 1/2 of WB for that instruction. The values an instruction reads in ID are the values it will use, even if another instruction subsequently changes those registers.
      • Remember, the data is not read from a register until the second 1/2 of ID for that instruction.
    6. In your document indicate the final values for x1 through x5
      • Do this by completing this table
      • Register Value Explanation
        x1 27 I1: 22 + 5
        x2   I2: 11 + 5 (stale x1 holds 11)
        x3    
        x4    
        x5    
        x1    
    7. Reflect on the value of a pipelined machine that does not have hazard detection.
  3. If the machine running these instructions has a clock that runs at 200ps, what is the time required to complete these instructions in the case above?
    • Remember the time is more than 5 * 200, you need to empty the pipeline!
  4. Rewrite the above code by inserting nop instructions to add user supplied pipeline bubbles.
    • Trace your code in a pipeline diagram to show that your solution works.
    • Compare your resulting register values to the register values above.
    • How many nop instructions did you have to add?
    • Justify your insertions of nop instructions.
  5. Compute the time required for your modified code.
  6. Compute the impact of pipeline bubbles on a large program:
    • I would use a spreadsheet like we did in class.
      • Isolate assumptions as much as possible by putting values in a cell and referring back to these assumptions in your computations.
      • This will allow you to change the assumptions and still have a valid working model.
      • This is what we did as we developed the spreadsheet in class.
    • Assume the following
      • 25% of the R/I/CB/D-type instructions need a single NOP instructions inserted
      • 15% of the R/I/CB/D-type instructions need two NOP instructions inserted
      • 10% of the R/I type instructions need three NOP instructions inserted
      • Thse are mutually exclusive, so 50% of the R/I-type instructions will have at least one nop instruction inserted.
      • R and I-type instructions constitute 40% of the computation
      • CB-type instructions constitute 25% of the computation
      • D-Type instructions constitute 30% of the computation
      • Other instructions make up 5% of the computation.
      • Assume a program needs 1,000,000 instructions to execute.
    • Compute:
      1. the time to run the program in a single-cycle 800 ps clock.
      2. the time to run the program if hazards are ignored with a 200ps clock.
      3. the speedup for the broken pipeline provides.
      4. the time to run the program if hazards are fixed by he programmer/compiler inserting nop instructions using a 200ps clock.
      5. the slowdown (opposite of speedup) for fixing the pipeline
  7. Assume data forwarding fixes all but 10% of the R/I-type instructions, and that only costs one nop.
    • Compute the time and speedup in this case.
  8. Summarize your discoveries about the impact of hazards and data forwarding on pipelined program performance.

Notes

This is based on a number of exercises from the end of chapter 4 in your book.

I used ChatGPT to fine tune this. It had some really good suggestions and said that this was a "solid" activity.

Required Files

A single word document containing your answers.

Submission

Submit the assignment to the D2L folder Activity 3 by the due date.