CSE230-Quiz1-Ans

CSE230-Quiz1-Ans - CSE230/EEE230 Quiz#1 Solutions Note 1...

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

View Full Document Right Arrow Icon
CSE230/EEE230 Quiz #1 Solutions Note: 1. The quiz is open book and open notes. No laptop usage allowed. 2 . Work on all problems. They add up to 75 points total. 3 . Your answers must be legible and organized. 1. ( 15 points ) See the code below. Suppose that register $s0 stores the address of array A. Also, the initial values of $s1 and $s2 are 0 and 24, respectively. Loop: add $s1, $s1, 0($s0) addi $s0, $s0, 4 bne $s0, $s2, Loop a. Are all the instructions above correct? Find out the error and correct it. add $s1, $s1, 0($s0) => lw $t0, 0($s0) add $s1, $s1, $t0 b. What does this code do? This code loops through each item of array A and adds them up till the address of the current item equals to 24. 2. (20 points ) See the code below: add $1, $20, $7 lw $3, 4($20) j 0x1000 a. What does the code do? $1 = $20 + $7 $3 = Memory [$20 + 4] Go to 0x4000 b. What is the instruction format of each code, such as R-type, I-type, J-type? add
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
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 2

CSE230-Quiz1-Ans - CSE230/EEE230 Quiz#1 Solutions Note 1...

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

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