Path: news.mathworks.com!not-for-mail
From: "Antonin Ancelle" <antonin.ancelle@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Signal processing blockset and the IQMath library
Date: Tue, 4 Mar 2008 15:11:23 +0100
Organization: The MathWorks, Inc.
Lines: 69
Message-ID: <fqjlad$pu$1@fred.mathworks.com>
References: <fq6k02$r42$1@fred.mathworks.com> <d7287b5d-f1a3-41ec-a645-3e8d35231b5f@u10g2000prn.googlegroups.com>
NNTP-Posting-Host: fr-ancellea.mathworks.fr
X-Trace: fred.mathworks.com 1204639885 830 172.16.45.248 (4 Mar 2008 14:11:25 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 4 Mar 2008 14:11:25 +0000 (UTC)
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Original
Xref: news.mathworks.com comp.soft-sys.matlab:455253



Hi Kevin,

You can enable TFL (Target Function Library) if you open the configset of 
your model (Ctrl+E) and go to:
Real-Time Workshop -> Interface -> Target Function Library. (requires RTW 
Embedded Coder)
Pick "TI C28x", this should replace most of the basic fixed-point operations 
with IQMath calls, even inside Signal Processing blocks.
TFL was introduced for C2000 in R2007b, more replacement are available in 
the brand new R2008a release available since the 1st of march 2008.

I hope it helps,

Antonin.


"Praetorian" <ashish.sadanandan@gmail.com> wrote in message 
news:d7287b5d-f1a3-41ec-a645-3e8d35231b5f@u10g2000prn.googlegroups.com...
> On Feb 28, 8:29 am, "Kevin " <kedec...@mathworks.com> wrote:
>> Hello everyone,
>>
>> I've been toying with the Target for C2000 toolbox, just to
>> see what can be done with.
>>
>> I'm quite disapointed by the fact that Simulink forces the
>> use of floating point numbers in many blocks.
>> I'm sure there's a way to force Simulink to do everything in
>> fixed point numbers, but I just can't see how.
>>
>> For example, I've created a filter using the signal
>> processing toolbox. The results are stored as fixed point
>> variables, but every multiplication is made using floating
>> point operations.
>> So in the C Code, I get something like
>>
>> tmp = floor(ldexp(DMC_P.b3_Gain *
>> ldexp((real_T)rtb_BodyDelay3, (int16_T)
>>       -16L), (int16_T)16L) + 0.5);
>>     rtb_b3 = (int32_T)(tmp <= 2.147483647E+009 ? tmp >=
>> -2.147483648E+009 ? tmp :
>>                        -2.147483648E+009 : 2.147483647E+009);
>>
>> Which is quite complicated, especially when you know that
>> theIQMathlibrary is way faster.
>>
>> So, can I force Simulink to do fixed point operations?
>> Better yet: is there a way to useIqmathin conjunction with
>> the signal processing toolbox without manually replacing
>> every "Gain" block with by anIqmathequivalent?
>
> Kevin,
> The reason Simulink is generating float math is because you haven't
> set the port data types for the blocks. Also, if you're using ERT you
> should pick the fixed point specific flavor of ert.tlc (the same may
> exist even in case of GRT). I work on a very large scale model
> generating code for the TI 2812 and all of our code is in fixed point,
> including that generated by default Simulink blocks such as the gain
> block. Also, if you have the TI C2000 toolbox there are blocks in
> there that make use of IQ math. And a new feature of R2007b (I haven't
> used it yet) is Target Function Replacement where apparently there is
> an API for specifying hardware specific instructions in place of
> generic math operations. So using that you should be able to have the
> Gain block generate IQ math code instead of Simulink's fixed point
> math multiplication.
>
> HTH,
> Ashish.