Given the following C program and the mapping of registers to variables, complete the MIPS implementation of procedure Sum. int Dif(int a, int b) { return b a; } int Sum(int m, int n) { int p Dif(n+1,...


addi $sp, $zero, 6000   # Assume Stack memory starts at 6000. Do not modify.


# Procedure Main (Do not modify)
Main:
     add $a0, $zero, $s0
     add $a1, $zero, $s1

     jal Sum

     add $s2, $s0, $s1
     add $s2, $s2, $v0

     j End


# Procedure Sum
Sum:
     # Type your code here.


# Procedure Dif (Do not modify)
Dif:
     sub $v0, $a1, $a0
     jr $ra


End:


Given the following C program and the mapping of registers to variables, complete the MIPS implementation of<br>procedure Sum.<br>int Dif(int a, int b) {<br>return b<br>a;<br>}<br>int Sum(int m, int n) {<br>int p<br>Dif(n+1, m-1);<br>int q<br>Dif(m+1, n-1);<br>return p + q;<br>}<br>int main() {<br>int X, У;<br>Z %3D х + у+ Sum (х, у);<br>return 0;<br>}<br>

Extracted text: Given the following C program and the mapping of registers to variables, complete the MIPS implementation of procedure Sum. int Dif(int a, int b) { return b a; } int Sum(int m, int n) { int p Dif(n+1, m-1); int q Dif(m+1, n-1); return p + q; } int main() { int X, У; Z %3D х + у+ Sum (х, у); return 0; }

Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here