Data types supported by HLS library blocks include the following:
| Name | Description |
|---|---|
| double | Double-precision floating point |
| single | Single-precision floating point |
| half* | Half-precision floating point |
| int8 | Signed 8-bit integer |
| uint8 | Unsigned 8-bit integer |
| int16 | Signed 16-bit integer |
| uint16 | Unsigned 16-bit integer |
| int32 | Signed 32-bit integer |
| uint32 | Unsigned 32-bit integer |
| fixed* | Signed and unsigned fixed point |
| boolean | 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, Vitis Model Composer
supports a fixed-point data type that uses similar notation but does not work with Simulink’s fixed-point data type..
In the preceding table there are some data types that are supported by Model
Composer HLS Library but are not supported by default in Simulink. If you connect blocks from the HLS library, with
fixed or half data types, to
Simulink native blocks, an error occurs during
simulation in Simulink. You also see errors if you use
the Update Diagram command, or press
Ctrl+D.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 can not cast the signal value from the Model Composer fixed data type to a double precision floating point data type.
For mismatched data types, Model Composer recommends that you use a Data Type Conversion (DTC) block to specify the behavior of the model. Also indicate the conversion of one data type to another. The DTC block is 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 signal connected to the input port automatically
determines the input data type. 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: Exercise caution when casting from a higher precision data type to a lower precision data
type. Loss of precision can lead to rounding or truncation and loss of data can
occur.