# Name: # Person Number: .globl main .globl initialize .globl studentCode .data #Do not change these values, but feel free to add more below matrix_M matrix1: .word 4, 3, 2, 7, 8, 1 matrix2: .word 3, 7, 2, 8, 9, 0 matrix_A:.word 0, 0, 0, 0, 0, 0 #Store result of Part 1 here matrix3: .word 4, 3, 2, 7, 8, 1, 4, 2, 8, 4, 2, 1 matrix4: .word 3, 7, 2, 8, 9, 0, 4, 3, 2, 7, 8, 1 matrix_M:.word 0, 0, 0, 0, 0, 0, 0, 0, 0 #Store result of Part 2 here # Guide to interpret matrix # Matrix 1 is a 3x2 matrix, so with the given values it would look like this # | 4 3 | # | 2 7 | # | 8 1 | # Use this template to interpret the other matrixes .text #In your code DO NOT CHANGE $s0 - $s5 unless you know how to restore the values. main: jal initialize or $0,$0,$0 #NOP j studentCode or $0,$0,$0 # Used to load start of matrices addresses into corresponding registers # DO NOT TOUCH initialize: lui $at, 0x1000 ori $s0, $at, 0 ori $s1, $at, 24 ori $s2, $at, 48 ori $s3, $at, 72 ori $s4, $at, 120 ori $s5, $at, 168 jr $ra or $0,$0,$0 #NOP studentCode: # Write your code here DO NOT TOUCH anything else above print_Results: #Prints 2 lines of results, Line 1 is result addition lui $at, 0x1000 # Line 2 is result of multiplication or $0,$0,$0 #NOP ori $s2, $at, 48 #All register values are reset here so do not worry if you changed them ori $s5, $at, 168 addi $t0,$0,',' sw $t0,204($at) or $0,$0,$0 #NOP addi $t0,$0,10 sw $t0,208($at) or $0,$0,$0 #NOP addi $t0,$0,6 result_1: beq $t0,$0,result_1_end or $0,$0,$0 #NOP lw $a0,0($s2) or $0,$0,$0 #NOP addi $v0,$0,1 syscall ori $a0, $at, 204 addi $v0,$0,4 syscall addi $t0,$t0,-1 addi $s2,$s2,4 j result_1 or $0,$0,$0 #NOP result_1_end: ori $a0, $at, 208 addi $v0,$0,4 syscall addi $t0,$0,9 result_2: beq $t0,$0,result_2_end or $0,$0,$0 #NOP lw $a0,0($s5) or $0,$0,$0 #NOP addi $v0,$0,1 syscall ori $a0, $at, 204 addi $v0,$0,4 syscall addi $t0,$t0,-1 addi $s5,$s5,4 j result_2 or $0,$0,$0 #NOP result_2_end: print_Results_End: