>Mark Utter wrote:
>> Hello all,
>>
>> I am looking for an unsigned long division C or C55x assembly function
>> (i.e., a 32 bit dividend and a 32-bit divisor, yielding a 32-bit
quotient)
>> for a TI C5500 DSP.
>>
>>
>> I would like to get a quotient data format of 16.16 (16 bits integer,
16
>> bits fractional) from a 32 bit dividend (uint) and 32-bit divisor
(uint).
>
>That can't always be done. Dividing MAXINT by 1 is an example that must
>fail.
>
>Jerry
>--
>Engineering is the art of making what you want from things you can get.
>�����������������������������������������������������������������������
>
I might be wrong here:
I think it is similar to a div_s (Word16 div_s(Word16 var1, Word16
var2))commonly seen in ITU-T codecs, which are written in C, except there
in those cases it is all 16 bit algorithm.Be cautioned that these routines
expect both the input parameters to be +ve and parameter2 must be greater
than parameter1. A good place to start the modification would be,if I
remember correctly,a loop there which runs 16 times,it seems to me that
you should make that 32 times and take it from there(Iam sure you would
have some more work to do)
Does C55x have a "subtraction with carry" kind of instruction available?
If it is there,I would imagine that it can make your life a lot better.
Also have you checked out this IEEE paper?
Stuart F. Oberman, and Michael J. Flynn, �Division
Algorithms and Implementations ,� IEEE Transactions on
Computers, vol. 46, no. 8, August 1997.
--Bhooshan
This message was sent using the Comp.DSP web interface on
www.DSPRelated.com
Reply by Jerry Avins●August 9, 20052005-08-09
Mark Utter wrote:
> Hello all,
>
> I am looking for an unsigned long division C or C55x assembly function
> (i.e., a 32 bit dividend and a 32-bit divisor, yielding a 32-bit quotient)
> for a TI C5500 DSP.
>
>
> I would like to get a quotient data format of 16.16 (16 bits integer, 16
> bits fractional) from a 32 bit dividend (uint) and 32-bit divisor (uint).
That can't always be done. Dividing MAXINT by 1 is an example that must
fail.
Jerry
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������
Reply by Tim Wescott●August 9, 20052005-08-09
Mark Utter wrote:
> Hello all,
>
> I am looking for an unsigned long division C or C55x assembly function
> (i.e., a 32 bit dividend and a 32-bit divisor, yielding a 32-bit quotient)
> for a TI C5500 DSP.
>
>
> I would like to get a quotient data format of 16.16 (16 bits integer, 16
> bits fractional) from a 32 bit dividend (uint) and 32-bit divisor (uint).
>
> Does anyone have a function that does this or something similar?
>
> Thanks,
>
> Mark
>
>
Is the C55x divide primitive for 16 bit data or 32?
TI's programmers manual for the C28xx shows how to use the divide
primitive for this sort of stuff right on the page where it describes
the divide primitive instruction -- have you checked the same page for
the C55x? Shifting the radix point on the answer is pretty easy stuff
for this sort of operation.
If the C55x only has a 16-bit divide primitive then you may be out of
luck. I don't know if there is an effective way of using a 16 bit
divide primitive to yield a bit-accurate 32-bit divide. I've dinked
around with figuring it out on my own, but I've never needed to do it
badly enough to ask.
--
Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Reply by Mark Utter●August 9, 20052005-08-09
Hello all,
I am looking for an unsigned long division C or C55x assembly function
(i.e., a 32 bit dividend and a 32-bit divisor, yielding a 32-bit quotient)
for a TI C5500 DSP.
I would like to get a quotient data format of 16.16 (16 bits integer, 16
bits fractional) from a 32 bit dividend (uint) and 32-bit divisor (uint).
Does anyone have a function that does this or something similar?
Thanks,
Mark