|
|
 | | From: | mackie | | Subject: | Arithmetic problem/dsp56k | | Date: | Mon, 24 Jan 2005 00:49:05 +0100 |
|
|
 | Hi there!
I am implementing rls algorithm on Motorola's DSP56k processor. I'm new to that kind of stuff and I can't figure out one thing. What to do with numbers >= 1? What should I do when I need to multiply something by 100 for example and then add it to something else? There's a Motorola's guide about arithmetic and there is an explanation of adding, substracting and so on but there's nothing about mac operations. I would like to use 'mac' instruction but it operates on 24bit source operands not 48 as for real numbers is required. What to do? Should I use scalling or something?
Thanks for answer.
-- mackie
|
|
 | | From: | Tim Wescott | | Subject: | Re: Arithmetic problem/dsp56k | | Date: | Sun, 23 Jan 2005 17:21:57 -0800 |
|
|
 | mackie wrote:
> Hi there! > > I am implementing rls algorithm on Motorola's DSP56k processor. I'm > new to that kind of stuff and I can't figure out one thing. What to do > with numbers >= 1? What should I do when I need to multiply something by > 100 for example and then add it to something else?
Multiply it by 100/128 then shift up by seven. If this is going to happen all the time consider block floating point, where you have a vector of numbers that have all been shifted by the same amount to allow the biggest one to fit. You do your vector multiply, then shift everything the same amount to correct. You have to check precision on your own, of course.
> There's a Motorola's > guide about arithmetic and there is an explanation of adding, > substracting and so on but there's nothing about mac operations. I would > like to use 'mac' instruction but it operates on 24bit source operands > not 48 as for real numbers is required. What to do? Should I use > scalling or something? > > Thanks for answer. > > -- > mackie
Real numbers are 48 bits? I thought real numbers had infinite precision? Do you mean double precision floating point numbers, which have 48-bit mantissas? If so you can do one of two things:
One: You can multiply two 48-bit fixed-precision number into a 96-bit fixed precision number with four 24-bit multiplies. If you're only planning on keeping the upper 48 bits you can get by with three. You can vectorize this to use the MAC instruction efficiently.
Two: You can analyze your problem to see if you really need 48 bits, or if 24 should happen to be enough. If 24 bits is sufficient then you're home free! Sometimes you'll find that you need 48 bits of data but you only need 24 bit coefficients -- then you can get by with just two multiplies per filter tap.
--
Tim Wescott Wescott Design Services http://www.wescottdesign.com
|
|
|