[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Export of the integer value in fixedpoint toolbox
From: |
David Bateman |
Subject: |
Re: Export of the integer value in fixedpoint toolbox |
Date: |
Mon, 17 Jul 2006 12:31:14 +0200 |
User-agent: |
Mozilla Thunderbird 1.0.6-7.6.20060mdk (X11/20050322) |
Jan Trmal wrote:
>Hello,
>I'm just wondering, if it is possible somehow gain the acces to the integer
>representation of the fixed point number. It could be used for example during
>the process of calculation of coefficient of some filter or so, for further
>implementation in HW. I would highly appreciate it. Nowadays, I have to
>perform all my calculations using IT++ or using matlab.
>I'm aware, that can be realized just using expresion like a.x * (2^a.dec), but
>I would have to take care about the sign of the variable, so it would be much
>more comfortable to write for example x.i = 7; x = x* y; disp(x.i)
>I could try, if someone guides me, (I guess it could be relatively easy), but
>I'm quite unexperienced in octave-C++ programming.
>Thanks in advance for any comment on this.
>Yenda
>
>
>
Yenda,
The code for this is available to an oct-file in the getnumber method.
However it is not exposed to the script files. Adding appropriate code to
octave_base_fixed<ST>::dotref (const octave_value_list& idx)
to allow access to the integer representation should be all that is
needed. Something like
#define __FIXED_INT_VALUE_STR "i" // added to fixed-def.h
<snip>
else if (nm == __FIXED_INT_VALUE_STR)
retval(0) = octave_value (scalar.getnumber());
and similar code to octave_base_fixed_matrix<MT>::dotref (const
octave_value_list& idx). The GET_FIXED_PROP(getnumber) would also need
to be added to fixedComplex.h, etc. For cleanness the new case should be
treated in the subsasgn functions as well.
I'm sorry I really don't have time to add this feature now, but would
commit a patch if you are willing to work on one and test it.
D.
--
David Bateman address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary