In LabVIEW 2012 you could use Single-Precision Floating-Point Data Type
In my project I needed to type cast same U32 data to SGL type DMA stream (to CPU), but LabVIEW FPGA doesn't support this type cast. I have to create my own U32 to SGL Type Cast.
I used IP Integration Node and VHDL code to create Type Cast U32 number to SGL.
-------------------------------------- -- typecast from U32 to SGL -- -- two descriptions provided -------------------------------------- library ieee; use ieee.std_logic_1164.all; -------------------------------------- entity typecastU32_to_SGL_ent is port( u32: in std_logic_vector(31 downto 0); sgl: out std_logic_vector(31 downto 0) ); end typecastU32_to_SGL_ent; --------------------------------------- architecture typecastU32_to_SGL_arch of typecastU32_to_SGL_ent is begin process(u32) begin sgl <= u32; end process; end typecastU32_to_SGL_arch; architecture typecastU32_to_SGL_beh of typecastU32_to_SGL_ent is begin sgl <= u32; end typecastU32_to_SGL_beh; --------------------------------------- |
Licence: Copyleft
Version: 1.0
LabVIEW FPGA 2012
Enjoy
Peter
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
Did you try using the "To Single Precision Float" Conversion Function?
Why does using this require compilation tools when I'm using cloud compile?
It would be nice if labview supported type casting for data types.
Hey Jon,
The NI LabVIEW FPGA Floating Point Library does provide a 'sgl to u32' and 'u32 to sgl' cast that should work without the local compilation tools being required. It can also be found in VI package manager.