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

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) s11v $se, $s1, $s2 # $s0-$51 shifted left by the value in $s2 Sample run 0101 program is finished running (dropped off bottom) -- 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) s11v $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

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!