This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Floating point representation with Ecos


Hi, everybody.

I am experiencing problems exchanging floating point data between my Ecos
target (ARM7 processor and gcc 4.0.1) and Matlab under Windows XP (which
uses IEEE 754 standard).
By studying the file ieeefp.h under language/c/libm/... i found that there
are two flavours of doubles on a little endian machine, as shown by the
fragment of code below:

   struct
   {
#if (CYG_DOUBLE_BYTEORDER == CYG_MSBFIRST) // Big endian
       unsigned int fraction1:16;
       unsigned int fraction0: 4;
       unsigned int exponent :11;
       unsigned int sign     : 1;
       unsigned int fraction3:16;
       unsigned int fraction2:16;
#else
       unsigned int fraction3:16;
       unsigned int fraction2:16;
       unsigned int fraction1:16;
       unsigned int fraction0: 4;
       unsigned int exponent :11;
       unsigned int sign     : 1;
#endif
   } number;

I could see that Matlab sends float data according to the second format
(sign bit is the higher order) and, so, i tried to change
CYG_DOUBLE_BYTEORDER to CYG_LSBFIRST and rebuild ecos (i had to change it
manually inside basetype.h file since it´s hard coded as CYG_MSBFIRST for
ARM architecture). This did not have any effect on the representation used
for double.

Unsure if the problem is related to gcc, i also tried -mfp=2 and -mfp=3
command line options, again with no results.

Do anyone know more about this stuff?
Basically, the questions are:

- Is floating point format defined by Ecos or by gcc?
- Why changing CYG_DOUBLE_BYTEORDER to CYG_LSBFIRST didn´t have any effect
on the floating point representation used?
- Why is this define hard coded as msb for ARM architecture? There shouldn´t
be an option on the config tool to allow changing this?
- Is the first form of representation compatible with IEEE 754 standard?

Regards.

Ramiro C. Carvalho


-- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]