Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hoene work 45 Total points Due If Sao \"5 and sal 6, what is the 1. (5 pts) Add

ID: 3862036 • Letter: H

Question

Hoene work 45 Total points Due If Sao "5 and sal 6, what is the 1. (5 pts) Add comments to the following Murs code value of Sv0? add St0, $zero, Szero loop: beq Sal, Szero, done add St0, $t0, Sao addi Sal, Sal, -1 done: addi St0, St0, -5 add $v0, St0, Szero 2. (5 pts) Write a sequence of MIPs instructions to do the following otherwise. set $s1 1 if the contents of s17 is an odd number and to 0 Please do to code. Instead, you could use some not use the division instruction in you logical instructions to test if a number is even or odd. 3. (5 pts) Write a sequence of no more than six MIPs instruction that extracts bits 17:11 of register sso and inserts them into bits 8:2 ofregister ssl, leaving all the remaining bits unchanged 4. (0 pts) Consider an array alo] to al9] of 10 elements such that alij contains 7. So a[0) 1, alij 7, a12) 49, etc. Let sso contain the base address of array Write MIPS code fragments to perform the following operations: a) Put the value 154 in a[5), storing it in memory b) Get a[7] from memory and put it in register st7. c) Add the contents of first five elements of the original array where each element has an even index (i 0,2,4...) and put in 5. (10 pts) Consider the following fragment ofccode for (int i 0: i 100: i i+1) Assume that x and y are arrays of words and the base address ofx and y are in sso and respectively. Variable i is associated with register Sa0. (a) Write the corresponding code for S. (b) How many instructions are executed during the running of this code? (c) How many memory data references will be made during execution?

Explanation / Answer

Answer 1.

Here in the first step we are initilizing $t0 with 0,

Then we loop till the value of $a1 becomes zero, and in each iteration we are adding the value of $a1 with the value of $t0, and also reducing value of $t0 by 1 in each iteration, hence after the loop completes the final value in $t0 is 15, so value of $v0 will be 15-5 , which is equal to 10, which is the answer.

Answer 2.

Here is the code for above scenario.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote