Electronic – FPGA Floating-point to Unsigned 32bits

floating pointfpgaxilinx

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.

Best Answer

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