Based on the following MIPS code segment, please answer the following questions.
ID: 3821276 • Letter: B
Question
Based on the following MIPS code segment, please answer the following questions. (In order to make your answers clear, please rewrite the code in different sections) Lw %sl.O(St0) Lw $s2.4(St0) Add $s3.$sl.$s2 Sub $s4. $s3. $s2 And $t3.$tl.$t2 I Identify all the data dependencies in the code segment. Which arc the data dependencies that will be resolved via forwarding (also called bypassing) scheme? Which of the data dependency will cause a stall even with the forwarding scheme? Could you reorder the code (while do not change the function of the program) to avoid the stall? if yes, please reorder it accordinglyExplanation / Answer
1) data dependencies :-
1)no dependencies
2)no dependencies
3)$s1 and $s2 dependency
4)$s2 and $s3 dependency
5)no dependency
2)
4th instruction can be resolved via forwarding
3)
3 and 4 instuction will stalled due to dependency of $s1 and $s2
4)
Re-ordering:-
lw $s1,0($t0)
lw $s2,4($t0)
And $t3,$t1,$t2
Add $s3,$s1,$s2
sub $s4,$s3,$s2
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.