Hello, We are thinking about switching from 8051 to Cortex M3. At the moment everything is written in assembler. Now I simply would like to know, how many assembler statements a Cortex M3 CPU will take to evaluate a square root from a 48 Bit integer value. Is this (square root of a 48 Bit integer) included in a math library and a nobrainer or is only floating point supported. I am new and just evaluating, what the switch means for us, so I would highly appreciate to get an answer to this question.
Thanks a lot.
Uwe Renschler
I hope that it is also trivial to get the answer to my question: How many assembler statements are executed from a Cortex M3 CPU to figure out the square root of a 48 Bit integer value ?
That depends mostly on what algorithm you intend to use.
This one here is quite interesting:
www.embedded.com/.../9802fe2.htm
However, I don't believe you're going to beat the speed of a table-lookup-plus-interpolation solution, if the slight imprecision of such a solution is acceptable in your application.
The square root calculation will require a number of shifts and additions for each step, and each step will process two input bits, so you'll end up with 24 times a whole bunch of shifts, additions, and one conditional. That may still be faster than 60 statements on an 8051 (especially if it's a 12-clocker), but if you use a lookup-table-based approximation on the ARM, it'll be even faster than the exact calculation.