cancel
Showing results for 
Search instead for 
Did you mean: 

Half-precision floating-point

arieljacob
Associate
Posted on February 01, 2016 at 20:32

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.pdf

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0472g/BABBHHHF.html

#stm32f4-float-fpu
3 REPLIES 3
Posted on February 01, 2016 at 20:44

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 there

https://fgiesen.wordpress.com/2012/03/28/half-to-float-done-quic/

Transmission bandwidth or processing bandwidth? I can only believe it's the former.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
arieljacob
Associate
Posted on February 02, 2016 at 06:59

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.

Posted on February 02, 2016 at 18:28

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

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..