4-Write MIPS assembly for the following function. Assume N is passed to your function in register $a0. Your output should be in register $v0 at the end of your function. Note: You must implement this function recursively. The purpose of this assignment is to learn how to manipulate the stack correctly in MIPS. int Myfun (int N) { if (N<4) return 1; return ( 4* Myfun(N-3)+ 2*Myfun(N-2)+ Myfun(N-1)+N );} Please explain each instruction with a comment. Please submit your source code and a screenshot that shows the registers with correct output value for N=4, i.e., Myfun(4) returns 11 I need to print 11 inside MARS IDE. The MIPS code that the other expert sent is printing 56 in MARS IDE.
4-Write MIPS assembly for the following function. Assume N is passed to your
function in register $a0. Your output should be in register $v0 at the end of your
function. Note: You must implement this function recursively. The purpose of this
assignment is to learn how to manipulate the stack correctly in MIPS.
int Myfun (int N)
{
if (N<4) return 1;
return ( 4* Myfun(N-3)+ 2*Myfun(N-2)+ Myfun(N-1)+N );}
Please explain each instruction with a comment. Please submit your source code
and a screenshot that shows the registers with correct output value for N=4, i.e.,
Myfun(4) returns 11
I need to print 11 inside MARS IDE. The MIPS code that the other expert sent is printing 56 in MARS IDE.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps