Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Compelete the following MIPS code with the instructions provided. (Each number i

ID: 3707060 • Letter: C

Question

Compelete the following MIPS code with the instructions provided. (Each number in the matrix is represented in signed 2’s complement form. )

Part 1: add the two matrices and store the result in memory starting at address given in s2. The matrices are of the size 3 X 2 each. The two matrices are stored starting at two memory locations whose addresses are given in two registers, s0 and s1.

Deliverables: ? The Code with detailed comments ? Flowchart ? Short description of the approach and the program flow ? Simulation input(s) and results

Part 2: For two matrices that are stored at starting addresses given by s3 and s4 respectively, with M1 of size 3 X 4 and M2 of size 4 X 3. Multiply M1 and M2 and stroe the result in memeory starting at address given in s5.

Deliverables: ? The Code with detailed comments ? Flowchart ? Short description of the approach and the program flow ? Simulation input(s) and results

Use XPSIM to run the MIPS code and Do not use commands such as Li, La, Mov or any other pseudo instructions, dont modified anything except where it says "studentCode:" Detail of comments and explaintaions would be greatly appreciated.

Explanation / Answer

IMPS Code:

========= .file 1 ""

.section .mdebug.abi32

.previous

.nan legacy

.module fp=32

.module nooddspreg

.abicalls

.text

.align 2

.globl main

.set nomips16

.set nomicromips

.ent main

.type main, @function

main:

.frame $fp,240,$31 # vars= 224, regs= 1/0, args= 0, gp= 8

.mask 0x40000000,-4

.fmask 0x00000000,0

.set noreorder

.set nomacro

addiu $sp,$sp,-240

sw $fp,236($sp)

move $fp,$sp

sw $0,28($fp)

sw $0,32($fp)

movz $31,$31,$0

sw $0,36($fp)

sw $0,40($fp)

sw $0,44($fp)

sw $0,48($fp)

li $2,4 # 0x4

sw $2,28($fp)

li $2,3 # 0x3

sw $2,32($fp)

li $2,7 # 0x7

sw $2,36($fp)

li $2,8 # 0x8

sw $2,40($fp)

sw $0,52($fp)

sw $0,56($fp)

sw $0,60($fp)

sw $0,64($fp)

sw $0,68($fp)

sw $0,72($fp)

li $2,3 # 0x3

sw $2,52($fp)

li $2,7 # 0x7

sw $2,56($fp)

li $2,8 # 0x8

sw $2,60($fp)

li $2,9 # 0x9

sw $2,64($fp)

sw $0,8($fp)

b $L2

nop

$L5:

sw $0,12($fp)

b $L3

nop

$L4:

lw $2,8($fp)

nop

sll $3,$2,1

lw $2,12($fp)

nop

addu $2,$3,$2

sll $2,$2,2

addiu $3,$fp,8

addu $2,$3,$2

lw $3,20($2)

lw $2,8($fp)

nop

sll $4,$2,1

lw $2,12($fp)

nop

addu $2,$4,$2

sll $2,$2,2

addiu $4,$fp,8

addu $2,$4,$2

lw $2,44($2)

nop

addu $3,$3,$2

lw $2,8($fp)

nop

sll $4,$2,1

lw $2,12($fp)

nop

addu $2,$4,$2

sll $2,$2,2

addiu $4,$fp,8

addu $2,$4,$2

sw $3,68($2)

lw $2,12($fp)

nop

addiu $2,$2,1

sw $2,12($fp)

$L3:

lw $2,12($fp)

nop

slt $2,$2,2

bne $2,$0,$L4

nop

lw $2,8($fp)

nop

addiu $2,$2,1

sw $2,8($fp)

$L2:

lw $2,8($fp)

nop

slt $2,$2,3

bne $2,$0,$L5

nop

sw $0,100($fp)

sw $0,104($fp)

sw $0,108($fp)

sw $0,112($fp)

sw $0,116($fp)

sw $0,120($fp)

sw $0,124($fp)

sw $0,128($fp)

sw $0,132($fp)

sw $0,136($fp)

sw $0,140($fp)

sw $0,144($fp)

li $2,4 # 0x4

sw $2,100($fp)

li $2,3 # 0x3

sw $2,104($fp)

li $2,2 # 0x2

sw $2,108($fp)

li $2,7 # 0x7

sw $2,116($fp)

li $2,8 # 0x8

sw $2,120($fp)

li $2,1 # 0x1

sw $2,124($fp)

li $2,4 # 0x4

sw $2,132($fp)

li $2,2 # 0x2

sw $2,136($fp)

li $2,8 # 0x8

sw $2,140($fp)

sw $0,148($fp)

sw $0,152($fp)

sw $0,156($fp)

sw $0,160($fp)

sw $0,164($fp)

sw $0,168($fp)

sw $0,172($fp)

sw $0,176($fp)

sw $0,180($fp)

sw $0,184($fp)

sw $0,188($fp)

sw $0,192($fp)

li $2,3 # 0x3

sw $2,148($fp)

li $2,7 # 0x7

sw $2,152($fp)

li $2,2 # 0x2

sw $2,156($fp)

li $2,9 # 0x9

sw $2,160($fp)

li $2,4 # 0x4

sw $2,168($fp)

li $2,2 # 0x2

sw $2,172($fp)

li $2,7 # 0x7

sw $2,176($fp)

li $2,8 # 0x8

sw $2,180($fp)

sw $0,16($fp)

b $L6

nop

$L11:

sw $0,20($fp)

b $L7

nop

$L10:

sw $0,24($fp)

b $L8

nop

$L9:

lw $3,16($fp)

nop

move $2,$3

sll $2,$2,1

addu $2,$2,$3

lw $3,20($fp)

nop

addu $2,$2,$3

sll $2,$2,2

addiu $3,$fp,8

addu $2,$3,$2

lw $4,188($2)

lw $2,16($fp)

nop

sll $3,$2,2

lw $2,24($fp)

nop

addu $2,$3,$2

sll $2,$2,2

addiu $3,$fp,8

addu $2,$3,$2

lw $5,92($2)

lw $3,24($fp)

nop

move $2,$3

sll $2,$2,1

addu $2,$2,$3

lw $3,20($fp)

nop

mult $5,$2

mflo $2

addu $4,$4,$2

lw $3,16($fp)

nop

move $2,$3

sll $2,$2,1

addu $2,$2,$3

lw $3,20($fp)

nop

addu $2,$2,$3

sll $2,$2,2

addiu $3,$fp,8

addu $2,$3,$2

sw $4,188($2)

lw $2,24($fp)

nop

addiu $2,$2,1

sw $2,24($fp) $L8:

lw $2,24($fp)

nop

slt $2,$2,4

bne $2,$0,$L9

nop

lw $2,20($fp)

nop

addiu $2,$2,1

sw $2,20($fp) $L7:

lw $2,20($fp)

nop

slt $2,$2,3

bne $2,$0,$L10

nop

lw $2,16($fp)

nop

addiu $2,$2,1

sw $2,16($fp) $L6:

lw $2,16($fp)

nop

slt $2,$2,3

bne $2,$0,$L11

nop

move $2,$0

move $sp,$fp

lw $fp,236($sp)

addiu $sp,$sp,240

j $31

nop

.set macro

.set reorder

.end main

.size main,

.-main

.ident "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0

20160609"

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote