Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!u10g2000prn.googlegroups.com!not-for-mail
From: Praetorian <ashish.sadanandan@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Signal processing blockset and the IQMath library
Date: Fri, 29 Feb 2008 14:06:38 -0800 (PST)
Organization: http://groups.google.com
Lines: 49
Message-ID: <d7287b5d-f1a3-41ec-a645-3e8d35231b5f@u10g2000prn.googlegroups.com>
References: <fq6k02$r42$1@fred.mathworks.com>
NNTP-Posting-Host: 66.37.129.67
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Trace: posting.google.com 1204322798 18778 127.0.0.1 (29 Feb 2008 22:06:38 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 29 Feb 2008 22:06:38 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: u10g2000prn.googlegroups.com; posting-host=66.37.129.67; 
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) 
Xref: news.mathworks.com comp.soft-sys.matlab:454707



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.