quiz2_sol - 1. (5 points) What expression does this compute...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
1.  (5 points) What expression does this compute and put in $t3?  Show your work by  writing the contents of the register changed after each instruction. (Assume a = $t0, b  = $t1, c = $t2).  add $t3, $t0, $t1 # $t3 = a + b             addiu $t3, $t3, -1 # $t3 = a + b – 1         sll $t3, $t3, 2  # $t3 = 4 (a + b – 1)     andi $t4, $t3, 0x1 # $t4 = 0   (because $t3 is a multiple #    of 4 and hence even)   beq $t4, $zero else # we jump to else part            sub $t3, $t3, $t2  # skip                            j exit # skip else:        add $t3, $t3, $t2 # $t3 = 4 (a + b – 1) + c   exit:        addiu $t3, $t3, 4 # $t3 = 4 (a + b – 1) + c + 4   2.  (5 points) Translate the C code given below to MIPS assembly code. Assume that the  value   a, b, i, j
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/29/2010 for the course CDA 3101 taught by Professor Small during the Spring '08 term at University of Florida.

Ask a homework question - tutors are online