Question: Given the following assembly language program snippet: sum: slti $t 0 , $s 0 , 1 # test $s 0 bne $t 0 , $zero,

Given the following assembly language program snippet:
sum: slti $t0, $s0,1 # test $s0
bne $t0, $zero, sum_exit # go to sum_exit if $s0<=0
add $s1, $s1, $s0 # add $s0 to $s1
addi $s0, $s0,1 # subtract 1 from $s0
j sum
sum_exit:
Answer the following parts of this question with answers that are no more than 5 sentences long. Please do not provide any answers that are more than 5 sentences long:
a) Which of the following instructions use Immediate addressing mode?
b) What register or registers have their contents changed in the assembly language program snippet?
c) What register or registers do not have their contents changed in the assembly language program snippet?
d) Suppose the $s0 register has the value 10 and the $s1 register has the value 2 before the instructions of the snippet are executed. What value does $s1 have once the sum_exit label is branched to?
e) The $t0 register has a minimum integer value it will hold by the time all of the instructions of the snippet are executed. What is that minimum integer value, 0,-1,-2, or -3? Please state your answer as 0 or -1 or -2 or -3.
f) Suppose $s0 contains some unsigned integer value N before the before the instructions of the snippet are executed. Since $s0 contains the value N before the instructions of the snippet are executed, how many total times will the j instruction be executed?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!