Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

List all Read After Write(RAW) and Write after Write(WAW) dependencies that are

ID: 662225 • Letter: L

Question

List all Read After Write(RAW) and Write after Write(WAW) dependencies that are present in the following code:

Answer the following related questions:

(a) Assume that the above code executes on a five stage MIPS pipeline with register file forwarding but without full forwarding. The processor stalls whenever a hazard takes place. Draw the pipeline diagram showing the execution of the above instructions. In your diagram, show when stalls take place and the length of each stall. Use the notation (IF, ID, EX, MEM, WB) to denote the five stages of the pipeline.

(b) How many cycles does it take for the processor to run the above code if stalls were used to solve data hazards?

(c) Redraw the pipeline diagram for the same set of instructions for another five stage MIPS pipeline which has support for full forwarding.

(d) How many cycles does it take for the processor to run the above code if full forwarding was used to solve data hazards?

Explanation / Answer

assuming each instruction with 1 to 7 names

1. add $s3, $s2, $s1
2. lw $s2, 0($s1)
3. sw $s2, 40($s3)
4. addu $s3, $s1, $s2
5. nor $s3, $s2, $s2
6. or $s4, $s3, $zero
7. sw $s3, 50($s4)

Dependencies:

3 depends on 1
3 depends on 2
4 depends on 3
5 depends on 3
6 depends on 5
7 depends on 5
7 depends on 6

a)

b) It takes 19 cycles to solve data hazards

c)

Place a NOP after the dependency so that the value of can be directly forwarded
from the MEM stage of a instruction to the EXE stage of a instruction

d) It takes 15 cycles to solve data hazards

pipeline Instructions 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 IF ID EX MEM WB 2 IF ID EX MEM WB 3 IF - - ID EX MEM WB 4 IF - - ID EX MEM WB 5 IF ID EX MEM WB 6 IF - - ID EX MEM WB 7 IF - - ID EX MEM WB
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote