What is the general approach to floating point arithmetic?

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
landon
Experienced Member
Posts: 71
Joined: Mon Sep 06, 2010 4:05 pm

What is the general approach to floating point arithmetic?

Post by landon »

My XK-1 dev kit will be coming this week, so I am brand new to XMOS but not brand new to embedded or C programming.

I understand from reading the docs that XC has no support for floating points and pointers. I understand you can also code in C on XMOS and there is some floating point support in C for XMOS.

My question is very basic: where can I find more information about mixing C and XC programs? Is it possible to mix XC and C in the same application or do you have to be all-in one or the other environment?

I would like to use the XMOS in a sensor environment and would like to do as much of the DSP and statistical work directly on the XMOS as possible to reduce the amount of raw data I would need to push up the line for processing. I'm trying to push computation down into the XMOS for scaling purposes.

In general, how do you approach floating point intensive applications using XMOS and the current language choices and tools?

Landon


User avatar
segher
XCore Expert
Posts: 844
Joined: Sun Jul 11, 2010 1:31 am

Post by segher »

The hardware has no floating point support. Software floating point isn't terribly
fast -- are you sure you want to run floating-point intensive stuff? It might be
better to use fixed point (more work, of course, since you absolutely have to
think about ranges and accuracy and all that: with floating point, you would get
not terribly accurate numbers if you don't, with fixed point, you get total garbage).
User avatar
leon_heller
XCore Expert
Posts: 546
Joined: Thu Dec 10, 2009 10:41 pm
Location: St. Leonards-on-Sea, E. Sussex, UK.

Post by leon_heller »

XC and C modules can be mixed in the same program, with C handling the floating-point stuff.
User avatar
landon
Experienced Member
Posts: 71
Joined: Mon Sep 06, 2010 4:05 pm

Post by landon »

Thank you for the quick replies.