Question
This is my code in MIPS. Please go over and let me know what is wrong with it. Please run it in the actual program.
This is my code in MIPS. Please go over and let me know what is wrong with it. Please run it in the actual program. Thank you.
.data
a: .word 703
height: .word 0
weight: .word 0
bmi: .float 0
number1: .float 18.5
number2: .float 25
number3: .float 30
name: .asciiz "What is your name? "
inputBuffer: .space 20
heightInfo: .asciiz "Please enter your height in inches: "
weightInfo: .asciiz "Please enter your weight in pounds (round to a whole number): "
output1: .asciiz "This is considered underweight. "
output2: .asciiz "This is a normal weight. "
output3: .asciiz "This is considered overweight. "
output4: .asciiz "This is considered obese. "
.text
lw $t1, height
lw $t2, weight
#display message to ask for user's name
li $v0, 4
la $a0, name
syscall
#take user name
li $v0, 8
la $a0, inputBuffer
li $a1, 20
syscall
#ask user for height
li $v0, 4
la $a0, heightInfo
syscall
#take user height
li $v0, 5
syscall
move $t1, $v0
la $t3, ($t1)
#ask user for weight
li $v0, 4
la $a0, weightInfo
syscall
move $t2, $v0
la $t4, ($t2)
#take user weight
li $v0, 5
syscall
move $t2, $v0
lwc1 $f0, a #f1 = 703
lwc1 $f2, ($t1) #f2 = height
lwc1 $f4, ($t2) #f3 = weight
lwc1 $f12, bmi #f12 = bmi
lwc1 $f14, number1
lwc1 $f16, number2
lwc1 $f18,number3
cvt.s.w $f6, $f0
cvt.s.w $f8, $f2
cvt.s.w $f10,$f4
mul.s $f10, $f6, $f10 #weight = weight * 703
div.s $f12, $f10, $f2 #bmi = weight/height
c.lt.s $f12, $f14
bc1t exit1
c.lt.s $f12, $f16
bc1t exit2
c.lt.s $f12, $f18
bc1t exit3
li $v0, 4
la $a0, output4
syscall
#exit
li $v0, 10
syscall
exit1:
li $v0, 4
la $a0, output1
syscall
exit2:
li $v0, 4
la $a0, output2
syscall
exit3:
li $v0, 4
la $a0, output3
syscall
hm4 comparbiity Mode] Word X Cu Find Write a MIPS program that calculates bmi. Use the following C++ code as pseudocode. The variable bmi can be single or double precision. 1 includeStep 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