是的,這是可能的,但你必須把它放在浮點寄存器$ F0 ... $ F31:
li $t0 , 59 // values assignment to temporary registers
li $t1 , 3
mtc1 $t0,$f0 //move from int register to float-point register
cvt.s.w $f0,$f0 //Convert int values to float-point values
mtc1 $t1,$f1
cvt.s.w $f1,$f1 //Convert int values to float-point values
li $t2 , 1
li $t3 , 1
mtc1 $t2, $f2
cvt.s.w $f2,$f2
mtc1 $t3, $f3
cvt.s.w $f3,$f3
li $t6 , 1
mtc1 $t6, $f6
cvt.s.w $f6,$f6
//Start of the while loop
li $t5, 0
mtc1 $t5, $f5
cvt.s.w $f5,$f5
while : c.gt.s $f1, $f5
bc1f endwhile
//checks the intital condition and if it's false jump to endwhile
div.s $f4,$f2,$f0 // $f4 = $f2/$f0
mult.s $f3, $f3 ,$f4 // $f3 = $f3 * $f4
sub.s $f0, $f0, $f6
sub.s $f1, $f1, $f6
b while //jump to label while
endwhile: // your code
如果您有任何麻煩,也許你可以檢查該網頁,認爲這是一個很好的參考:http://logos.cs.uic.edu/366/notes/mips%20quick%20tutorial.htm http://www.cim.mcgill.ca/~langer/273/12-coprocessors.pdf
Xavier,任何機會,你可以看看唉我的計劃我放在一起,我無法得到輸出的工作。感謝您的幫助。 http://stackoverflow.com/questions/33249638/mips-input-and-output-help-floating-point – Cfs0004