Question
implement mips code to get the sum, max, and min of the digit list and to print out the results (sum, max, and min) -
implement mips code to get the sum, max, and min of the digit list and to print out the results (sum, max, and min) - The output should be 3 numbers (sum, max, and min) like "35, 12, 4" Check out the sample.asm code and then implement hw2.asm (I am just providing "sample.asm" to help you. You don\'t have to use it.)
hw:
.data
digit: .word 10, 12, 23, 28, 7, 39, 10, 11, 23, 12, 3, 4, 5, 1
length: .word 14 # the length of the digit list
.text
main:
# HERE, implement mips code
# to get the sum, max, and min of the digit list above
# and to print the results (sum, max, and min) .end
sample:
.data
digit:
.word 10, 12, 23, 28
str: .asciiz " "
.text
main:
la $s1, digit
lw $t0, 0($s1)
lw $t1, 4($s1)
lw $t2, 8($s1)
lw $t3, 12($s1)
addi $t4, $t0, 5
sw $t4, 20($s1)
lw $t0, 20($s1)
li $v0, 1
add $a0, $t0, $t1
syscall
li $v0, 4
la $a0, str
syscall
li $v0, 1
sub $a0, $t2, $t3
syscall
.end
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started