Engee documentation

Data Type Conversion

Changes the data type of the signal.

blockType: DataTypeConversion

Data Type Conversion

Path in the library:

/Basic/Signal Attributes/Data Type Conversion

Cast To Bool

Path in the library:

/Basic/Signal Attributes/Cast To Bool

Cast To Float64

Path in the library:

/Basic/Signal Attributes/Cast To Float64

Cast To Float32

Path in the library:

/Basic/Signal Attributes/Cast To Float32

Description

The Data Type Conversion block converts an input signal of any data type supported by Engee into the specified data type.

Ports

Input

# IN_1 — input signal
scalar | vector | matrix | array

Details

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 parameter Output data type.

When converting fixed-point data types, use the Input and output to have equal parameters to specify the conversion method. Real World Value (RWV) or Stored Integer (SI).

Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, UInt128, Bool, Fixed

Complex numbers support

Yes

Output

# OUT_1 — output signal
scalar | vector | matrix | array

Details

An 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.

Complex numbers support

Yes

Parameters

Main

# Output data type — output data type
Float64 | Float32 | Float16 | Int8 | UInt8 | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 | Int128 | UInt128 | Bool | Fixed-point

Details

Specify the type of output data.

Values

Float64 | Float32 | Float16 | Int8 | UInt8 | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 | Int128 | UInt128 | Bool | Fixed-point

Default value

Program usage name

OutDataTypeStr

Tunable

No

Evaluatable

No

# Output fixed-point type — fixed-point output data type
Data type

Details

Specify the type of fixed-point output data.

Dependencies

To use this parameter, set the Output data type parameters to Fixed-point.

Default value

fixdt(1, 16, 0)

Program usage name

OutDataTypeStrFixed

Tunable

No

Evaluatable

Yes

# Input and output to have equal — restriction for data type conversion
Real World Value (RWV) | Stored Integer (SI)

Details

Specify what the input and output type should be in the context of a fixed-point data representation:

  • Real World Value (RWV) - convert a signal from one data type to another, attempting 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 tries to generate an output signal equal to the original value.

  • Stored Integer (SI) - change the initial value of the input signal by scaling the stored integer value. Within the specified data types, the block attempts to store the integer value of the signal during conversion.

Values

Real World Value (RWV) | Stored Integer (SI)

Default value

Real World Value (RWV)

Program usage name

ConvertRealWorld

Tunable

No

Evaluatable

No

# Integer rounding mode — rounding mode for fixed-point operations
Ceiling | Convergent | Floor | Nearest | Round | Zero

Details

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 the 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.

  • Convergent - 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.

Values

Ceiling | Convergent | Floor | Nearest | Round | Zero

Default value

Floor

Program usage name

RndMeth

Tunable

No

Evaluatable

No

# Saturate on integer overflow — overflow action method
Logical

Details

When this checkbox is selected, a value that exceeds the type boundaries is reset to the maximum or minimum value that the selected data type can represent. Otherwise, the overflow is carried over.

When this checkbox is selected, saturation is applied to all internal operations in the block, not just the output data or result.

Default value

false (switched off)

Program usage name

SaturateOnIntegerOverflow

Tunable

No

Evaluatable

No

Additional options

C code generation: Yes