Question: Homework Assignment #2 MIPS Instructions CDA 3100, Computer Organization ! Problem 1 (10 points) After the following instructions, what will be the value in $to?



Homework Assignment #2 MIPS Instructions CDA 3100, Computer Organization ! Problem 1 (10 points) After the following instructions, what will be the value in $to? addi Sto, $0, 10 ori $t0, $to, 3 Problem 2 (10 points) Assume the current values in $to and $t1 are 0 and 1, respectively. What will be the value in sto after the following instructions? xori $t0, ti, 7 sll $t0, $t0, 2 Problem 3 (10 points) Suppose a word array is 0,1,2,3,4,5,6,7,8,9 and its starting address is in $to. After the following instructions, what will be the values in this array? lw $t1, 8($to.) sll $t1, $t1, 2 add $to, $to, $ti sw $t1, 8 (sto) Problem 4 (10 points) Suppose $t0 and $t1 are holding o and 1, respectively. When the program enters this segment, right before the program executes the instruction at p4L2, what will be the value in $t0? beg $t0, $ti, p4L1 p4L0:add $t0, $t0, $t1 p4Ll:bne $t0, $t1, p4L0 p4L2: Problem 5 (30 points) The following problems deal with translating from C to MIPS. Assume that the variables f, g, h are assigned to registers $50, $sl, $s2, respectively. Assume that the base address of the arrays A and B are registers $s 6 and $s 7, respectively. (a) f=g+h+B[4]; (b) f=g-A[B[4]]; For the C statements above, what is the corresponding MIPS assembly code? Problem 6 (30 points) Write MIPS assembly code that implements the following: if $t0 is not equal to $t1 and if $t0 a multiple of 4, multiply $to by 3; otherwise, do nothing
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
