How to Solve the equations in Assembly language in MIPS on Mars
Solve Equation in MIPS
Task
1:Write a program to solve the following
3.5*2-2+2
.data: num1f:.float 3.5 num2f:.float 2 num3f:.float 2 num4f:.float 2 .text: main: lwc1 $f0,num1f lwc1 $f1,num2f lwc1 $f2,num3f lwc1 $f3,num4f mul.s $f4,$f0,$f1 sub.s $f5,$f4,$f2 add.s $f6,$f5,$f3 li $v0,2 mov.s $f12,$f6 syscall li $v0,10 syscall
Task 2:
Write a program to solve the following 7/4*1-3+7
.data
num1:.float 7
num2:.float 4
num3:.float 1
num4:.float 3
num5:.float 7
.text
lwc1 $f0,num1
lwc1 $f1,num2
lwc1 $f2,num3
lwc1 $f3,num4
lwc1 $f4,num5
div.s $f5,$f0,$f1
mul.s $f6,$f5,$f2
sub.s $f7,$f6,$f3
add.s $f8,$f7,$f4
li,$v0,2
mov.s $f12,$f8
syscall
Comments
Post a Comment