Files to submit: matmult.s
Time it took Matthew to complete: 3.5 hours (you’ll likely be much faster. I tried using macros here and ran into a lot of problems with them)
• All programs must compile without warnings when using the -Wall and -Werror options
• Submit only the files requested
◦ Do NOT submit folders or compressed files such as .zip, .rar, .tar, .targz, etc • If submitting in a group on Grade Scope please make sure to mark your partner.
◦ Only one of you has to submit there
• Your program must match the output exactly to receive credit.
◦ Make sure that all prompts and output match mine exactly.
◦ Easiest way to do this is to copy and paste them
• All input will be valid unless stated otherwise
• Print all real numbers to two decimal places unless otherwise stated
• The examples provided in the prompts do not represent all possible input you can receive.
• All inputs in the examples in the prompt are underlined
◦ You don’t have to make anything underlined it is just there to help you differentiate between what you are supposed to print and what is being given to your program
• If you have questions please post them on Piazza
1. Write a program called matmult.s that implements matrix multiplication in assembly. If you don’t know how to do matrix multiplication your can find a tutorial here.
1. This program should be callable from C and have the following signature:
1. int** matMult(int **a, int num_rows_a, int num_cols_a, int** b, int num_rows_b, int num_cols_b);
2. This function should multiply matrices a and b together and return the result
3. You cannot use the data section.
4. You must allocate space for this new matrix by calling malloc
2. You have been given a C file called main.c that accepts as command line arguments the names of two files that contain the matrices to be multiplied. main.c will read in these matrices, call your function, and then display the result. After it has displayed the result it will then free the space that has been malloced.
1. Your function must be callable by this file
3. You have also been given a makefile that should compile your program. Your program
MUST be able to be compiled by this makefile.
1. For those of you running 64 bit versions of Linux you may need to install the 32 bit
binaries.
2. The command to install on Ubuntu is: apt-get -y install gcc-multilib
Example:
cat mata/0-test.txt
3
3
470 -192 -539
235 -814 -538
-503 -418 541
cat matb/0-test.txt
3
3
313 531 802
26 860 -767
543 870 822
./matmult.out mata/0-test.txt matb/0-test.txt
-150559 -384480 81146
-239743 -1043315 370572
125456 -155903 361902