cancel
Showing results for 
Search instead for 
Did you mean: 

Instruction Timings not matching ARM Cortex-M4 Manual

Timon1
Associate II

I am working with an STM32F3, a ChipWhisperer and the SimpleSerial library right now and trying to follow instructions executed. While doing so, I noticed that the number of CPU cycles does not seem to match what I expected from the ARM Cortex-M4 instruction timings. For example, I took a base code, subsequently added instructions and each time measured the number of cycles. My measurements are as following:

 

 instruction   | cycles

------------------------

 ldrb r9,%[z]  | 102

 add r4,#194   | 104

 mul r8,r12    | 105

 eor r5,#198   | 107

 strb r11,%[z] | 108

 

cycles is the number of cycles measured for all instructions added. add seems to take two cycles since ldrb gets pipelined with an instruction after relevant instructions if the add is not there.

What baffles me is the eor instruction. By my measurements, it takes two cycles to complete. Contrary to that, the ARM Cortex-M4 manual explicitly states that an eor instruction only takes one cycle.

Am I overlooking something or does the STM32F3 include something not mentioned in the ARM Cortex-M4 manual that can mess with the cycles?

The attachment contains the base code with all the instructions added between the lines 59 and 258. The Instructions above are between the lines 124 and 128.

 

Thanks in advance

10 REPLIES 10
BarryWhit
Senior III

Can you describe your setup for timing measurement and why you are confident that the measurements produced are cycle-accurate?

- If someone's post helped resolve your issue, please thank them by clicking "Accept as Solution".
- Once you've solved your issue, please post an update with any further details.