Question: Q2. Write a MIPS program that prompts the user for a 4-bit binary number, reads it as a string, and outputs its decimal equivalent. When

Q2. Write a MIPS program that prompts the user for a 4-bit binary number, reads it as a string, and outputs its decimal equivalent. When calculating the decimal value, use a loop to process the 4-character input string. Assume the user enters a valid binary number. (10 marks) Hints What is the hex decimal value for ASCII '0' and '1'? Shifting left by one bit doubles the value (if the new value fits in current register) New instruction: Shift left logical by a variable number of bits (not necessarily used here) . silv $se, $s1, $s2 # $s0 $51 shifted left by the value in $s2 Sample run 0101 program is finished running (dropped off bottom)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
