| Author | beginning argument ( Replies received: 5 ) |
| p.stepke |
Posted 20-11-2008 at 15:16   |

Registered on : 10-24-2009
Messages : 11
OFF-Line
|
Hi
i`m using STM32F103RBT6. I have been reading the datasheet, but I didn`t informations how many cycles the cpu for a instruction needs. Where could I find this kind of information?
|
|
|
Profile
Quote
|
| obtronix |
Posted 20-11-2008 at 15:37   |

Registered on : 10-16-2009
Messages : 85
OFF-Line
|
There is a link in chapter 1 to the Cortex M3 Reference manual, click on that, it's in chapter 18 of that document.
|
|
|
Profile
Quote
|
| STOne-32 |
Posted 20-11-2008 at 16:24   |


Registered on : 05-29-2007
From STMicroelectronics
Messages : 455
OFF-Line
|
|
Profile
www
Quote
|
| picguy |
Posted 21-11-2008 at 09:03   |

Registered on : 02-01-2009
Messages : 41
OFF-Line
|
Many Cortex instructions take one cycle. Even the 32-bit instructions. Coupled with decent prefetch one can count instructions and get a fair estimate of execution time. Get a better estimate by counting one for the instruction plus one for each word accessed in LDM/STM instructions.
Or did you mean sine as the trigonometric sin(x)? I wrote one good to 12 bits using the series expansion through -x^7/7! My core function is good from 0..pi/2 so no sqrt needed. Good to 2pi with simple reflections. After much thinking I could make my function faster by using mov/movt with literal constants rather than ldr Rx,=mathConstant.
If you need to time a function sample SysTick before and after. (Make SysTick use AHB/1.)
|
|
|
Profile
Quote
|
| giles |
Posted 26-11-2008 at 11:48   |

Registered on : 11-26-2009
Messages : 34
OFF-Line
|
if you're talking trig i don't thing the stm32 has one instruction for it so it takes a number of instructions, if you're looking for a more efficient method than the one in your average maths library (math.h) look up or google: CORDIC + trig, and CORDIC + wiki
iirc the CORDIC method was used by HP for their early calculators, and can become quite accurate with a minimal number of itterations, basically using successive approximations using shifts adds and subtracts.
|
|
|
Profile
Quote
|
| greg_stm |
Posted 26-11-2008 at 23:54   |

Registered on : 09-27-2007
From Australia
Messages : 36
ON-Line
|
For a very small number of cycles a lookup table approach can be used - with accuracy good enough for most real world applications. Simple interpolation could be used to increase accuracy further for very fussy applications. With these modern micros there's plenty of room (memory) for nice big and accurate lookup tables.
|
|
|
Profile
Quote
|