Hi all, i'm programming the DSP56807 and struggle with the common functions. I have followed computation in integer: Int32 counts; Int32 position; UInt16 ratio; position = counts / ratio; These function takes 14 * 106 sec !!! The compiler take the ARTDIVU32UZfunction. Is there no function which runs faster and i get the full 32Bit? When i compare it with a function like UInt16 = UInt32/UInt16. This function take only 3 * 106 sec, but i get only 16Bit out. The computation with float (Int32 = Int32 * float) takes 11 * 106 sec, that's also too long for my application. Has anyone an idea what i can do to get it faster? Regards Stefan 
faster division in DSP56800
Started by ●September 2, 2003
Posted by ●September 2, 2003
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,
Howard

Posted by ●September 2, 2003
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,
Howard

Posted by ●September 2, 2003
Hi all, i'm programming the DSP56807 and struggle with the common functions. I have followed computation in integer: Int32 counts; Int32 position; UInt16 ratio; position = counts / ratio; These function takes 14 * 106 sec !!! The compiler take the ARTDIVU32UZfunction. Is there no function which runs faster and i get the full 32Bit? When i compare it with a function like UInt16 = UInt32/UInt16. This function take only 3 * 106 sec, but i get only 16Bit out. The computation with float (Int32 = Int32 * float) takes 11 * 106 sec, that's also too long for my application. Has anyone an idea what i can do to get it faster? Regards Stefan 