Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Add $t0, $a2, $a2 Add $t0, $t0, $t0 Add $v0, $Zero, $zero Add $t1, $zero, $zero Loop: add $t2, $t1, $a0 Lw $t3, 0($t2) Add
Add $t0, $a2, $a2
Add $t0, $t0, $t0
Add $v0, $Zero, $zero
Add $t1, $zero, $zero
Loop: add $t2, $t1, $a0
Lw $t3, 0($t2)
Add $t4, $t1, $a1
Lw $t5, 0($t4)
Add $t3, $t3, $t5
Sw $t3, 0($t2)
Add $v0, $v0, $t5
Addi $t1, $t1, 4
Slt $t6, $t1, $t0
Bne $t6, $zero, loop
Jr $ra
Assume that there are two arrays of equal size X[n] and Y[n]. their beginning address are stored in $a0 and $a1, respectively. Assume that the size n is stored in $a2
a)describe what the MIPS code does and what the return value in $v0 is
b) write an equivalent c program
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started