Ich habe diesen Code:Wie wird ein Integer-Wert in ein Doppelregister in MIPS geladen?
void test(int x)
{
cout<<x;
double y=x+4.0;
cout<<y;
}
void main()
{
test(7); // call the test in main
}
In MIPS: nachdem ich den Wert des Parameters x in 0 ($ fp) in Stapel gelegt und zum Test springen:
lw $a0,0($fp) // load value of x and print it
li $v0,1
syscall
lw $t1,0($fp)
sw $t1,0($sp) // put the value of x in stack and point it by $sp
li.d $f0,4.0
s.d $f0,4($sp) // put the value 4.0 in stack and point it by $sp
l.d $f0,0($sp)
l.d $f2,4($sp)
add.d $f4,$f0,$f2
s.d $f4,8($sp) // put the result of add
l.d $f12,8($sp) // print the value of y
li $v0,3
syscall
Mein Problem ist, das Ergebnis von y in QTSPIM ist 4 .... das Problem, weil ich einen ganzzahligen Wert in einem Doppelregister laden ... Wie kann ich dieses Problem lösen ???
wie du gesagt hast ... es funktioniert dank @Chris Dodd – sam