Consider the following loop. LOOP: ld $s0, 0($s3) ld $s1, 8($s3) add $s2, $s0, $s1 addi $s3,
Question:
Consider the following loop.
LOOP: ld $s0, 0($s3)
ld $s1, 8($s3)
add $s2, $s0, $s1
addi $s3, $s3, -16
bnez $s2, LOOP
Assume that perfect branch prediction is used (no stalls due to control hazards), that there are no delay slots, that the pipeline has full forwarding support, and that branches are resolved in the EX (as opposed to the ID) stage.
1. Show a pipeline execution diagram for the first two iterations of this loop.
2. Mark pipeline stages that do not perform useful work. How often while the pipeline is full do we have a cycle in which all five pipeline stages are doing useful work? (Begin with the cycle during which the addi is in the IF stage. End with the cycle during which the bnez is in the IF stage.)
Step by Step Answer:
Computer Organization And Design MIPS Edition The Hardware/Software Interface
ISBN: 9780128201091
6th Edition
Authors: David A. Patterson, John L. Hennessy