- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear
I use XMC4200 to verify the execution efficiency of "NOP".
But I'm seeing a gap in execution time. For example, I using Dave's way of doing 2 NOPs instruction.
All settings are optimized using -Os.
The first one uses the For loop
It's need take 5.767us.
The second uses ten nop instructions.
It's need take 727.689ns.
I also use Keil to do same test.
The first one uses the For loop
It's need take 2.078us.
The second uses ten nop instructions.
It's need take 430.206ns.
Dave and Keil may be the difference caused by the compiler, but will the NOP instruction also have such an impact?
The difference of the same 10 nop instructions is nearly 300ns
I didn't change the setting of SystemInit(void) in startup, so it should use the highest frequency of 80Mhz.
I also use Nuvoton's ARM M4 NUC480 series to do the same experiment.
https://www.nuvoton.com/products/microcontrollers/arm-cortex-m4-mcus/m487-ethernet-series/
And I had modify the CPU clock frequency PLL to 80Mhz
I use Keil to do same test.
The first one uses the For loop
It's need take 727.689ns.
The second uses ten nop instructions.
It's need take 187.643ns.
Tool | Dave | Keil | |||
Frequency | FOR loop | Ten nop instructions | FOR loop | Ten nop instructions | |
XMC4200 | 80MHz | 5.767us | 727.689ns | 2.078us | 430.206ns |
M487 | 80Mhz | - | - | 728.689ns | 187.643ns |
What kind of restrictions are there, thank you.
I have not compared the time difference of addition, subtraction, multiplication and division at present, but the instruction time of NOP will be different at the same frequency. And I haven't compared the difference between moving the NOP instruction to ram for execution.
Thanks,
Kris
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Check your 'arm instruction cycle count' in your code . You have two code both are required different instruction cycles. Also note on Cortex-M you cannot have exact delay with instructions.
Check your assembly codes and add the instruction cycles. Both sums are different.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Check your 'arm instruction cycle count' in your code . You have two code both are required different instruction cycles. Also note on Cortex-M you cannot have exact delay with instructions.
Check your assembly codes and add the instruction cycles. Both sums are different.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This thread will be closed due to long time no reply, you can create a new one if you have any other questions, thanks for your understanding.
Regards,
Owen