Created
May 5, 2014 09:44
-
-
Save voter101/37518e0a1359b52e4c25 to your computer and use it in GitHub Desktop.
Mips exercise 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
li $v0, 7 | |
syscall | |
mov.d $f6, $f0 # f6 = a | |
li $v0, 7 | |
syscall | |
mov.d $f8, $f0 # f8 = e | |
# setting f2 = x0 | |
# f2 = x_(n-1) | |
addi $s0, $zero, 2 | |
mtc1.d $s0, $f0 | |
cvt.d.w $f2, $f0 | |
mov.d $f10, $f2 # f10 = 2 | |
loop: | |
div.d $f0, $f6, $f2 | |
add.d $f0, $f0, $f2 | |
div.d $f0, $f0, $f10 | |
sub.d $f4, $f0, $f2 | |
abs.d $f4, $f4 | |
c.lt.d $f4, $f8 | |
mov.d $f2, $f0 | |
bc1f loop | |
mov.d $f12, $f0 | |
li $v0, 3 | |
syscall |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment