Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

More Books

Students also viewed these Databases questions