Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a MIPS assembly program in the MARS simulator that solves the following problem. Ask the user to enter 4 unsigned (positive) 32-bit integers. Read

Write a MIPS assembly program in the MARS simulator that solves the following problem. Ask the user to enter 4 unsigned (positive) 32-bit integers. Read these 4 integers; let's call them A, B, C, D. At the end of your program, registers $t8 and $t9 should contain the 64-bit result of ((A*B) + (C*D)); $t8 should have the most significant 32 bits and $t9 should have the least significant 32 bits. We will not test your code with invalid inputs, so you don't need to clutter your code with checks for invalid inputs. Hint: The tricky part here of course is to perform addition on two 64-bit values. Since you can only do 32-bit additions in MARS, you'll somehow have to figure out how to propagate a carry from the 32nd bit to the 33rd bit. When you add two large 32-bit numbers (with addu $t1, $t2, $t3), the result may be a 33-bit number, but MIPS does not give you access to that 33rd bit. So you'll have to explicitly compute that 33rd bit. Note that the 33rd bit is a 1 if at least two of the following three bits are 1: (i) the 32nd bit of the first operand, (ii) the 32nd bit of the second operand, (iii) the carry generated by the sum of the 31 least significant bits.

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

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

3rd Edition

0760049041, 978-0760049044

More Books

Students also viewed these Databases questions

Question

55. For any events A and B with P(B) 0, show that

Answered: 1 week ago

Question

What is meant by planning or define planning?

Answered: 1 week ago

Question

Define span of management or define span of control ?

Answered: 1 week ago

Question

What is meant by formal organisation ?

Answered: 1 week ago

Question

What is meant by staff authority ?

Answered: 1 week ago