CSCE 212: Intro to Computer Architecture Project 1
Part A (40%): Create a MIPS assembly code that reads four positive integers a, b, c, and d as input parameters. The code shall execute in MARS to prompt the user to enter four positive integers represented in decimal, each separated by the Enter key. The program shall calculate
f=(ax+by) and g=(cz+dw) using your own self-written multiplication code, in which x, y, z, and w are the first, second, third, and fourth leftmost non-zero digits of your Student ID. Here are some samples for better clarification:
The program should output f and g in decimal and binary, using syscall routines for each output.
Part B (20%): Create a MIPS assembly code, which calculates the below expressions: h = f/g;
Hint: Given a positive integer X, and a positive integer Y where X>Y, the division X/Y is computed such that unique integers Q and R satisfy X=( Y * Q + R) where 0 ≤ R < Y. The value Q is called the quotient and R is called the remainder. Some examples are:
{X = 7, Y = 2} then 7 = 2 * 3 + 1 so Q=3 and R=1 {X = 8, Y = 4} then 8 = 4 * 2 + 0 so Q=2 and R=0 {X = 13, Y = 5} then 13 = 5 * 2 + 3 so Q=2 and R=3
IMPORTANT NOTE 1: You are not allowed to use any of these instructions: { mul, mul.d, mul.s, mulo, mulou, mult, multu, mulu, div, divu, rem, sll, sllv, sra, srav, srl, srlv}
▪ Exponents (or Powers) are required to be realized only by using loops and add instruction. ▪ Quotient and Remainder should be calculated only by using loops and sub instruction.
IMPORTANT NOTE 1: You are NOT allowed to use functions, subroutines, and Macros. Example:
a8: (a*a)=a^2 ➔ a^2*a^2=a^4 ➔ a^4*a^4=a^8
* is the loop created to do multiplication through addition.
Student ID
Corresponding f and g expressions
R12345678
f=(a1+b2)and g=(c3+d4)
G87654321
f=(a8+b7)and g=(c6+d5)
D02040608
f=(a2+b4)and g=(c6+d8)
Sample Output:
ID = “Print your student ID Here, e.g. R02040608” Enter 4integers for a,b,c,d respectively:
4
3
2
1
f_ten =97
f_two =00000000000000000000000001100001 g_ten =65
g_two =00000000000000000000000001000001 h_quotient = 1
h_remainder = 32
Project 1 Report (40%)
Project Report submission: 100 points total as follows:
▪ Professional preparation: [10 points total] as follows:
i.e. Typed document with text of the paragraphs in Times New Roman 11 pt font, clear and grammatically well-formed explanations, cover sheet provided, page numbering and document heading numbering (1.0, 2.0, 3.0, etc to identify the required sections listed below).
▪ Report Content: [90 points total] as follows having the following numbered section headings:
1.0 Project Description: project name and description including program inputs and outputs. [10 points]
2.0 Program Design: description of how your code operates, and a flowchart with sufficient explanation about the program design. [10 points for description and 10 points for high quality flowcharts (Code2flow!)]
3.0 Symbol Table: 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., as well as any Labels used and their purpose on separate rows. [10 points for register table and 10 points for label table]
4.0 Learning Coverage: provide a list of at least 5 technical topics learned from this project. [10 points]
5.0 Test Plan: provide details in sentences identifying the inputs chosen to test the program and why these were selected, and justification why they provide adequate test coverage. [15 points]
6.0 Test Results: provide screen shot(s) of at least 3 proper MIPS code executions in MARS for your Test Plan inputs. [15 points]