Question: Computer Architecture Project Help. File what.s download link: https://gofile.io/?c=hTLeEX 1. Run what.s in SPIM, examine some of the registers etc in the SPIM windows, and

Computer Architecture Project Help. File what.s download link: https://gofile.io/?c=hTLeEX

1. Run what.s in SPIM, examine some of the registers etc in the SPIM windows, and look in the code of what.s, and try to work out what it does. Check whether the program works if the argument is changed to 6, 1, 0, 10, 20, etc? Answer what the program does in one sentence.

2. Modify what.s so that it takes two arguments. If the arguments are both the same then the answer should be the same as that of what.s that takes only one argument. If they are different then you should figure out what your program should do based on the above. Try to make as few changes as possible. Give your new program a sensible name.

3. Enhance the program to allow it to receive the two arguments from the keyboard and display the result in the console window of SPIM. If any of the input arguments is a negative number (less than zero), your enhanced program should display a zero in the console.

What.s File Text

.data

arg: .word 5

.text

.globl main

main:

la $13, arg

lw $12, 0($13)

lw $13, 0($13)

addi $11, $zero, 0

beqz $12, fin

fori:

add $11, $11, $12

addi $13, $13, -1

bnez $13, fori

fin:

li $v0, 10

syscall

Computer Architecture Project Help. File what.s download link: https://gofile.io/?c=hTLeEX 1. Run what.s

Thanks

User Text Segment [00400000]..[00440000] ; 183: lw $a0 0 ($sp) # argo ; 184: addiu $al $sp 4 # argv ; 185: addiu $a2 $al 4 # envp ; 186: sll $v0 $a02 ; 187: addu $a2 $a2 $v0 ; 188: jal main ; 189: nop ; 191: li $v0 10 ; 192: syscall # syscall 10 (exit) ; 7: la $13, arg ; 8: lw $12, 0($13) ; 9: lw $13, 0 ($13) ; 11: addi $11, Szero, O 0400034] ; 14: add $11, $11, $12 ; 15: addi $13, $13, -1 00400040] ; 18: li $v0, 10 ; 19: syscall User Text Segment [00400000]..[00440000] ; 183: lw $a0 0 ($sp) # argo ; 184: addiu $al $sp 4 # argv ; 185: addiu $a2 $al 4 # envp ; 186: sll $v0 $a02 ; 187: addu $a2 $a2 $v0 ; 188: jal main ; 189: nop ; 191: li $v0 10 ; 192: syscall # syscall 10 (exit) ; 7: la $13, arg ; 8: lw $12, 0($13) ; 9: lw $13, 0 ($13) ; 11: addi $11, Szero, O 0400034] ; 14: add $11, $11, $12 ; 15: addi $13, $13, -1 00400040] ; 18: li $v0, 10 ; 19: syscall

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!