100% This MIPS/SPIM program includes a subroutine called myadd that performs x=
ID: 3605485 • Letter: 1
Question
100% This MIPS/SPIM program includes a subroutine called myadd that performs x= (ytz);. In the space below, replace the myadd subroutine with one named mymin that will make x-min(y,z). Your code may take advantage of the fact that x, y, and z are consecutive words in memorv. You should test your routine using SPIM before you submit it, which will require merging it with a test framework like the one used in this MIPS/SPIM program but only submit the mymin routine here. # Addition routine: .text .globl myadd myadd #t0 = y #t1 = z #t2=y+ #x=t2 $t0, y la la addu $t1, $t2, 0($t1) $t0, $t1 la SW $t2, 0(Sto) $ra # returnExplanation / Answer
#########
#
# MIN ROUTINE:
#
#x= min(y,z)
#
.text
.globl mymin
mymin:
la $t0,y #t0 =y
lw $t0,0($t0)
la $t1,z
lw $t1,0($t1)
ble $t0,$t1,y_min
z_min:
la $t2,x #x=z
sw $t1,0($t2)
b func_end
y_min:
la $t2,x #x=y
sw $t0,0($t2)
func_end:
jr $ra #return
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.