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

Plz show steps, thank you ( subject is Computer Architecture) 1. Write a MIPS as

ID: 3699601 • Letter: P

Question

Plz show steps, thank you ( subject is Computer Architecture)

1. Write a MIPS assembly program to find the average of three integer numbers Firstly, the program should store the three numbers in three registers: x - $s010, y = $s1 = 15, and z = $s2 = 20, Then the program should calculate the average: [xty+z]/3. As the average can be a non-integer, the quotient should be stored in register $s3 and the remainder in $s4. Lastly, the quotient and the remainder should be stored in the memory locations starting with 0x040100

Explanation / Answer

li $s0, -10 li $s1, 15 li $s2, 20 add $t0, $s0, $s1 # $t0 = x+y add $t0, $t0, $s2 # $t0 = x+y+z li $t1, 3 div $t0, $t1 # (x+y+z) / 3 mflo $s3 # quotient in $s3 mfhi $s4 # remainder in $s4 la $t2, 0x040100 # load address 0x040100 sw $s3, 0($t2) # store quotient at 0x040100 sll $t2, $t2, 2 # move to next address sw $s4, 0($t2) # store remainder at next memory address

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