Question: I need some help converting C++ code into MIPS assembly. Please, and thank you! Description: For this project, your objective is to convert the given

I need some help converting C++ code into MIPS assembly. Please, and thank you!

Description: For this project, your objective is to convert the given C++ code into MIPS assembly. Please do not modify the C++ code itself. You are only allowed to make modifications to the assembly file. Start writing your code below the sumOfDoubleEvenPlace: label.

-

When doing a C++ to MIPS conversion with functions, it can be done in the following steps:

-

1. Assign variables to registers. When inspecting code, any constant values in expressions may need to be assigned to temporary registers.

-

2. Initialize variables to registers. (actually put the values into the registers.)

-

3. Then move onto the rest of the code.

-

4. For functions, remember for non-leaf functions(functions that call other functions, you must save the values of the $s? registers you are using. You will save these values on the stack. Pushing values is done via storeword(sw) and popping values is done via loadword(lw).

-

5. Remember that $t, $v, $a, and $ra registers are not preserved across function calls.

-

6. YOU ONLY NEED TO Implement the function sumOfDoubleEvenPlace. DO NOT MODIFY MAIN OR GETDIGIT. Doing this may result in incorrect values.

-

Expected Output:

Expected Value: 23 Value: 23

Expected Value: 21 Value: 21

-

Submission: .s file.

-

-

I need some help converting C++ code into MIPS assembly. Please, and

thank you! Description: For this project, your objective is to convert the

-

-

given C++ code into MIPS assembly. Please do not modify the C++

code itself. You are only allowed to make modifications to the assembly

Base M Code data 2 exp Val 23 Expected Value 23 Your Value a SC11 Z exp Val 21 a sciiz Expected Value 21 Your Value 4 endl a SC11 An 6 text 9 int get Digit (int number) 100 number $t0 11 result of modulo t1 12 result of div 10 13 14 Sum 15 get Digit 16 add $t0 $a0, $0 #make a copy of arg0 17 li $t3, 10 18 19 bge St 0, $t3 else 20 add $v0, $t0, $0 21 j func-return else 22 $t1 $t0 $t3 23 rem. div 2, $t0 $t3 24 25 add $v0, $t1 $t2 26 func return 27 Jr ra 28 30 31 int sum OfDoubleEven Place (int number) 32 List Used Registers Here suma Of Double Even Place 34 35 36 test 1 37 test 39 result 1 s2 40 result 2 41 42 main. 43 l i $50, 8974 4563 int test 1 89744563 44 li $s1, 98756421 nt test2 98756421 li $s2 int result 1 0; 45 46 li $s3, 0 int result 2 0; 47 48 49 code for first function call 50

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!