Question: The MIPS code fragment below tries to copy words from the address in register $a0 to the address in register $a1, counting the number of

The MIPS code fragment below tries to copy words from the address in register $a0 to the address in register $a1, counting the number of words copied in register SvO. The code stops copying when it finds a word equal to 0. You do not have to preserve the contents of registers Sv1, $a0, and $a1. The terminating word should be copied but not counted. There are multiple bugs in this MIPS program; fix them and write a bug-free version. Make a list of the bugs found and explain them Use the MARS MIPS Simulator to verify the correct functionality of your program. Capture and attach the screen output that proves the correct operation 7. $2ero, loop: 1w $v1, 0 ($a0) addi $v0, sw $v1, 0($a1) addi $a0, $a0, 4 addi $al, $al, 4 beq Sv1, $zero, loop #loop if word copied !-zero #initialize count #read next word from source #write to destination #advance pointer to next source #advance pointer to next destination
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
