Skip to content

Instantly share code, notes, and snippets.

@voter101
Created May 5, 2014 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save voter101/37518e0a1359b52e4c25 to your computer and use it in GitHub Desktop.
Save voter101/37518e0a1359b52e4c25 to your computer and use it in GitHub Desktop.
Mips exercise 2
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