2016-02-01 11:32 AM
Hello,
Using STM32F4 and IAR I am trying to convert a float (32bit) into Half-precision floating-point (16bit).(I am aware of the significant precision loss, but I have bandwidth limitations)Looking at ST's AN4044 and IEEE 754-2008 it seems possible yet I can't figure out how to define it in IAR.Is there a way to convert float to fp16 using the FPU, Using IAR / ASM instruction?If you'd do it in code do you know any other fast method?---http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/DM00047230.pdfhttp://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0472g/BABBHHHF.html #stm32f4-float-fpu2016-02-01 11:44 AM
The FPU isn't going to help you. ARM generally eschews the use of transistors to things which are useless/wasted.
A quick google brought up this, plenty of other stuff out therehttps://fgiesen.wordpress.com/2012/03/28/half-to-float-done-quic/
Transmission bandwidth or processing bandwidth? I can only believe it's the former.2016-02-01 09:59 PM
Thanks clive, was hoping I was missing something :\
And yes, Transmission bandwidth :)The link was fp16 to fp32, I need the other way around, but the idea is clear.2016-02-02 09:28 AM
I'll walk that back a bit, it looks like VCVTB/VCVTT provide a means to go between F16 and F32, or alternate F16 forms (AHP).
VCVTB{<
cond
>}.FF16 <
Sd
>,<
Sm
>
VCVTT{<
cond
>}.FF16 <
Sd
>,<
Sm
>
VCVTB{<
cond
>}.FF32 <
Sd
>,<
Sm
>
VCVTT{<
cond
>}.FF32 <
Sd
>,<
Sm
>
I've tended to avoid these due to the woeful precision they bring
If your compiler supports them directly, the conversion should be expressible as a simple casting operation.
http://www.keil.com/support/man/docs/armcc/armcc_chr13591242334htm
https://en.wikipedia.org/wiki/Half-precision_floating-point_format
https://gcc.gnu.org/onlinedocs/gcc/Half-Precision.html