2012-10-11 01:00 AM
ST Cortex-M3 programming manual nicely describes all instruction, how they work and what they do but there is no info how many clock cycles it takes to execute given instruction.
Fortunately I found ARM Cortex-M3 manual and it clearly states all instruction cycles based on a system with zero wait states:Does anyone know why this info is missing in ST manual?2012-10-11 03:32 AM
Does anyone know why this info is missing in ST manual?
Probably because it would be duplicative, and not unique to the ST implementation.2012-10-11 04:18 AM
At least it should mention instruction timing is available from ARM.
2012-10-11 08:19 AM
At least it should mention instruction timing is available from ARM.
Kind of think that's the obvious place to start, but I've been doing this too long to be objective. At least several versions of the reference manuals do refer to ''Related documents'' in the preface that direct you to ARM, some other to ST specific representations RM0008, Rev 6 Available from www.arm.com: ■ Cortex™-M3 Technical Reference Manual RM0008, Rev 14 For information on the ARM Cortex™-M3 core, please refer to the STM32F10xxx Cortex™- M3 programming manual (PM0056). RM0090 Rev 1 Available from www.arm.com: ■ Cortex™-M4F Technical Reference Manual, available from: http://infocenter.arm.com/help/topic/com.arm.doc.ddi0439c/DDI0439C_cortex_m4_r0p1_trm.pdf Your far bigger problem however is accurately modeling the surrounding behaviour of things like the write buffers, caches/ART, branch predictions, prefetch, and interactions with AHB and APB at disparate clocks. Instructions like LDM, STM, MUL and DIV will also impact you, the latter being dependent on the data being processed. Static analysis will give you some useful numbers, but I wouldn't rely on them. A far better strategy would be to benchmark actual code, under realistic conditions, and to use the core cycle counter in the trace unit of most STM32 devices. This would give a much better feel for the internal interactions, and a lot cheaper than having a timing accurate model of the chip.https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/DispForm.aspx?ID=20293&RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Run code in SRAM in ASM
2012-10-12 02:23 AM
RM0008, Rev 14
For information on the ARM Cortex™-M3 core, please refer to the STM32F10xxx Cortex™-M3 programming manual (PM0056).Yes, actually I meant PM0056, it seems to describe all C-M3 instructions well enough but I couldn't find the timing. At first I though such timing is just unavailable for some reason.2012-10-12 03:26 AM
At first I though such timing is just unavailable for some reason.
Yes, and probably because they are mostly single cycle throughput, except when they are not, and complicated by the pipelining, alignment, and factors I've alluded to above. ARM, and Acorn before them, have always had fantastic documentation, ST far less so.