[Solved] CSCI2500 Homework 3-matrix multiplication, this time using MIPS

$25

File Name: CSCI2500_Homework_3-matrix_multiplication,_this_time_using_MIPS.zip
File Size: 593.46 KB

SKU: [Solved] CSCI2500 Homework 3-matrix multiplication, this time using MIPS Category: Tag:
5/5 - (1 vote)

For this individual homework assignment, you will again implement matrix multiplication, this time using MIPS. More specifically, you will read in two matrices from the user and multiply them together. As with Homework 1, if you need a refresher in how matrix multiplication works, look in a math textbook or check out Wikipedia!

The first matrix is an nk matrix, while the second matrix is a km matrix. Therefore, the result will be an nm matrix. Use the read_int system call (syscall) to read in n, k, and m, as well as each unsigned integer matrix value.

One approach you could take is to store these important values in your .data section as follows (with sample hard-coded values shown):

.data

n: .word 4 k: .word 3 m: .word 4

Once you have your matrix sizes defined, dynamically allocate memory to store the actual matrices. This would be equivalent to calling malloc() or calloc() in C to allocate memory on the heap. And remember that each integer is one word (or four bytes) in size.

Example Program Execution

On the next page is an example MIPS program execution that you can use to better understand how your program should work, how you can test your code, and what output formatting to use for Submitty. Also use test cases from Homework 1 to test your MIPS code.

Note that you must input each value on a separate line in MIPS. And you can assume that the input given to your program is valid.

When displaying a matrix, each line must start with [ and end with ] (as with Homework 1), but in this assignment, left justify the columns by using TAB (t) characters as follows:

[12t34t5567t]

[8t9t123t]

[45t67t8t]

[9t10t11t]

This will display this 4 3 matrix as follows:

[12 34 5567 ]
[8 9 123 ]
[45 67 8 ]
[9 10 11 ]

(spim) load hw3.s

(spim) run

Please enter values for n, k, and m:

4

3

4

Please enter values for the first matrix (43):

10

20

30

40

50

60

70

80

90

100

110

120

Please enter values for the second matrix (34):

0

10

0

20

30

0

40

0

0

50

0

60

[10 20 30 ]
[40 50 60 ]
[70 80 90 ]
[100 110 120multiplied by ]
[0 10 0 20 ]
[30 0 40 0 ]
[0 50 0equals 60 ]
[600 1600 800 2000 ]
[1500 3400 2000 4400 ]
[2400 5200 3200 6800 ]
[3300 7000 4400(spim) 9200 ]

Error Checking

Given the complexity of this assignment, you can assume that all input values are valid unsigned integers. You can also assume that the correct number of values is given for each matrix. In other words, you do not need to validate the user input

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CSCI2500 Homework 3-matrix multiplication, this time using MIPS
$25