Regarding something I read in a Xilinx manual saying this:

Because floating-point operations use considerable resources relative to integer/fixed point operations, the Vivado HLS tool utilizes those resources as efficiently as possible.

I was thinking about the following option:

If that is true about floating-point cores utilizing more resources, why can't we convert every float we have to u32 with a union like this:

union converter{
     float f32;
     unsigned int u32;

do the operations always with the u32 and then in the end convert everything back to float?

I saw some examples of people doing this in really small designs, but never in big ones with lots of float operations.

  • 2
    \$\begingroup\$ What sort of operations would you perform on such a union? \$\endgroup\$ Jun 12, 2015 at 14:38

2 Answers 2


Just because they use the same number of bits, doesn't mean that you can perform operations on them in the same way.

Look at how a float is actually constructed internally - how the bits are used (sign, exponent, fraction) and then think about what would happen if you simply did integer operations on it.

enter image description here

  • \$\begingroup\$ Yeap, I was confusing operations with conversions only. Sorry guys and ty \$\endgroup\$ Jun 12, 2015 at 14:51
  • 2
    \$\begingroup\$ Of course, if you do manage to design a working floating-point algorithm based on simple integer operations, the results can be mind-blowing. \$\endgroup\$ Jun 12, 2015 at 18:27

You can, but if you do, you cannot perform any floating point operations, so it wouldn't help you in calculations. Floating point calculations are time consuming. Load/Store operations aren't.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.