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

I need help with this asap please. questions 1-4 MIPS Programming Assignment 6Na

ID: 3723724 • Letter: I

Question

I need help with this asap please. questions 1-4

MIPS Programming Assignment 6Name Analy zing MIPS Assembly Code) I Given the following segment of MIPS 2 Given the following segment of MIPS Assembly code. Before running the code, St8-4, Stl-1,52-2, and Sso What are the values of S, S2, and S after running the code Assembly code Before running the code, Sal-1 and Sa2-7 What are the values of Sat and Sa atter nunning the code e bgez St8, else addi Sso, S18- addi Stl,. Stt,2 b next while bge Sal,Sadone ddi Sal, Sal. ddi Sa2. 2 while else move Sso, Sts done addi $2, S12. next 3. Given the following MIPS Assembly program What are the values of registers St1 and Si2 after running the program? What is the value at memory location unitX after running the program program What are the values of registers $t3 and St4 after running the program? What is the value at memory location unitX after running the program? data numword 28 initAword-20 30-40 50 0-60 80 unitXword data unitX word? initAword-20 30-40 50 0-60 80 la StO. initA text la St0, initA li St, add S12, Sto, Se St3, loop: wS2,0(Sto addi $t2 St24 begz S12, done add Stl. St. S12 addi S10, Sto,4 b loop loop: blt St2, Sto, done add S3. S13, S14 addi St2, S12,4 b loop done: sw St, unitx SO) done: swS13, unitX(SO

Explanation / Answer

1. The first line of the programme is:

bgez $t8, else

This means that if the value stored at the t8 register is greater than 0 then branch to "else" labelled instruction else continue sequential execution. Here the initial value of t8 is 4, which is greater than 4 so programme execution would branch to else labelled instruction which is as follows:

else: move $s0, $t8

addi $t2, $t2, 3

Move instruction copies the value of 2nd operand to the 1st operand, therefore the value of t8 is copied to s0 register resulting value of s0 register is 4. Next instruction is addi instruction, which adds the value stored in the 2nd operand and an integer at the 3rd operand of the instruction and stores the resultant to the 1st operand. In our case, it is equivalent to t2 = t2 + 3, therefore new value of t2 is 5 as old value of t2 is 2(given in question).

Therefore the final values of t1, t2 and s0 are 1, 5 and 4 respectively.