Question: Can anyone help me convert C++ code into MIPS assembly? Please, and thank you! - - - Description: For this project, your objective is to
Can anyone help me convert 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 main: label and above the exit: label. For this project stay BETWEEN these labels. When doing a C++ to MIPS conversion, 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.
-
Expected Output:
String: dlrow laer eht ot emoclew
-
Submission: .s file
-
-

-
-

-
-
In other words, you will be converting the C++ code file above called 'p5code.cpp' into MIPS assembly!
Base MIPS Code data endl asci iz "In" used for cout endl label ascii z String byte String WW 5 text 7 addr of string $s0 $s 1 beg $s2 end 10 temp $s3 11 main 12 13 exit 14 la $a0 label puts label into argo (a0 register) for cout 15 addi $v0, $0, 4 puts 4 in v0 which denotes we are printing a string 16 sys call make a sys call to system 17 puts address of string into argo (a0 register) 18 move Sa $s0 for cout 19 addi $v0, $0, 4 puts 4 in v0 to denote we are printing a String 20 sys call make a sys call to system 21 22 la $a0 endl puts the address of the string endl into a0 23 addi $v0, $0, 4 puts 4 into v0 saying we are printing a string 24 sys call 26 addi $v0, $0 10 27 sys call p5code Base s Base MIPS Code data endl asci iz "In" used for cout endl label ascii z String byte String WW 5 text 7 addr of string $s0 $s 1 beg $s2 end 10 temp $s3 11 main 12 13 exit 14 la $a0 label puts label into argo (a0 register) for cout 15 addi $v0, $0, 4 puts 4 in v0 which denotes we are printing a string 16 sys call make a sys call to system 17 puts address of string into argo (a0 register) 18 move Sa $s0 for cout 19 addi $v0, $0, 4 puts 4 in v0 to denote we are printing a String 20 sys call make a sys call to system 21 22 la $a0 endl puts the address of the string endl into a0 23 addi $v0, $0, 4 puts 4 into v0 saying we are printing a string 24 sys call 26 addi $v0, $0 10 27 sys call p5code Base s
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
