Saturate on Integer Overflow
Vitis Model Composer supports overflow detection of integer data values on signals. As previously indicated, the default overflow mechanism is to wrap on overflow. Specific blocks in the standard Simulink library of blocks and in the HLS library have an option to Saturate on integer overflow. You can enable this on the Block Parameters dialog box. This parameter applies only if the output is an integer (int8, int16, int32, uint8, uint16, uint32).
Refer to the Model Composer Block Library for block-specific information.
Saturate on integer overflow means the output stays at the maximum or minimum supported value when the input exceeds the valid range. The value is saturated, and does not change.
Saturate on Fixed-Point Overflow
For fixed-point data types (on the DTC for example), overflow modes offer more control than the Saturate on integer overflow option. See the following figure for reference.
The following table describes the different fixed-point overflow modes. Graphs illustrate the conditions.
| Mode | Description | Image |
|---|---|---|
| Saturation | When the input value overflows the output data type, the output value reaches saturation at the min or max value, and does not change. |
|
| Saturation to Zero | When the input value overflows the output data type, the output value reaches saturation at the min or max value, and returns to zero. |
|
| Symmetrical Saturation | Like Saturation to Zero, except the min and max values are symmetrical, or equal in size though opposite in value. |
|
| Wrap around | When the input value exceeds the output data type, the output value is wrapped from the maximum value to the minimum value, or from the minimum value to the maximum value, thus cycling through the range of permitted values. |
|
| Sign-Magnitude Wrap Around | When the input value exceeds the output data type, the output value reaches the maximum value, and then begins decreasing to return to the minimum value. In an underflow situation, the minimum value is reached, and begins increasing to return to the maximum value. |
|