how can I convert this kind of code block to MIPS?
gap = (int)(gap / 1.3);
how can I convert this kind of code block to MIPS?
gap = (int)(gap / 1.3);
first load 1.3 to a f reg. ref: MIPS (or SPIM): Loading floating point numbers
.data
number: .double 1.3
.text
l.s $f2, number
now load f1 to (double)gap
mtc1 $a0, $f1
cvt.d.w $f1, $f1
then set $f3 = (double)(gap / 1.3)
div.d $f3, $f1, $f2
now convert it to int
cvt.w.d $f3, $f3
mfc1 $s2, $f3
thats all