hw-01-solutions - class with the students and testing it in...

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

View Full Document Right Arrow Icon
CSE 341 Fall 2011 Homework #1 Solutions 1. The simulator (SPIM) can be used to verify your program. Initialize values in $a0 and $a1 at the beginning of the program using an instruction such as addi . At the end of your program, set a breakpoint to view the results stored in $v0 and $v1. 2. $v0 := ($s2 - $s0/$s1) * 2 3. SLL $t0, $a0, 5 # $t0 is a temporary register. SUB $a0, $t0, $a0 # A different register may be used. 4. No solution provided. Answers may be checked by running the program in SPIM or XSPIM in bare mode. You may want to consider doing an interactive solution in recitation (developing the code in
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: class with the students and testing it in SPIM or XSPIM). 5. slt $t1, $v0, $s2 beq $t1, $0, convert 6. Optimal code can make a program more marketable and can consume less energy. Using less energy equates to longer battery life, more reliability, less negative impact on the environment (such as reduced greenhouse gas emission). Programs are more marketable since they run faster and in the case of mobile devices, last longer on a battery....
View Full Document

This document was uploaded on 11/03/2011 for the course CSE 341 at SUNY Buffalo.

Ask a homework question - tutors are online