Question: I'm having trouble writing the code in MIPS. I know and understand how the code should work logically. What I want to do is take

I'm having trouble writing the code in MIPS. I know and understand how the code should work logically.
What I want to do is take the input and divide it into 3 substrings;
substr1: the current number system
substr2: the number
substr3: the desired number system
After getting the substrings, I would then check the current unit system and convert the input to binary. That way we only have 6 converting functions to write. That way with a uniform input we can now use substr 3 to convert it back to what it needs to be.
The pseudo code is what I have below:
if (substr1== B)
do nothing
else if (substr1== D)
convert to binary
else if (substr1== H)
convert to binary
else if (substr == 8)
convert to binary
else
print error message
// at this point we know that our number is in binary so we need to check what the output would be and convert it
// from this point I'm assuming substr2 has been converted in binary
if (substr3 ==B)
print subsrt2
else if (substr3 == D)
convert to decimal and print substr2
else if (substr3==H)
convert to hex and print substr2
else if (substr3= 8)
convert to octal and print substr2
Thank you again for taking the time to look into this problem. Please include a screenshot of the code working and the code below.
Problem 2 30 points Write a MIPS assembly program that implements a simple number system converter. You number converter will read in three items . (a) The input number's current number system (b) the number itself (c) the desired base type to convert to. We want our converter to support the number systems typically used in computers today. This includes (B)inary, (8)ctal, (D)ecimal, and (H)exadecimal Your code must read in two characters to represent the source number system and target number system as well as an integer operand to be converted. Depending on the inputs, the program will figure out whiclh arithmetic operations are needed to perform the conversion, and print the result to the console Note that the resulting number should have a prefix appended to it to designate which number system it was converted to. Use ob for (B)inary, 0o for (8)ctal, for (D)ecimal, and 0x for (H)exadecimal The console should display the following: Welcome title "Welcome to MIPS Number Converter!" On the next line the prompt "Please input the source number system, number to convert, and target number system:" (Input is typed on next line, aka put in a new line) A valid input would look like: "B 1111111111111111 D" The result should then be displayed as "Result: G65535" Please refer to Figure A.9.1 in the textbook for more information on reading/printing integers and characters from the console. BONUS nts are invalid, print a message stating the incorrect argument Include error checking. In case any argume (e.g., Target Number system does not exist, Number too large (in case the number is larger than what can be contained in a 32-bit register), etc., and correctly terminate execution BONUS2: Make a streamlined number converter! Your number converter now only should use 2 inputs. Using 2 inputs enhances the interface and user experience with vour tool. . The input number (now it also has its source number system prepended, e.g., Ox7FFF) The target number system (same as in Problem 2 description (e.g., B, 8, D, H)) Therefore a valid input that needs Binary to be converted to Octal would be: Ob1010111011101011 8 Problem 2 30 points Write a MIPS assembly program that implements a simple number system converter. You number converter will read in three items . (a) The input number's current number system (b) the number itself (c) the desired base type to convert to. We want our converter to support the number systems typically used in computers today. This includes (B)inary, (8)ctal, (D)ecimal, and (H)exadecimal Your code must read in two characters to represent the source number system and target number system as well as an integer operand to be converted. Depending on the inputs, the program will figure out whiclh arithmetic operations are needed to perform the conversion, and print the result to the console Note that the resulting number should have a prefix appended to it to designate which number system it was converted to. Use ob for (B)inary, 0o for (8)ctal, for (D)ecimal, and 0x for (H)exadecimal The console should display the following: Welcome title "Welcome to MIPS Number Converter!" On the next line the prompt "Please input the source number system, number to convert, and target number system:" (Input is typed on next line, aka put in a new line) A valid input would look like: "B 1111111111111111 D" The result should then be displayed as "Result: G65535" Please refer to Figure A.9.1 in the textbook for more information on reading/printing integers and characters from the console. BONUS nts are invalid, print a message stating the incorrect argument Include error checking. In case any argume (e.g., Target Number system does not exist, Number too large (in case the number is larger than what can be contained in a 32-bit register), etc., and correctly terminate execution BONUS2: Make a streamlined number converter! Your number converter now only should use 2 inputs. Using 2 inputs enhances the interface and user experience with vour tool. . The input number (now it also has its source number system prepended, e.g., Ox7FFF) The target number system (same as in Problem 2 description (e.g., B, 8, D, H)) Therefore a valid input that needs Binary to be converted to Octal would be: Ob1010111011101011 8
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
