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

The answer for question 1 gives the following line in theirdescription, \"We\'ll

ID: 3619029 • Letter: T

Question

The answer for question 1 gives the following line in theirdescription, "We'll use this simplified version for now, makeslight adjustment for future problems." What do they mean by theanswer being a simplifed version? What version is the answersupposed to be in and what should it look like? Are they talkingabout how the answer gives something like: lw $t0, 4($s7) instead of lw $t0, 16($s7) ? Thanks! The answer for question 1 gives the following line in theirdescription, "We'll use this simplified version for now, makeslight adjustment for future problems." What do they mean by theanswer being a simplifed version? What version is the answersupposed to be in and what should it look like? Are they talkingabout how the answer gives something like: lw $t0, 4($s7) instead of lw $t0, 16($s7) ? Thanks!

Explanation / Answer

Convert the following C code to MIPS. Assume the variables f,g, and h are assigned to registers $s0, $s1, $s2, respectively.Assume that the base address of the arrays A and B are registers$s6 and $s7, respectively. a.) f = g + h + B[4]
           add$s0,$s1,$s2               #f=g+h
           lw$t0,16($s7)                  #temp=b[4]--b[4] is the 5th element of B. Each elementis 4 bytes
         #B[0] isbytes 0-3,[1] is bytes 4-7... B[4] is bytes 16-19
           add$s0,$t0                      #f=g+h+B[4]

b.) f = g - A[B[4]]           lw  $t0,16($s7)               #$t0=b[4]
           add$t0,$t6                     #t0 has address of A[B[4]]
          lw   $t1,0($t0)                #t1=A[B[4]]
          sub  $s0,$s1,$t1             #f=g-A[B[4]]
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