Data types supported by HLS library blocks include the following:
|Double-precision floating point
|Single-precision floating point
|Half-precision floating point
|Signed 8-bit integer
|Unsigned 8-bit integer
|Signed 16-bit integer
|Unsigned 16-bit integer
|Signed 32-bit integer
|Unsigned 32-bit integer
|Signed and unsigned fixed point
|For this data type, Simulink represents real, nonzero numeric values as TRUE (1)
Important: Data types marked with '*' are specific to Model Composer HLS Library, and are not naturally supported by Simulink. While Simulink does support fixed point data types, you must have the Fixed-Point Designer™ product installed and licensed. In addition, the fixed point data type supported by Vitis Model Composer is not compatible with the fixed point data type supported by Simulink although it uses a similar notation.
Notice in the preceding table there are some data types that are supported by Model Composer HLS Library that are not supported by default in Simulink. If you connect blocks from the HLS library, with
half data types, to
Simulink native blocks, you will see an error when
running simulation in Simulink, or when using the
Update Diagram command, or pressing
RelationalOperator does not accept signals of data type 'x_sfix16'.
'ConstRE_or_IMpartBug/Relational Operator' only accepts numeric and enumerated data types.
This error indicates that Simulink could not cast the signal value from the Model Composer fixed data type to a double precision floating point data type.
In cases of mismatched data types, Model Composer recommends that you use a Data Type Conversion block to specify the behavior of the model, and indicate the conversion of one data type to another. The Data Type Conversion block (DTC) is found in the HLS Library under the Signal Attributes library.
Figure 1. Data Type Conversion Block
The DTC block lets you specify the Output data type, while the input data type is automatically determined by the signal connected to the input port. Using the DTC block, you can convert from single precision floating point to double precision for example, or from double precision to single precision.
Important: You must exercise caution when casting from a higher precision data type to a lower precision data type, as loss of precision can lead to rounding or truncation and loss of data can occur.