Saturate on Integer Overflow
Model Composer currently 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. This can be enabled 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 information specific to a block.
Saturate on integer overflow simply means that when the input value exceeds the range of values supported by the output, either too great or too small, the value simply sits at the max or min supported value. The value is saturated, and does not change.
Saturate on Fixed-Point Overflow
For fixed-point data types, as supported on the Data Conversion Block (DTC) for example, the overflow modes offer more control than the Saturate on integer overflow option, as shown in the following figure.
A description of the different fixed-point overflow modes is provided below, with a graph to illustrate the condition.
|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.|