Question: For the MIPS code bellow: (a) By the side of each instruction, write a comment that explains its purpose. What does the code do? $al

 For the MIPS code bellow: (a) By the side of each

For the MIPS code bellow: (a) By the side of each instruction, write a comment that explains its purpose. What does the code do? $al contains the memory address that is base for the array vk] and $al stores the index k. sli $t1,$a1,2 add $t1, $a0,$t1 lw $t0,($t1) lw $t2,4($t1) SW $t2,0($t1) SW $t0,4($t1) (b) Find the errors in this code, and write the correct version of it: addi $sp,$sp,-12 SW $t0,8($sp) SW $t1,4($sp) sll $t1,$a1,2 add $t1$a0,$t1 lw $t0,($t1) $t2,4($t1) SW $t2,0($t1) SW $t0,4($t1) addi $sp,$sp, 8 $ra (c) Write a MIPS code that, calling the procedure above, moves the first element of the array all the way to the end. (Example: v[4={1,2,3,4). After calling this program v[4]=[2,3,4,1].) The base of the array, and its size are stored in sandsl respectively. lw jr For the MIPS code bellow: (a) By the side of each instruction, write a comment that explains its purpose. What does the code do? $al contains the memory address that is base for the array vk] and $al stores the index k. sli $t1,$a1,2 add $t1, $a0,$t1 lw $t0,($t1) lw $t2,4($t1) SW $t2,0($t1) SW $t0,4($t1) (b) Find the errors in this code, and write the correct version of it: addi $sp,$sp,-12 SW $t0,8($sp) SW $t1,4($sp) sll $t1,$a1,2 add $t1$a0,$t1 lw $t0,($t1) $t2,4($t1) SW $t2,0($t1) SW $t0,4($t1) addi $sp,$sp, 8 $ra (c) Write a MIPS code that, calling the procedure above, moves the first element of the array all the way to the end. (Example: v[4={1,2,3,4). After calling this program v[4]=[2,3,4,1].) The base of the array, and its size are stored in sandsl respectively. lw jr

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!