Question: Show the code in full and not just the answer: Write a program in MIPS assembly that computes the sum of four positive integers of
Show the code in full and not just the answer:
Write a program in MIPS assembly that computes the sum of four positive integers of your choice. Do this by loading registers at the beginning of the program with ori instructions.
Don't do input or output or loading and storing from memory (since we have not covered this yet.) The instructions up through chapter 10 are enough. Put the result in register $10 at the end of the program. You will need several addu instructions since machine instructions have only two operands. Use only registers selected from $8 through $15.
Execute your program by repeated "single steps" through the machine code. At the end, $10 should hold the value you expect.
Create your source file using Notepad++ or other text editor. Align columns, do not use tab characters. Set your editor to use space characters when the tab key is pressed. Every assembly language statement should have a comment that explains what it is doing in terms of the problem. Start your source file with
## CS 254 Program 2 Spring 2021 ## ## Compute a + b + c + d ##
## Programmer: ## Date:
Set SPIM options to the following (See chapter 9 page 6):
ON Bare machine OFF Allow pseudo instructions OFF Load Exception Handler
ON Delayed Branches ON Delayed Load OFF Mapped I/O
Set these options as specified or SPIM will start up with options you dont want. You may have to set the options, close SPIM, and then restart it for the options to have an effect. Use only those instructions that have been discussed in the notes through chapter 10.
Turn In: (1) Your source program. This is a text file ending with the extension asm. (2) In the Comments section of the assignment submission page write a comment that shows the final bit pattern in register 10 and how it shows the correct sum of the integers you chose.
The source program should be nicely formatted. Labels (symbolic addresses) should start in column one. Nearly every line of the program will have a meaningful comment. All comments should start in the same column, perhaps column 35.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
