Reply by March 21, 20022002-03-21
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 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
_____________________________________
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: Send an email to

To Post: Send an email to

To Leave: Send an email to

Archives: http://groups.yahoo.com/group/adsp

Other Groups: http://www.dsprelated.com/groups.php3 ">http://docs.yahoo.com/info/terms/ 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.


Reply by March 21, 20022002-03-21
Hi!,

Jesper Bennedb 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.



Reply by March 21, 20022002-03-21
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