# MIPS programing assignment question

**Objective**: The purposes of this laboratory are to expand your MIPS programing skills by implementing nested routines. This lab will be using the stack to pass operands to and return results from a routine and also to save return address information, so that nested routines can be implemented properly. You will develop assembly source that will be assembled, downloaded, and executed. The MIPS instruction set information distributed in class will be very useful for this software development process.

**Activities**: For this assignment, you will write a **main **routine in which two n x 1 vectors are defined in a similar manner to how numbers_to_use: is implemented in lab 0** . (n must be greater or equal to 6 and some of the values must be negative numbers β no values should be 0). **Your main program will configure the stack pointer appropriately and pass the parameters to a function called dot_product.

You will generate the function named dot_product which takes elements from each vector and after configuring the stack appropriately, passes two operands via the stack to a function called num_mult.

You will generate the function num_mult which takes two operands passed via the stack and multiplies them together. The function will then test the result to determine if the product can accurately be represented in 32 bits. If there is no overflow, then the num_mult will return the product in the $v0 register and a value of 0 in the $v1 register. If there is an overflow, then the num_mult procedure will return a value of 0 in the $v0 register and -1 in the $v1 register. *(Remember, the product of a positive number and a negative number is negative and the product of two negative number is positive, so your overflow detection logic should take this into consideration.) *

Your dot_product function will calculate a sum of the returned values from each call to num_mult and return the sum in $v0 and 0 in $v1. If any of the values returned from num_mult indicate an overflow, then the dot_product function will return a 0 in $v0 and -1 in $v1. In addition, your dot_product function should also check for an overflow in the running sum calculation process. In the event of an overflow in the running sum, the dot_product result will zero, as well.

Upon completion of the dot-product calculations, your main program should have a βspinβ loop at the end so that you can use the debugger to verify that you program has correctly calculated the vector dot product by examining the contents of the $v0 register.

For this lab, you will be graded on how well you document your code. You will be well served to spend a little time generating pseudocode that shows the high level detail of what your code is supposed to be doing. Spend some time generating the design before you actually start writing code. EECE 344L Microprocessors Spring 2015

Your code will be examined to verify that you strictly adhere to the MIPS register usage conventions. It is also mandatory that you use the stack to pass parameters to the called routines as specified above, as this is the one of the main objectives of this lab.

**Documentation**: Your lab activities must be documented following the guidelines that are provided on the lab report guidline. **Reference Information: **A vector dot product of two vectors, πΜ
πππ πΜ
, each of which have *n *elements, is defined as follows: πΜ
βπΜ
= ππ ππ+ ππβ1 ππβ1+β―..+π2 π2+π1 π1

### Subjects List

**Database (48)**

**Accounting (39)**

**Economics (34)**

**Finance (54)**

**Programming (122)**

**Management (69)**

**Marketing (25)**

**Report Writing (52)**

**Engineering (79)**

**Statistics (39)**

**Business Studies(45)**

**Case Studies (15)**

**Networking (26)**

**UML (9)**

**Science (23)**

**Nursing (11)**

**MATLAB (17)**

**Psychology (6)**

**Math (20)**

**Data Structure (9)**

**Python (15)**

**HRM (25)**

**IT (21)**

**Computer Science (57)**

**Law (4)**

**Essay (3)**

**Data Analysis (2)**

**Big Data (3)**

**Philosophy (2)**

**History (1)**