i'm programming the DSP56807 and struggle with the common functions.
I have followed computation in integer:
position = counts / ratio;
These function takes 14 * 10-6 sec !!!
The compiler take the ARTDIVU32UZ-function. Is there no function
which runs faster and i get the full 32-Bit?
When i compare it with a function like UInt16 = UInt32/UInt16. This
function take only 3 * 10-6 sec, but i get only 16-Bit out.
The computation with float (Int32 = Int32 * float) takes 11 * 10-6
sec, that's also too long for my application.
Has anyone an idea what i can do to get it faster?
faster division in DSP56800
Built in division (among other) functions are notoriously inefficient in the Motorola C Compiler.
In general, there are a few options:
Best: If the divider is a constant, you can replace it by a multiply with a different constant (1/divider).
Alternate option: Rewrite the function yourself in assembly. It should be possible to implement this operation in approximately 40 processor cycles. (32 cycles for the division shifts, plus setup and saturation/overflow detection)
Another option: If the resulting term is known to be small, fast computation can be achieved with iterative subtraction. Better yet, do this in assembly.
Yet another: If divider is a power of 2, implement as a shift of log2(divider) bits.
In general, there are lots of tricks that can be played if the range of possible values is limited due to the nature of the problem to be solved.
Best of luck,