Question: IN MIPS ASSEMBLY Translate the following code to MIPS, ( the for loops) and implement it in the given code for matrix multiplication. data matrix_a:

IN MIPS ASSEMBLY

Translate the following code to MIPS, ( the for loops) and implement it in the given code for matrix multiplication. IN MIPS ASSEMBLY Translate the following code to MIPS, ( the for

data matrix_a: .word 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 .word 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 .word 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 .word 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48 .word 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60 .word 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72 .word 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84 .word 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 .word 97, 98, 99,100,101,102,103,104,105,106,107,108 .word 109,110,111,112,113,114,115,116,117,118,119,120 .word 121,122,123,124,125,126,127,128,129,130,131,132 .word 133,134,135,136,137,138,139,140,141,142,143,144

matrix_b: .word 133,134,135,136,137,138,139,140,141,142,143,144 .word 121,122,123,124,125,126,127,128,129,130,131,132 .word 109,110,111,112,113,114,115,116,117,118,119,120 .word 97, 98, 99,100,101,102,103,104,105,106,107,108 .word 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 .word 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84 .word 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72 .word 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60 .word 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48 .word 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 .word 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 .word 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12

matrix_c: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

bs: .word 3 n: .word 12

nline: .asciiz " " #Define new line string sp: .asciiz " " msga: .asciiz "Matrix A is: " msgb: .asciiz "Matrix B is: " msgc: .asciiz "Matrix C=A*B is: "

.text .globl main main:

la $s0, bs lw $s0, 0($s0) la $s1, n lw $s1, 0($s1) la $s2, matrix_a la $s3, matrix_b la $s4, matrix_c

la $a0, msga la $a1, matrix_a jal PRINT_MAT la $a0, msgb la $a1, matrix_b jal PRINT_MAT

# Your CODE HERE

# End OF YOUR CODE

la $a0, msgc la $a1, matrix_c jal PRINT_MAT

# Exit li $v0,10 syscall

PRINT_MAT: li $v0,4 syscall addi $a2,$0,0 PL4: bge $a2,$s1,PL1 addi $a3,$0,0 PL3: bge $a3,$s1,PL2

lw $a0,0($a1) li $v0,1 syscall la $a0,sp li $v0,4 syscall addi $a1,$a1,4 addi $a3,$a3,1 b PL3

PL2: addi $a2,$a2,1 la $a0,nline li $v0,4 syscall b PL4 PL1: jr $ra

Matrix Multiplication: Matrix multiplication is a binary operation that takes a pair of matrices, and produces another matrix. The pseudo code and the graphical projection of the matrix multiplication of NXN square matrix is like below: for (i = 0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!