Fixed point support to GCC cross compiler

Submitted by shafi
on August 13, 2006 - 11:44am

Hello everyone,

I am involved with the porting of GCC for a new arm processor.
The trouble is that I have to add a feature which is not supported by GCC - Fixed point support.
You know adding a new support along with porting is going to be tough.

Someone told me that one can add support in two ways.
1. Include the support through the compiler (change the internals).
2. Outside the compiler, through a library. (library support)

I am not sure which one to pursue.
The processor has a dedicated hardware support for fixed point operations.
Providing the support through a library is a good option when this is so?

Could anyone tell me which will be the best approach?
and why it is so?

or better could anyone give me an example so that I can use it as a reference
while porting?

Thanks in advance.

Mohamed Shafi.
shafitvm@yahoo.com

What do you mean by fixed poi

coderpunk
on
August 15, 2006 - 9:39am

What do you mean by fixed point operation? Are you talking about Floating Point using integers instead of floats?

.cp

maybe he means

strcmp
on
August 15, 2006 - 11:45am

this http://en.wikipedia.org/wiki/Fixed-point_arithmetic

Implementing the operations in a library will be easier, if you are not already intimate with the relevant parts of gcc. You can just define inline functions or macros with the relevant inline assembler code in a header file, like for example is done in /usr/include/bits/mathinline.h in the libc6/glibc2.3.2-headers. You just have to learn gcc's asm() syntax for that, and your assembler has to know these operations of course. And most likely you can't use normal operators like in '1.1+2.3*3.2', but have to write add(1.1,mul(2.3,3.2)). Of course you have to code your asm carefully to allow gcc to still optimize your code. I once did this in Turbo Pascal for a fx16.16 type based on the 386's 32 bit arithmetics (Turbo Pascal only used 16 bit operations at this time) instead of 'real' hardware, this was relatively easy.

If your CPU doesn't have floating point at all and only fixed point, you may get away with defining it as a strange floating point type, but I don't know anything about this.

you will have to go through w

Anonymous (not verified)
on
August 17, 2006 - 12:09am

you will have to go through www.DSP-C.org for that

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.