Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

=+Where do you want to live and work?

Answered: 1 week ago

Question

=+1 Where are the best places in the world to live (and work)?

Answered: 1 week ago

Question

=+Are you interested in working on global teams?

Answered: 1 week ago