Question: 4 MIPS: Understand MIPS Code [ 1 8 pts ] An array of integers S is defined in the following code. Try to understand the

4 MIPS: Understand MIPS Code [18 pts]
An array of integers S is defined in the following code. Try to understand the code
and answer the following questions.
S: .word 14,-29,18,30,-12,12,106,-7
la $a0,S# load address of S into $a0; suppose $a0=020060000
addi $a1,$a0,28
move $v0,$a0 #move the value of $a0 into $v0
1w$v1,0($v0)
move $t0,$a0
loop: addi $t0,$t0,4
1w$t1,0($t0)
ble $t1, $v1, skip # go to skip if $t1$v1
move $v0, $t0
move $v1, $t1
skip: bne $t0,$a1, loop
(1) What flow-control statement does ble $t1, $v1 implement? [1 pts]
(2) To show that you fully understand the function of this program, briefly explain the usage
of the following 4 registers in the program. That is, what are these registers used for in
the program. For example, for register $a1, it stores the address of the last element of
array, indicating the end of array. pts]
Registers: $t0,$t1,$v0,$v1
(3) Briefly explain the usage of the two instructions move $v0, $t0; move $v1, $t1.[4
pts]
(4) Briefly explain the usage of the instruction bne $t0, $a1, loop. [2 pts]
(5) Briefly explain the function of this program, suppose the desired outputs of the program
are the contents of the registers $v0 and $v1.[3 pts]
(6) Determine the contents of the registers $v0 and $v1 after executing the code. [4 pts]
 4 MIPS: Understand MIPS Code [18 pts] An array of integers

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 Databases Questions!