{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

tutorial5 - CS 230 Tutorial 5 February 7 2011 Jonathan...

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

View Full Document Right Arrow Icon
CS 230 Tutorial 5 February 7, 2011 Jonathan Rodriguez [email protected]
Background image of page 1

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

View Full Document Right Arrow Icon
CS 230 Tutorial 5 Assignment 2 Solutions MIPS Arrays
Background image of page 2
Assignment 2 Question 3 Compute the square of the sum of $1 and $2
Background image of page 3

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

View Full Document Right Arrow Icon
Assignment 2 Question 3 $3 = $1 + $2 $3 = $3 * $3 return Compute the square of the sum of $1 and $2
Background image of page 4
Assignment 2 Question 3 $3 = $1 + $2 $3 = $3 * $3 return Compute the square of the sum of $1 and $2 add $3, $1, $2 mult $3, $3 mflo $3 jr $31
Background image of page 5

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

View Full Document Right Arrow Icon
Assignment 2 Question 4 Compute $1 to the power of $2
Background image of page 6
Assignment 2 Question 4 if $2 < 0: $3 = 0 else: $3 = 1 while $2 > 0: $3 = $3 * $1 $2 = $2 - 1 return Compute $1 to the power of $2
Background image of page 7

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

View Full Document Right Arrow Icon
Assignment 2 Question 4 Compute $1 to the power of $2 slt $5, $2, $0 beq $5, $0, pos beq $0, $0, done pos: done: jr $31 if $2 < 0: $3 = 0 else: $3 = 1 while $2 > 0: $3 = $3 * $1 $2 = $2 - 1 return
Background image of page 8
Assignment 2 Question 4 Compute $1 to the power of $2 slt $5, $2, $0 beq $5, $0, pos add $3, $0, $0 beq $0, $0, done pos: done: jr $31 if $2 < 0: $3 = 0 else: $3 = 1 while $2 > 0: $3 = $3 * $1 $2 = $2 - 1 return
Background image of page 9

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

View Full Document Right Arrow Icon
Assignment 2 Question 4 Compute $1 to the power of $2 slt $5, $2, $0 beq $5, $0, pos add $3, $0, $0 beq $0, $0, done pos: addi $3, $0, 1 loop: slt $7, $0, $2 beq $7, $0, done beq $0, $0, loop done: jr $31 if $2 < 0: $3 = 0 else: $3 = 1 while $2 > 0: $3 = $3 * $1 $2 = $2 - 1 return
Background image of page 10
Assignment 2 Question 4 Compute $1 to the power of $2 slt $5, $2, $0 beq $5, $0, pos add $3, $0, $0 beq $0, $0, done pos: addi $3, $0, 1 loop: slt $7, $0, $2 beq $7, $0, done mult $3, $1 mflo $3
Background image of page 11

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

View Full Document Right Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}