Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write and debug a MIPS program that performs the following operations: Prompt for and input three integers a, b, c using syscall s Display one

Write and debug a MIPS program that performs the following operations:

Prompt for and input three integers a, b, c using syscalls

Display one of the following statements depending on if a+b>c, or a+b=c or a+b

- You entered a+b greater than c

- You entered a+b equal to c

- You entered a+b less than c

Compute 1. 7*(a+b)+c

2. (c-2)*(a+b)+1

3. (a+b)*(c-2)*(b+5) and display the result of each computation. Be careful with operator precedence. Return to the operating system.

Your runs output must look exactly in format like the sample below. (If only close, but not exact, will result in lost points.). Note that only the output result will vary depending on the input numbers. Adjust your code until your output exactly matches (including horizontal and vertical spacing). You can use \" to put a double quote inside a text string. The values shown in bold here (not in your console window) are user inputs for this run.

What is integer "a"? 3

What is integer "b"? 4

What is integer "c"? 20

 You entered a+b less than c 
 7*(a+b)+c is 69 (c-2)*(a+b)+1 is 127 (a+b)*(c-2)*(b+5) is 1134 

1. You will need to use .text and .data directives to define program and data areas in SPIM.

2. A colon (:) must follow all labels. Note that labels allow easy reference to a specific address/place in the program or

an argument that is required.

3. Each data entry must be uniquely labeled to avoid any potential error.

4. The word "main:" must label the first line in a SPIM program and always be made global.

5. You may write only one instruction to a line (once past the instruction, you may add a comment, simply preceding with

a # sign).

6. All characters in a string are represented in ASCII code.

7. Use comments (#) to adequately write the logic of the program. Note comments do not wrap. If a comment takes

more than one line, start a new line with # and continue your comment.

8. A "syscall 10" to return control to OS. For example, li $v0, 10

syscall

9. For better readability well format your code:

use distinct columns for labels, opcode, operands and comments

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 Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions

Question

List and explain the key steps involved in text analytics.

Answered: 1 week ago

Question

Write a Python program to check an input number is prime or not.

Answered: 1 week ago

Question

3 The distinction between microeconomics and macroeconomics.

Answered: 1 week ago