I am using the OMAP3530 to perform some floating point math and I notice that the typecast operation is incorrect on the OMAP. I use the VFPV3 to do floating point and I recompiled the RTS libraries for eabi and VFPV3.
Please look at the following test code - and the output from using the OMAP3530 and running it on the desktop using the libraries with the GCC compiler
int main()
{
double ffreq = 4092002.55;
double fnominalNco = 262.40025;
double fncoval = ffreq*fnominalNco;
unsigned int fval = ((double)fncoval+0.5);
printf("Nco Val %f %f %f %x %d\r\n",
ffreq,
fnominalNco,
fncoval,
fval,
fval);
return 0;
}
Output from GCC:
Nco Val 4092002.550000 262.400250 1073742492.120638 4000029c 1073742492
Output from OMAP3530:
Nco Val 4092002.550000 262.400250 1073742492.120638 40000280 1073742464 Please note the huge discrepancy I looked at the dissambly code 0x81C54C7C: EEB71BC2 DD S2, D2 Looks like it is all done using processor - also of note is that just converting double to the float by itself results in the incorrect result. Please advise.
0x81C54C80: EEF61A00 VMOVS S3, #5.000000e-01
0x81C54C84: EE311A81 FADDS S2, S3, S2
0x81C54C88: EEBC1AC1 FTOUIZS S2, S2
0x81C54C8C: EE11CA10 FMRS R12, S2