Performance of floating point operations of F429
Hello,
I am measuring execution time of a function that operates with floating point numbers and noticed that it is more than I expect. I am using Nucleo F429ZI, clock is configured to the 50 MHz. For measuring the execution time I use TIM6 configured in the following way:
TIM6->PSC = 49;
TIM6->ARR = 0xFFFF;
TIM6->CNT = 0;For the test, I am measuring the time for which the following statement is processed:
float a = 1.3;
float b = 0.0007;
float c = 1.0;
float d = 12.25;
TIM6->CNT = 0;
TIM6->CR1 |= 1;
c += (a - b) * d;
TIM6->CR1 &= ~1;TIM6->CNT shows 28 microseconds. Disassembly is:
100 c += (a - b) * d;
08000548: vldr s14, [r7, #20]
0800054c: vldr s15, [r7, #16]
08000550: vsub.f32 s14, s14, s15
08000554: vldr s15, [r7, #8]
08000558: vmul.f32 s15, s14, s15
0800055c: vldr s14, [r7, #12]
08000560: vadd.f32 s15, s14, s15According to ARM, the total execution time for this instructions should be 11 cycles (according to CYCCNT they are 15).
The point that I am confused is why 15 cycles correspond to nearly 30 microseconds. Is way I am measuring it incorrect? Or there are some waits that I am not aware of?
Best regards.
John
