Consider the following MIPS code (don\'t worry about what it does): loop: beq $s
ID: 3785374 • Letter: C
Question
Consider the following MIPS code (don't worry about what it does): loop: beq $s0, $s1, done addi $t0, $t0, 7 addi $t1, $t2, 4 addi $s0, $s0, 1 j loop done: beq $t1, $15, skip addi $t0, $t_0, 1 add $t1, $t2, $t0 skip addi $t5, $0, 10 beq $t1, $t5, done j end Compute the branch offset for each beq in number of words away from the branch (e.g., "branch offset is 2") Assume label loop is at location 0x00114214 and label end is at location 0x00032794. Compute the correct value to place in the jump address field for each jump instruction in the MIPS code above.Explanation / Answer
offset:
is is nothing but the distance between the starting of an object and the required point within an array.
here it is stating that the branch offset is 2.
which means that the distance or displacement between the branches is 2.
beq: Branches if the quantities of the the two registers are same.
for the loop the difference between them is 2 instructions here the branch offset is 2
in the done and skip the difference is the 6 instructions which is equal to its branch offset i.e; 6
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.