Sign in

username:

password:



Not a member?

Search adsp



Search tips

Subscribe to adsp



adsp by Keywords

AD1819 | AD7332 | ADSP-2106 | ADSP-21060 | ADSP-21065L | ADSP-2116 | ADSP-21160M | ADSP-2181 | ADSP-218x | ADSP-219 | ADSP-2199 | ADSP219 | BF531 | BF532 | BF533 | BF535 | Blackfin | FFT | JTAG | LDF | SDRAM | SHARC | SPORT | UART | VDSP++ | VisualDSP

Discussion Groups

Discussion Groups | Analog Devices DSPs | 32x32 bit multiplication on TS201

Technical discussions related to Analog Devices DSPs (including Blackfin, TigerSHARC, SHARC and ADSP-21xx DSPs).

  

Post a new Thread

32x32 bit multiplication on TS201 - Giovanni Parodi - Aug 7 10:44:02 2007



Good morning 
I have a problem with multiplication in TS201.
I'm trying to evaluate the following expression

unsigned int a = 0xABABABAB;
unsigned int b = 0xACACACAC;
 
unsigned long long c = a*b;

However c doesn't store the correct result but it stores only the 32 least significant bits of
the 32x32 bit multiplication.
What's wrong?
I obtain the correct result only if I cast a and b to unsigned long long but acting by this way
the compiler emulates 64x64 bit operation slowing down the whole process.
Any hint will be appreciated.
Gio



(You need to be a member of adsp -- send a blank email to adsp-subscribe@yahoogroups.com )

RE: 32x32 bit multiplication on TS201 - George Kadziolka - Aug 7 12:25:32 2007

Hi Gio,

What you want to do is to look up 'intrinsic functions' in the TigerSharc
compiler manual (starts on p1-126).  These functions map directly to the
machine code instruction that does the specific operation you want.  For
instance, here is the intrinsic for returning a 64 bit result from a
multiply of two 32 bit integer numbers and the corresponding assembly
instruction it maps to.

long long int __builtin_mult_i1x32_wide(int Rm, int Rn);

Rsd = Rm * Rn (I);

Hope this helps.

Cheers,

George Kadziolka

Kaztek Systems

www.kaztek.com <http://www.kaztek.com/>

  _____  

From: a...@yahoogroups.com [mailto:a...@yahoogroups.com] On Behalf Of
Giovanni Parodi
Sent: Tuesday, August 07, 2007 6:07 AM
To: a...@yahoogroups.com
Subject: [adsp] 32x32 bit multiplication on TS201

Good morning 
I have a problem with multiplication in TS201.
I'm trying to evaluate the following expression

unsigned int a = 0xABABABAB;
unsigned int b = 0xACACACAC;

unsigned long long c = a*b;

However c doesn't store the correct result but it stores only the 32 least
significant bits of the 32x32 bit multiplication.
What's wrong?
I obtain the correct result only if I cast a and b to unsigned long long but
acting by this way the compiler emulates 64x64 bit operation slowing down
the whole process.
Any hint will be appreciated.
Gio



(You need to be a member of adsp -- send a blank email to adsp-subscribe@yahoogroups.com )

Re: 32x32 bit multiplication on TS201 - "gio...@yahoo.it" - Aug 7 12:28:21 2007

  

Good morning
I have a problem with multiplication in TS201.
I'm trying to evaluate the following expression

unsigned int a = 0xABABABAB;
unsigned int b = 0xACACACAC;

unsigned long long c = a*b;

However c doesn't store the correct result but it stores only the 32 least significant bits of the 32x32 bit multiplication.
What's wrong?
I obtain the correct result only if I cast a and b to unsigned long long but acting by this way the compiler emulates 64x64 bit operation slowing down the whole process.
Any hint will be appreciated.
Gio



(You need to be a member of adsp -- send a blank email to adsp-subscribe@yahoogroups.com )