The program below is a MIPS program for 3x3 matrix multiplication. So far i have the below code, but i keep recieveing the ouput of 000 when i need the output should be 0,6,12,0,6,12,0,6,12 seperated...

The program below is a MIPS program for 3x3 matrix multiplication. So far i have the below code, but i keep recieveing the ouput of 000 when i need the output should be 0,6,12,0,6,12,0,6,12 seperated by a new line which is the matrix multiplication of AxB. What is wrong with the code? .data newline:.asciiz "\n" # newline A: .word 1,3,2,1,3,2,1,3,2 B: .word 0,1,2,0,1,2,0,1,2 C: .space 36 A_row: .word 3 A_col: .word 3 B_row: .word 3 B_col: .word 3 .text main: la $s0, A la $s1, B la $s2, C lw $t0, A_row lw $t1, A_col lw $t2, B_row lw $t3, B_col li $s3, -1 #i li $s4, -1 #j li $s5, -1 #k j LOOP1 LOOP1: addi $s3, $s3, 1 # i++ bge $s3, $t0, END j LOOP2 LOOP2: addi $s4, $s4, 1 # j++ bge $s4, $t1, LOOP1 j LOOP3 LOOP3: addi $s5, $s5, 1 # k++ bge $s5, $t2, Show_C mul $s6, $t1, $s3 # s6 = A_col * i add $s6, $s6, $s5 # s6 = s6 + k mul $s6, $s6, 4 # s6 = s6 * 4 add $s6, $s6, $s0 # s6 = s6 + A lw $t4, 0($s6) # load s6 to t4 mul $s7, $t3, $s5 # s7 = B_col * k add $s7, $s7, $s4 # s7 = s7 + j mul $s7, $s7, 4 # s7 = s7 * 4 add $s7, $s7, $s1 # s7 = s7 + B lw $t5, 0($s7) # load s7 to t5 mul $t8, $t3, $s3 # s8 = B_col * i add $t8, $t8, $s4 # s8 = s8 + j mul $t8, $t8, 4 # s8 = s8 * 4 add $t8, $t8, $s2 # s8 = s8 + C mul $t4, $t4, $t5 # t4 = t4 * t5 add $t6, $t4, $t6 # t6 = t4 + t6 sw $t6, 0($t8) # store s8 to t6 j LOOP3 Show_C: li $v0, 1 lw $a0, 0($t8) syscall la $a0, newline li $v0, 4 syscall j LOOP2 END: li $v0, 10 lw $s0, 0($t8) syscall

May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here