NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

FPGA Interface C API and fixed-point/floating-point types

Hello,

NI FPGA Interface C API allows to share integer values between CPU and FPGA on CompactRIO.

Why fixed-point and floating-point types are not supported ? (see http://zone.ni.com/reference/en-XX/help/372928G-01/capi/overview/)

Despite that, is there a tip to share fixed-point and floating-point types ?

Will NI FPGA Interface C API support one day this feature ?

Thank you in advance for your answer.

FloG.

0 Kudos
Message 1 of 5
(4,160 Views)

FloG, welcome!

While I can't speak to the future plans of the FPGA C API, I can tell you that you can cast/reinterpret the datatype into a supported type on the FPGA side and undo the operation on the C side.

See: http://digital.ni.com/public.nsf/allkb/B484B0F129BB2EFD86257660000223C6 (this covers FXP, which can be used if you coerce your SGL to FXP first) or http://forums.ni.com/t5/LabVIEW/Flatten-floating-point-on-FPGA-for-multichannel-DMA/m-p/2576179#M776... (covers the SGL case but is a bit more involved).

Message 2 of 5
(3,696 Views)

Hi Flog,

I'd like to chime in with some good news. We will be releasing floating point support in Q3 2016 and will likely release fixed-point support next. Can you comment on your use and needs for fixed-point support?

Thanks,

Anna Kozminski

Embedded Software Product Manager

National Instruments
0 Kudos
Message 3 of 5
(3,696 Views)

Hi,

Thank you for your answers.

Signal from modules such as NI9203 are seen as fixed point data for the FPGA. My purpose is to share this value with my C++ program as a float type (fixed point does not exit in C++)

Regards,

FloG.

0 Kudos
Message 4 of 5
(3,696 Views)

flog wrote:

...

(fixed point does not exit in C++)

...

This is largely because there is no one standard or implementation for fixed-point, you must (implicitly) be aware of what the representation of your number means to work on it, and you can adjust the representation for whatever your operations require. It is not maintained within the actual data itself (as is the case with floating point, when following the defined structure for floating-point data).

NI has a pretty good writeup concerning what fixed-point is (and it should help to illustrate why C/C++ doesn't support it natively): http://www.ni.com/newsletter/50303/en/

0 Kudos
Message 5 of 5
(3,696 Views)