Home / Expert Answers / Computer Science / write-a-mips-program-using-sp-please-add-pseudo-code-thank-you-implement-the-following-procedure-i-pa559

(Solved): write a MIPS program using sp. please add pseudo code. thank you Implement the following procedure i ...



write a MIPS program using sp. please add pseudo code. thank you

Implement the following procedure in MIPS.
Use \( \$ s 0, \$ s 1, \$ s 2 \) registers for \( f, k \) and \( s u m \) variable
Implement the following procedure in MIPS. Use \( \$ s 0, \$ s 1, \$ s 2 \) registers for \( f, k \) and \( s u m \) variables. This means you will need to push \( \$ s 0, \$ s 1 \), and \( \$ s 2 \) to the stack at the beginning of the procedure and pop them off at the end of the procedure. Also, make sure you return the sum in \$vo. Define the following in your data section: \( \begin{array}{lll}\text {. data } \\ \text { g: } & \text {.word } 10 \\ h: & \text {. word } & 15 \\ \text { i: } & \text {. word } & 3 \\ \text { h: } & \text {. word } & 2 \\ \text { test: } & \text {. word } & 56 \\ \text { test2: } & \text { word } & 78 \\ \text { test3: } & \text {. word } & 91\end{array} \) In your main line code, - load g,h,l, and \( \times \) into \( \$ \mathbf{a 0}-\$ \mathrm{a} 3 \) registers. - Load the value of test into \( \$ s 0 \), test2 into \( \$ s 1 \), and test 3 into \( \$ s 2 \). - Call sum_proc, passing g.h,l, and \( \times \) into the procedure (in \( \$ a 0-\$ a 3 \) ) - Print the value returned from sum _proc. - Finally, print the value in \( \$ s 0, \$ \$ 1 \), and \( \$ s 2 \) to make sure it has been restored from the stack in your procedure. Example Execution: Returned value \( =35 \) \( 80=56 \) \( 81=78 \) \( 82=91 \)


We have an Answer from Expert

View Expert Answer

Expert Answer


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe