2015-10-08 12:05 PM
Hi.
I am developing product, which should be small and fast as possible at the same time. Usually, I use parts which are in 48 pin QFPN or LQFP packages. Till now, I used F1 parts, but recently I went to F3. On F1 I did all calculations with integers only, because F1 doesn't have FPU and calculations with floats were too slow. Now, F3 parts also have FPU and I would like to ask a few questions.First, how comparable is float calculation (with FPU enabled) with integer calculation in terms of speed? Do you always use FPU and floats, even if speed is important for your application?How could I enable FPU in Keil?Is it possible to write FPU instructions in C or is it necessary to use assembly?Thanks #stm32f3 #fpu2015-10-08 12:45 PM
Keil has this ''Floating Point Hardware'' ''Use FPU'' combo-box. Causes it to generate FPU code, push/pop register, and use FPU based library code. The FPU only implements relatively simple operations, it's not an Intel 80x87 type FPU.
32-bit floats have awful precision, and it's not as if the FPU carries the values with higher precision for intermediate results. I generally avoid them unless the math and the number-space is very well understood. If you have an efficient integer implementation, I'd stick with it. Benchmark your code/algorithm implemented both ways. I have some code where the original author moved directly into 64-bit doubles from 64-bit integers and did the math, by keeping the math integer until I'd dropped the significant bit count below 50-bits we gained significant precision in the fractional portion of the results (all values below 0.1). The F1 was somewhat crippled by the slow FLASH, this was significantly remedied in the F2/F4 implementation.2015-10-09 12:08 PM
2015-10-09 12:58 PM
2015-10-09 01:16 PM
�? Multiply, multiply accumulate/subtract, multiply accumulate/subtract then negate (3 cycles)
�? Divide (14 cycles) Smiles, and let's the compiler compute reciprocal constants.
2015-10-09 01:34 PM