Review2 - registers $s0, $s1, $s2, $s3, $s4 respectively....

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Review 2
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Q1 ± Suppose that f, g are assigned to registers $s0, $s1 , and the base address of the array A and B are in $s6, $s7 . ± Provide MIPS code for C statement: f = g –A [B[4]] ns: Ans: lw $t0, 16($s7) //$t0=B[4] sll $t0, $t0, 2 //$t0=$t0*4 $0 ,$0 , / / $0$0 add $t0, $t0, $s6 //$t0=&A[B[4]]
Background image of page 2
Q2 ± Suppose that f, g, h, i, j are assigned to
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: registers $s0, $s1, $s2, $s3, $s4 respectively. What is the corresponding C code? add $s0, $s0, $s1 dd $s0 $s0 $s2 add $s0, $s0, $s2 add $s0, $s0, $s3 dd $s0 $s0 $s4 add $s0, $s0, $s4 ns: f += g + h + i + j; Ans: f += g + h + i + j; Q3 For the following decimal numbers, please convert them to 2s complement binary. 68 -68 Ans: 0100 0100 1011 1100...
View Full Document

This note was uploaded on 06/13/2011 for the course SIST cs100 taught by Professor Wd during the Spring '11 term at SUNY Upstate.

Page1 / 4

Review2 - registers $s0, $s1, $s2, $s3, $s4 respectively....

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online