Data Type Conversion
Changing the data type of the signal.
|
|
|
|
|
|
|
Description
The Data Type Conversion block converts the input signal of any data type supported by Engee into the specified data type.
Ports
Input
Port_1 - input signal
scalar
| vector
| matrix
| array
Input signal as a scalar, vector, matrix or array.
The input signal can be any real or complex signal. If the input signal is real, the output signal is real. If the input signal is complex, the output signal is complex. The block converts the input signal to the data type specified in the Output data type parameter.
When converting fixed-point data types, use the Input and output to have equal parameter to specify the Real World Value (RWV)
or Stored Integer (SI)
conversion method.
Data types: Float16
, Float32
, Float64
, Int8
, Int16
, Int32
, Int64
, Int128
, UInt8
, UInt16
, UInt32
, UInt64
, UInt128
, Bool
, Fixed
.
Support for complex numbers: Yes
Output
Port_1 - output signal
scalar
| vector
| matrix
| array
Input signal converted to a given data type with the same dimensions as the input signal.
Data types: Float16
, Float32
, Float64
, Int8
, Int16
, Int32
, Int64
, Int128
, UInt8
, UInt16
, UInt32
, UInt64
, UInt128
, Bool
, Fixed
.
Support for complex numbers: Yes
Parameters
Output data type - output data type
Float16
| Float32
| Float64
| Int8
| Int16
| Int32
| Int64
| Int128
| UInt8
| UInt16
| UInt32
| UInt64
| UInt128
| Bool
| Fixed-point
Specify the type of output data.
The type can be specified directly or expressed as a data type object.
Block parameter |
|
Value |
|
By default |
|
Input and output to have equal - restriction for fixed point data type conversions
Real World Value (RWV) (by default)
| Stored Integer (SI)
Specify what the input and output type should be in the context of fixed-point data representation:
-
Real World Value (RWV)
-to convert a signal from one data type to another in an attempt to preserve the original value of the input signal. The block takes into account the constraints imposed by the scaling of the input and output signals and attempts to generate an output signal equal to the original value. -
Stored Integer (SI)
- change the original value of the input signal by scaling the stored integer value. Within the specified data types, the block tries to save the integer value of the signal during the conversion.
Block Parameter |
|
Value |
|
By default |
|
Integer rounding mode - rounding mode for fixed point operations
Floor (by default)
| Ceiling
| Convergent
| Nearest
| Round
| | Zero
Select the rounding mode for fixed point operations. You can select:
-
Floor
- rounds both positive and negative numbers downwards (towards negative infinity). -
Ceiling
- rounds both positive and negative numbers upwards (towards positive infinity). -
Convergent
- rounds a number to the nearest representable value. If the fractional part of a number ends in 5, the number is rounded to the nearest even integer. -
Nearest
- rounds the number to the nearest representable value. If the fractional part of the number ends in 5, the number is rounded upwards (towards positive infinity). -
Round
- rounds the number to the nearest representable value. If the fractional part of a number ends in 5, positive numbers are rounded upwards (towards positive infinity) and negative numbers are rounded downwards (towards negative infinity).
-
Zero
- rounds the number towards zero.
The block parameters are always rounded to the nearest representable value.
Block parameter |
|
Value |
|
By default |
|
Saturate on integer overflow - saturation to integer on overflow
выключено (by default)
| включено
A checkbox which, when selected, uses saturation arithmetic for integers and fixed-point numbers: when an overflow occurs, the result is automatically replaced by the maximum possible (modulo) value for the data type.
Action | Rationale | Effect on overflow | Example |
---|---|---|---|
The checkbox Saturate on integer overflow is checked (enabled). |
Overflow is possible for your model and you want the generated code to have an explicit overflow protection. |
If an overflow occurs, the result is automatically replaced by the maximum possible (modulo) value for the data type. |
The maximum value that can be represented by the data type Any result of a block operation that exceeds this maximum value results in an 8-bit integer overflow. When checked, the block output is saturated to 127. Similarly, the block output is saturated at a minimum output value of -128. |
The Saturate on integer overflow checkbox is unchecked (disabled). |
You want to optimise the efficiency of your generated code. You want to avoid over-determining how the block handles out-of-range signals. |
Overflows are carried in an appropriate value that can be represented by a data type. |
The maximum value that can be represented by the data type Any result of a block operation that exceeds this maximum value results in an 8-bit integer overflow. If the check box is unchecked, software interprets the value causing the overflow as |
When you select this check box, saturation is applied to all internal operations in the block, not just the input/output data or the result.
Block parameter |
|
Value |
|
By default |
|