XC: About time for floating-point support

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
User avatar
ahenshaw
Experienced Member
Posts: 96
Joined: Mon Mar 22, 2010 8:55 pm

XC: About time for floating-point support

Post by ahenshaw »

Okay, when the XC language was first released, I understood that some capabilities, such as floating-point support wouldn't be available. The first versions of Occam didn't have floating-point. However, floating-point was quickly added to that language, and it's about time that it is added to XC.

I really like XC, but it's getting very annoying working around this particular deficiency. Sometimes, it's natural to place the floating-point-necessary code into it's own C file; but, often it is not.

What is so particularly hard or unnatural about floating-point that XC can't directly support it?


yzoer
XCore Addict
Posts: 133
Joined: Tue Dec 15, 2009 10:23 pm

Post by yzoer »

XC *can* support floating point... in software

Implementing floating point in hardware takes up a significant amount of space and it's really not that necessary as you can use fixed point math instead. The XC devices have a single clock MAC and support for doubles which should be PLENTY.

So to answer your question: The cost would go up, the system would get more complicated (you'd have to save all those FPU registers for each context, for example) and on a microcontroller, it's really not necessary IMO.

-Yvo
User avatar
Bianco
XCore Expert
Posts: 754
Joined: Thu Dec 10, 2009 6:56 pm
Contact:

Post by Bianco »

yzoer wrote:XC *can* support floating point... in software

Implementing floating point in hardware takes up a significant amount of space and it's really not that necessary as you can use fixed point math instead. The XC devices have a single clock MAC and support for doubles which should be PLENTY.

So to answer your question: The cost would go up, the system would get more complicated (you'd have to save all those FPU registers for each context, for example) and on a microcontroller, it's really not necessary IMO.

-Yvo
He's talking about that C does have a floating point type whereas XC does not.
User avatar
Andy
Respected Member
Posts: 279
Joined: Fri Dec 11, 2009 1:34 pm

Post by Andy »

XC now supports float types.
User avatar
ahenshaw
Experienced Member
Posts: 96
Joined: Mon Mar 22, 2010 8:55 pm

Post by ahenshaw »

Wow! That's great! Was this announced? I can't seem to find anything about it at XMOS.com. The current XC Programming Guide http://www.xmos.com/node/14806?page=0 still says "XC does not support floating point, long long arithmetic, structure bit-fields or volatile data types, and no goto statement is provided."
richard
Respected Member
Posts: 318
Joined: Tue Dec 15, 2009 12:46 am

Post by richard »

The 12.0.0 beta tools add support for floating point and long long in XC (see the release notes here). The XC spec will be updated once the tools come out of beta.
Post Reply