This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CSc 252 Homework 2 Version 1. 0 1 of 6 Homework 2 Due: 10am Tuesday, Sep. 20, 2011 Turnin: Three solutions: 1 g, 1 h , and 2 g . To receive credit for your solutions, you must show your work where applicable. Solutions to the remaining problems are attached. In answering questions for this assignment, use only the following MIPS instructions: add , addi , sub , slt , slti , beq , bne , j , lw , lh , lb , sw , sh , sb , and la . 1. This question assumes the following MIPS code, which sets up memory locations: hermit , kaibab , tanner , clear , creek , ribbon , falls and tonto . The code then loads the values of some of these variables into the indicated MIPS registers. In answering these questions, you can assume this code has already been executed, and that the value of some of the variables are already in the indicated registers. Each question is independent of the other questions. .data hermit: .word 42 kaibab: .word 912 tanner: .word 8271 clear: .word -879 creek: .word -16 ribbon: .word 2 falls: .word -95 tonto: .word 412 .text main: # set $s3 = tonto la $t0, tonto lw $s3, 0($t0) # set $s4 = hermit la $t0, hermit lw $s4, 0($t0) # set $s5 = clear la $t0, clear lw $s5, 0($t0) # set $s6 = creek la $t0, creek lw $s6, 0($t0) a. Put clear + creek in register $t9 . b. Put hermit - creek - clear + tonto into register $t2 . c. Put hermit + falls into register $t1 d. Put tonto - clear + hermit into memory location ribbon . e. if ( tonto != hermit ) put tonto + clear into register $s2 . f. if ( creek >= clear ) put ribbon + clear into register $s2 . g. turnin this one Put falls + tonto - creek into memory location hermit . h. turnin this one if ( ribbon - tanner <= falls ) put creek - kaibab into register $t7 . CSc 252 Homework 2 Version 1. 0 2 of 6 2. This question assumes the following MIPS code, which sets up memory locations: atsf , dlw , csx , and kcs . The code then loads the values of some....
View Full Document
This note was uploaded on 02/28/2012 for the course CSC 252 taught by Professor Moon during the Fall '11 term at University of Arizona- Tucson.
- Fall '11