0

代码旨在循环,根据用户输入(n)计算斐波那契数列。在 PCSpim 中,我正在接收:

(解析器)文件第 71 行的语法错误。c.ep.d $f0, $f8

    s.d $f2, 0.0 #f0 - These two house the fibonacci f0 + f1 numbers throughout the loop
    s.d $f4, 1.1 #f1
    
    li.d $f8, 0.0 #Used respectively for when I need a zero or a one.
    li.d $f10, 1.0
    
    
    mtc1 $a0, $f0  #n is entered by the user in main, converted from integer to double here.
    cvt.d.w $f0, $f0 # f0 = n
    
    sub.d $f0, $f0, $f4 # -1 from n preemptively as I do the first calculation above.
    loop:
    add.d $f6, $f4, $f2 #$f6 = f0 + f1
    add.d $f2, $f4, $f8 # f0 = f1
    add.d $f4, $f6, $f8 # f1 = (f0 + f1) 
    sub.d $f0, $f0, $f10 # - 1 from n
    
    
    
    c.ep.d $f0, $f8 #comparing DoubleZero and n  <--- This is where the error is coming from
    
    bc1f loop #continue to loop if n is not equal to 0.


    li $v0, 3
    add.d $f12, $f10, $f6 #print the double
    syscall
    #move $v0, $f4

    jr $ra #return to main```
4

0 回答 0