Spaces:
Sleeping

File size: 12,570 Bytes
3d893c2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
<?xml version="1.0" encoding="UTF-8"?>
<!--

 * Xcos

 *

 * Copyright (C) INRIA - METALAU Project <scicos@inria.fr> (HTML version)

 * Copyright (C) DIGITEO - Scilab Consortium (XML Docbook version)

 * Copyright (C) 2011 - Bernard DUJARDIN <bernard.dujardin@contrib.scilab.org>

 *

 * This program is free software; you can redistribute it and/or modify

 * it under the terms of the GNU General Public License as published by

 * the Free Software Foundation; either version 2 of the License, or

 *  (at your option) any later version.

 *

 * This program is distributed in the hope that it will be useful,

 * but WITHOUT ANY WARRANTY; without even the implied warranty of

 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

 * GNU General Public License for more details.

 *

 * You should have received a copy of the GNU General Public License

 * along with this program; if not, write to the Free Software

 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

 *

 * See the file ./license.txt

 -->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"

        xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml"

        xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"

        xmlns:scilab="http://www.scilab.org" xml:id="CONVERT" xml:lang="en_US">
    <refnamediv>
        <refname>CONVERT</refname>
        <refpurpose>Data Type Conversion</refpurpose>
    </refnamediv>
    <refsection>
        <title>Block Screenshot</title>
        <inlinemediaobject>
            <imageobject>
                <imagedata align="center" fileref="../../../../images/palettes/CONVERT.png"/>
            </imageobject>
        </inlinemediaobject>
    </refsection>
    <refsection id="Contents_CONVERT">
        <title>Contents</title>
        <itemizedlist>
            <listitem>
                <xref linkend="Description_CONVERT">Description</xref>
            </listitem>
            <listitem>
                <xref linkend="Data_Type_CONVERT">Data types</xref>
            </listitem>
            <listitem>
                <xref linkend="Dialogbox_CONVERT">Parameters</xref>
            </listitem>
            <listitem>
                <xref linkend="Defaultproperties_CONVERT">Default properties</xref>
            </listitem>
            <listitem>
                <xref linkend="Interfacingfunction_CONVERT">Interfacing function</xref>
            </listitem>
            <listitem>
                <xref linkend="Computationalfunction_CONVERT">Computational function</xref>
            </listitem>
            <listitem>
                <xref linkend="Example_CONVERT">Example</xref>
            </listitem>
            <listitem>
                <xref linkend="Seealso_CONVERT">See also</xref>
            </listitem>
        </itemizedlist>
    </refsection>

    <refsection id="Description_CONVERT">
        <title>Description</title>
        <para>
            This block converts an input signal of real double or integer data type to an integer
            or real double data type. This block is particularly useful to connect a block which
            accepts or produces only integer data type with another block which produces or
            accepts only double data type.
        </para>
        <para>
            It can be also use to get the least significant half of the input by a downgrade
            conversion like int16 to int8. For this use case and if you do not want a type
            conversion, you can also use the <link linkend="EXTRACTBITS">EXTRACTBITS</link> block
            with the <literal>Bits to extract</literal> parameter set to
            <literal>Lower half</literal>.
        </para>
        <para>
            For an upgrade conversion of a signed integer to another signed integer, the sign
            bit is propagated.
        </para>
        <para>
            When the output is an integer and when overflow occurs the block gives three different
            forms of results :
        </para>
        <orderedlist>
            <listitem>
                <para>
                    A normal non saturated result. By example, if type is int8 and the result is 128,
                    the block output value will be -128.
                </para>
            </listitem>
            <listitem>
                <para>
                    A saturated result. For the previous example the block output value will be 127
                </para>
            </listitem>
            <listitem>
                <para>
                    An error message warning the user about the overflow.
                </para>
            </listitem>
        </orderedlist>
        <para>
            The user can select one of these three forms by setting the
            <emphasis role="bold">Do on Overflow</emphasis>
            field to 0, 1 or 2.
        </para>
    </refsection>
    <refsection id="Data_Type_CONVERT">
        <title>Data types</title>
        <para>
            The block supports the following types :
        </para>
        <itemizedlist>
            <listitem>
                <para>
                    Input : Scilab's integer and real double data types
                    (<emphasis role="bold">Input Type</emphasis> parameter).
                </para>
            </listitem>
            <listitem>
                <para>
                    Output : Scilab's integer and real double data types
                    (<emphasis role="bold">Output Type</emphasis> parameter).
                </para>
            </listitem>
        </itemizedlist>
    </refsection>
    <refsection id="Dialogbox_CONVERT">
        <title>Parameters</title>
        <inlinemediaobject>
            <imageobject>
                <imagedata fileref="../../../gui/integer_pal/en_US/CONVERT_gui.png" align="center" style="float:right"/>
                    <!-- align => Javahelp, style => Online -->
            </imageobject>
        </inlinemediaobject>
        <itemizedlist>
            <listitem>
                <para>
                    <emphasis role="bold">Input Type (1: double, 3:int32, 4:int16, 5:int8, ...)</emphasis>
                </para>
                <para>
                    It indicates the input data type that it can be a double or an integer: Between 1 and 8.
                </para>
                <para>Properties : Type 'vec' of size 1.</para>
            </listitem>
            <listitem>
                <para>
                    <emphasis role="bold">Output Type (1: double, 3:int32, 4:int16, 5:int8, ...)</emphasis>
                </para>
                <para>
                    It indicates the output data type that can be a double or an integer: Between 1 and 8.
                </para>
                <para>Properties : Type 'vec' of size 1.</para>
            </listitem>
            <listitem>
                <para>
                    <emphasis role="bold">Do on Overflow (0:Nothing, 1:Saturate, 2:Error)</emphasis>
                </para>
                <para>
                    Between 0 and 2. When there are an overflowing, if parameter is equal to :
                </para>
                <itemizedlist>
                    <listitem>
                        <para>
                            <emphasis role="bold">0</emphasis> : the result is non saturated.
                        </para>
                    </listitem>
                    <listitem>
                        <para>
                            <emphasis role="bold">1</emphasis> : the result is saturated.
                        </para>
                    </listitem>
                    <listitem>
                        <para>
                            <emphasis role="bold">2</emphasis> : the simulation displays en error message.
                        </para>
                    </listitem>
                </itemizedlist>
                <para>Properties : Type 'vec' of size 1.</para>
            </listitem>
        </itemizedlist>
    </refsection>
    <refsection id="Defaultproperties_CONVERT">
        <title>Default properties</title>
        <itemizedlist>
            <listitem>
                <para>
                    <emphasis role="bold">always active:</emphasis> no
                </para>
            </listitem>
            <listitem>
                <para>
                    <emphasis role="bold">direct-feedthrough:</emphasis> yes
                </para>
            </listitem>
            <listitem>
                <para>
                    <emphasis role="bold">zero-crossing:</emphasis> no
                </para>
            </listitem>
            <listitem>
                <para>
                    <emphasis role="bold">mode:</emphasis> no
                </para>
            </listitem>
            <listitem>
                <para>
                    <emphasis role="bold">regular inputs:</emphasis>
                </para>
                <para>
                    <emphasis role="bold">- port 1 : size [-1,-2] / type 1</emphasis>
                </para>
            </listitem>
            <listitem>
                <para>
                    <emphasis role="bold">regular outputs:</emphasis>
                </para>
                <para>
                    <emphasis role="bold">- port 1 : size [-1,-2] / type 3</emphasis>
                </para>
            </listitem>
            <listitem>
                <para>
                    <emphasis role="bold">number/sizes of activation inputs:</emphasis> 0
                </para>
            </listitem>
            <listitem>
                <para>
                    <emphasis role="bold">number/sizes of activation outputs:</emphasis> 0
                </para>
            </listitem>
            <listitem>
                <para>
                    <emphasis role="bold">continuous-time state:</emphasis> no
                </para>
            </listitem>
            <listitem>
                <para>
                    <emphasis role="bold">discrete-time state:</emphasis> no
                </para>
            </listitem>
            <listitem>
                <para>
                    <emphasis role="bold">object discrete-time state:</emphasis> no
                </para>
            </listitem>
            <listitem>
                <para>
                    <emphasis role="bold">name of computational function:</emphasis>
                    <emphasis role="italic">convert</emphasis>
                </para>
            </listitem>
        </itemizedlist>
        <para/>
    </refsection>

    <refsection id="Example_CONVERT">
        <title>Example</title>
        <para>
            This example shows the sign bit's propagation during a conversion from int8 to int16.
        </para>
        <para>
            <link type="scilab" linkend="scilab.xcos/xcos/examples/integer_pal/en_US/CONVERT_en_US.zcos">
                <inlinemediaobject>
                    <imageobject>
                        <imagedata fileref="../../../../examples/integer_pal/en_US/CONVERT_en_US.zcos" align="center"/>
                    </imageobject>
                </inlinemediaobject>
            </link>
        </para>
    </refsection>

    <refsection id="Interfacingfunction_CONVERT">
        <title>Interfacing function</title>
        <itemizedlist>
            <listitem>
                <para>
                    <link type="scilab" linkend="scilab.scinotes/scicos_blocks/macros/IntegerOp/CONVERT.sci">SCI/modules/scicos_blocks/macros/IntegerOp/CONVERT.sci</link>
                </para>
            </listitem>
        </itemizedlist>
    </refsection>
    <refsection id="Computationalfunction_CONVERT">
        <title>Computational function</title>
        <itemizedlist>
            <listitem>
                <para>SCI/modules/scicos_blocks/src/c/convert.c</para>
            </listitem>
        </itemizedlist>
    </refsection>

    <refsection role="see also" xml:id="Seealso_CONVERT">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="EXTRACTBITS">EXTRACTBITS</link>
            </member>
        </simplelist>
    </refsection>
</refentry>