Assembly Language Programming Assembly Language Programming 7. (10 pt) The C cod
ID: 3901988 • Letter: A
Question
Assembly Language Programming Assembly Language Programming 7. (10 pt) The C code on the left is coded in MIPS on the right. Fill in the branch condition in b and write the MIP instruction for ptr>next-head; # Sao has ptr, Sal has head lw St0, (Sa0) lw Stl, (Sal) truct node ( int c struct node "next;) void prob3(struct node "ptr, struct node "head)t Sto,st 1, Li if (ptr->c head->c)l ptr->next -head; head ptr Sal, Sa0, $0 or (10 pt) The table on the right is declared in the data segment of a MIPS program. Consider an instruction 'jalr,' which is identical to 'jal Ss2 (namely, the target address is in Ss2) except that the return address is saved in Sv1 instead of returns it from the function. The return value in $s0 is an integer between l and 6 0 8. Sra. Assume that either FUNO or FUN1 updates $s0 and r FUNO 01 01 01 01 01 01 FUN1 la $s1, 00 li $s0,1 00: word word rept: lw $s2, (Ss1) jalr $v1, $s2 word sll $0, $s0, 2 add $s1, $$1, $s0 lw $$1, (Ss1) ai: word b rept word Q0 Q0 FUNO: word word FUN1: a. When 'b rept instruction completes its execution for the first time, what values will be in Ss1 and Ss2? Ss1: Ss2:_ b. When 'b rept' instruction completes execution for the 2nd time, what values will be in Ss1 and Ss2? Ss: QExplanation / Answer
7)
lw $t0,($a0)
lw $t1,($a1)
bgt $t0,$t1,L1
sw $a1,4($a0)
or $a1,$a0,$0
L1:
jr $ra
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.