Question
Write a program using MIPSzy that functions equivalently to the following C code. Be sure to conserve registers in your code. In testing your code,
Write a program using MIPSzy that functions equivalently to the following C code. Be sure to conserve registers in your code. In testing your code, I may substitute values other than those initially assigned to the variables in the following snippets to make sure your conditional statements work correctly in all cases.
A) int a = 46; int b = 62; int c = (a + 1) * (b + 2); B) int x = 2 int w = 0; if (x == 0) { w = w + 10; } C) int w = 0; int x = 0; int y = 1; int z = 0; if (x == y) { w = 1; } else if (y == z) { w = 2; } else if (x == z) { w = 3; } D) int x = 1; int y = 1; int z = 0; if (x == 0) { z = -1; } else if (y == 0) { z = -2; } else { z = -3; } E) int x = 1; int y = 1; int z = 0; if (x <= y) { z = -1; }
Use the MIPSzy compiler found in Chapter 2.6 "A small assembly program" to write, test and run your code.
Once your program is successful, copy the code to an Ascii text file named Assignment01_Lastname_Firstname.txt.
Include all five snippets but put a #comment between A, B, C, D, E to delineate the five snippets.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started