Question: undefinedIIN this we just have to update this MIPS program to run correctly QUESTION 4. ANALYSIS OF MIPS ASSEMBLY PROGRAM (7 MARKS) Labels Line 1

undefinedIIN this we just have to update this MIPS program to runundefinedIIN this we just have to update this MIPS program to run correctly

QUESTION 4. ANALYSIS OF MIPS ASSEMBLY PROGRAM (7 MARKS) Labels Line 1 WNE loop: 4 srl 5 6 Instructions addi $1, $0, 0 add $3, $20, $1 lw $4, 0($3) $5, $4, 16 sll $6, $4, 16 or $4, 95, 96 $4, 0 ($3) addi $1, $1, 1 slt $5, $1, $21 beq $5, $zero, loop SW 7 8 9 10 The program above goes through the elements of an integer array whose base address is in register $20, and the number of elements is in register $21. It does something with the data in the array and writes it back. a. Unfortunately, this program does not work as intended. Rewrite the program so that it works properly, changing only what is necessary. You may also add instructions but these should be kept to the absolute minimum. You may assume that there are no errors in lines 4 to 6 inclusive and you are NOT allowed to change these lines. (3 marks) b. How many instructions are executed in the CORRECTED program if $21 = 5? (2 marks) C. Describe in one sentence what the CORRECTED program does. (2 marks) QUESTION 4. ANALYSIS OF MIPS ASSEMBLY PROGRAM (7 MARKS) Labels Line 1 WNE loop: 4 srl 5 6 Instructions addi $1, $0, 0 add $3, $20, $1 lw $4, 0($3) $5, $4, 16 sll $6, $4, 16 or $4, 95, 96 $4, 0 ($3) addi $1, $1, 1 slt $5, $1, $21 beq $5, $zero, loop SW 7 8 9 10 The program above goes through the elements of an integer array whose base address is in register $20, and the number of elements is in register $21. It does something with the data in the array and writes it back. a. Unfortunately, this program does not work as intended. Rewrite the program so that it works properly, changing only what is necessary. You may also add instructions but these should be kept to the absolute minimum. You may assume that there are no errors in lines 4 to 6 inclusive and you are NOT allowed to change these lines. (3 marks) b. How many instructions are executed in the CORRECTED program if $21 = 5? (2 marks) C. Describe in one sentence what the CORRECTED program does. (2 marks)

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!