do not post this answer in C or C++, THE PROGRAM IS MIPS ASSEMBLY

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

do not post this answer in C or C++, THE PROGRAM IS MIPS ASSEMBLY

Post by answerhappygod »

do not post this answer in C or C++, THE PROGRAM IS MIPSASSEMBLY
Do Not Post This Answer In C Or C The Program Is Mips Assembly 1
Do Not Post This Answer In C Or C The Program Is Mips Assembly 1 (66.31 KiB) Viewed 18 times
Objectives: Learn how to write an assembly program that consists of functions, learn the MIPS calling conventions, and learn how to access a two-dimensional array in assembly language. This will also be an exercise in refreshing your memory on some of the mathematics you SHOULD have already had. Matrix multiplication is an important operation in numeric methods. Given two matrices A and B whose sizes are mxn and nxl respectively, their product C=AXB is defined as the following n (AB)ij = Σ airbrj ai1b₁j + ai2b2j + ... + ain bnj. r=1 The basic algorithm for matrix multiplication is shown below in a basic (although very inefficient) C program. void MultArray (int * A, int * B, int * C, int m, int n, int 1) { } = int, i, j,k; for (i=0; i<m; i++) for (j=0; j<1; j++) { c[j] = 0; } for (k=0; k<n; k++) {c[j]+] A [k] * B[k] [j]; } Functional Specifications: 1. Your program will start and issue an appropriate and unique welcome message of your choosing. 2. Prompt the user to enter a number between 2 and 6 which will be the size of the matrix. If a number less than 2 or greater than 6 is entered, issue an error message and prompt the user to re-enter the number. Keep doing this until a proper response. 3. In a loop, read in from standard input enough integers to fill in the first matrix. Store the matrix in memory. 4. In a loop, read in from standard input enough integers to fill in the second matrix. Store the matrix in memory. 5. Output the results of A x B to standard output. You need not store the results in memory but you can.
5. Output the results of A x B to standard output. You need not store the results in memory but you can. Implementation Specifications: 1. For simplicity sake your program will only multiply square matrices (Both matrices are the same size and the Rows and Columns are the same size). 2. You must use arrays to store the matrices that you multiply and enough storage must be set aside to accommodate the largest possible matrix. 3. Your program must use subroutines/functions. 4. Your program must pass parameters and return values. 5. Your program must incorporate the use of saving registers (more than one register). when calling a function 6. Your program must be documented in accordance with course requirements. Grading Rubric: 1. The program must assemble without errors. If the program does not assemble in QTSPIM no further grading can be done. 2. (5 Points) Proper Welcoming message. 3. (10 Points) Validate input size of matrix. 4. (10 Points) Functions/subroutines are used. 5. (10 Points) Parameters are passed and values returned. 6. (10 Points) Registers are saved 7. (5 Points) Proper Documentation 8. (50 Points) YOUR PROGRAM PRODUCES THE CORRECT OUTPUT Sample Output: Welcome to the Matrix Kultiplier NEO Please enter in the size of the matrix 2-6: 3 Enter in the matrix one number after another: 1 2 3 4 5 6 7 8 9
Printing Matrix Aaa 1 2 3 4 5 6 7 8 9 Enter in the matrix one number after another: 1 2 3 4 5 6 7 8 9 Printing Matrix B 1 2 3 4 5 6 7 8 9 Print Matrix C: Results of A x B 30 36 42 66 81 96 102 126 150 Suggestions: - I found it helpful to write it in C++ first. - Read in each matrix one number after another If you have a 3x3 matrix just read in nine numbers. The first three are the first row, second three is the second row and the third three is the third row. Make it simple. - Write a routine next that prints the matrix out. Pass the size of the matrix and the matrix address as parameters so you can print out each three of the matrices. - I suggest also having a routine that returns a value from a matrix given a certain row and column. When I wrote it I passed it the size of the matrix, the row, the column and the matrix. In this manner I could access MATRIXA and MATRIXB. - Formatting in Assembly is difficult to do so don't be concerned about making the output pretty. - I also found it handy to have a routine to modify a Row and Column of a matrix so I could update MATRIXC
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply