Data types supported by Model Composer 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, 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 Xilinx 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 that are not supported by default in Simulink. If you
connect blocks from the Model Composer block library, with
fixed
or 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 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 could not cast the signal value from the Xilinx Model Composer fixed data type to a double precision floating point data type.
In cases of mismatched data types, Xilinx 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
Xilinx Model Composer 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.