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 | ADSP-218x C programming examples

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

  

Post a new Thread

ADSP-218x C programming examples - Jesper Bennedbæk Kristensen - Mar 21 9:01:00 2002



Hi,

For the first time, I am trying to write C-programs for the ADSP-218x, but
it seems that the C-compiler wants to do all math in integer mode. As result
of any multiplication z = x*y it uses MR0 as result instead of MR1. How do I
get around this? Can I declare a 32-bit variable for the result (MR), or is
it not possible to use fractional math mode with the C-compiler?

Thanks,
Jesper





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

Re: ADSP-218x C programming examples - Hársfalvi Levente - Mar 21 10:32:00 2002

Hi!,

Jesper Bennedbæk Kristensen wrote: > For the first time, I am trying to write C-programs for the ADSP-218x, but
> it seems that the C-compiler wants to do all math in integer mode. As result
> of any multiplication z = x*y it uses MR0 as result instead of MR1. How do I
> get around this? Can I declare a 32-bit variable for the result (MR), or is
> it not possible to use fractional math mode with the C-compiler?

Yes, AFAIK the C environment hides all such DSP relative things from
you, so (among others) you can't use fractional mode in C programs.

It uses either integer or (software emulated) floating point math for
integer and floating point data types, respectively.
L.





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

Re: ADSP-218x C programming examples - Author Unknown - Mar 21 16:59:00 2002

If you are using VisualDSP++ 2.0 for the 218x, you'll see in the file fract.h a
couple of macros to do fractional multiplications.

Using those as a guide you should use those to write your own c-callable
function (in asm) to perform the fractional multiplications.

Unfortunately the macros supplied don't perform well when code optimization is
turned on when you compile.

Hope this helps... Jesper Bennedbæk Kristensen <> on 03/21/2002 01:01:55

To:
cc: (bcc: Chuck Petras/SEL)
Subject: [adsp] ADSP-218x C programming examples



Hi,

For the first time, I am trying to write C-programs for the ADSP-218x, but
it seems that the C-compiler wants to do all math in integer mode. As result
of any multiplication z = x*y it uses MR0 as result instead of MR1. How do I
get around this? Can I declare a 32-bit variable for the result (MR), or is
it not possible to use fractional math mode with the C-compiler?

Thanks,
Jesper
_____________________________________
/groups.php3 This e-mail may contain SEL confidential information. The opinions expressed
are not necessarily those of SEL. Any unauthorized disclosure, distribution or
other use is prohibited. If you received this e-mail in error, please notify
the sender, permanently delete it, and destroy any printout. Thank you.




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