Question: 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
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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
