
Final Project - Create a MIPS assembly code
Program 1: (25 points) Create a MIPS assembly code that reads two positive integers A, and B as input parameters and computes the below F expression. The code shall execute in MARS to prompt the user to enter two positive integers, each separated by Enter key. The program shall execute the below equation.
=
The code should be executed in MARS to prompt the user to enter two positive integers, each separated by the Enter key. The program should calculate F using multiplication procedures and output F as floating-point number by using syscall routines.
Note: No multiplication and division {mul, mul.d, mul.s, mulo, mulou, mult, multu, mulu, div, divu, rem} are allowed to be used.
Output Sample
A
B
F
1
2
2
10
4
40
Program 2: (25 points) Create a MIPS assembly code that reads three signed numbers a, b, and c as input parameters. The code shall execute in MARS to prompt the user to enter three signed integers represented in decimal, each separated by Enter key. The program shall execute the below equation.
( + )
= ( − )+( ∗ )
1
Notes:
- Your program should print the output out on the screen.
- Your program should stop if the division by zero occurs.
- Your program should also check if there is any overflow and print a message “Overflow” if yes. If no overflow, the program should print “No overflow”.
Output Sample
a
b
c
Q
R
Message
0
2
2
8
0
No overflow
0
-4
2
-4
0
No overflow
-2
15
4
Division by zero
Program 3: (25 points) Create a MIPS assembly code that calculates the CPU execution time (equation is given below) for two processors, and find which processor is faster. The code shall execute in MARS to prompt the user to enter Instruction Count, CPI (Clock Per Instruction), Clock Rate (in GHz) for each processor as floating-point single-precision numbers. The program should print out which processor is faster and by how much.
_
=
_
Output Sample
Processor A
Processor B
Output
IC
CPI
Clock
IC
CPI
Clock
Rate
Rate
100
2.0
4GHz
100
1.2
2GHZ
A is 1.2 times as fast as B
100
4
4GHz
100
2.0
4GHz
B is 2 times as fast as A
2
Report Content (90 points):
You are required to provide the answers for the following numbered section headings:
1.0 Program Input/Output (20 points): Describe (or list) the inputs and outputs of each program.
2.0 Program Design (20 points): Describe how each code (program 1, program 2 and program 3) operates.
3.0 Symbol Table (20 points): Create a 2-column Table describing all Registers used and their specific Purpose in the code, where each register is listed on a separate row and identified by register name $t0, $s0, etc., and Labels used and their purpose on separate rows.
4.0 Learning Coverage (10 points): Provide a list of at least 5 technical topics learned from this project. Don’t replicate the technical topics that you listed in the previous homework.
5.0 Test Results (20 points):
5.1 Programs: Provide screen shot(s) of two 2 proper MIPS code executions in MARS for your Test Plan inputs. To illustrate, you are required to execute each code (program 1, program2, program 3) at least 2 times. In each time, you enter different input sets, and you get different outputs. Take a screen shot of each execution (“MARS Message” console) and include it in your report.
Project Submission
- Create a folder and name it as p3_username, where username is your university username.
- In MARS, save the code of program 1 as c1.asm, save the code of program 2 as c2.asm and program 3 as c3.asm.
- Save your report as a PDF file and name it as p3_report.pdf.
- Place the three asm files and the report document inside p3_username folder.
- Compress (or zip) the folder. Then, upload the compressed folder on Blackboard.
3