Reply by Ebersman, Howard September 2, 20032003-09-02
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
 
-----Original Message-----
From: stefan_schaeufele [mailto:s...@bruker-axs.de]
Sent: Tuesday, September 02, 2003 3:11 AM
To: m...@yahoogroups.com
Subject: [motoroladsp] faster division in DSP56800

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 * 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?

Regards
Stefan



_____________________________________
Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:  m...@yahoogroups.com

To Post:  m...@yahoogroups.com

To Leave: m...@yahoogroups.com

Archives: http://www.yahoogroups.com/group/motoroladsp

More Groups: http://www.dsprelated.com/groups.php3


">Yahoo! Terms of Service.


Reply by stefan_schaeufele September 2, 20032003-09-02
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 * 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?

Regards
Stefan