Assert Operator – Block Diagram Editor for SWCs
Note |
|---|
Only available in the block diagram editor for software components. |

The Assert operator allows to specify lower and upper bound of an interval. This interval is then used by the code generator as the result interval of the Assert operator; the calculated interval of the operand is overwritten. It is possible to use the Assert operator with only one boundary; in that case, the other boundary is specified as -oo or +oo.
The result type of the assert operator is the same type as the operand, with the interval replaced by the interval specified on the assert operator.
The assert operator conveys user-defined interval information to the code generator. The Assert option in the operator's context menu opens the Assert Attributes dialog window, where you can enter min and max values for the operand interval. The code generator can use this information to generate more efficient code. However, the correctness of the assertion must be reviewed manually; this is supported by the semantic analysis.
In addition, the assert operator is suitable to replace implementation casts with deactivated Limit Assignments option (see also Setting the Limitation).
The following semantic checks are performed:
- If the physical operand interval and the assert interval have no intersection, an error (MIle76) is issued during code generation, because this is most likely a modeling error.
If the physical operand interval and the assert interval overlap, but neither interval is fully contained in the other, an information message (IIle76) is issued during code generation.
This is potentially a modeling error, so you might want to promote the information to a warning.
- If the physical operand interval is contained in the assert interval, an information message (IIle77) is issued during code generation.
If the model contains an implementation cast with deactivated Limit Assignments option, and if the formula of the implementation cast is the same as the formula of the operand, an information message (IIle78) is issued during implementation code generation.
This message informs you that the implementation cast can be replaced by an assert operator, and specifies the required assertion interval.
- If the assert operator is connected with an element that has no implementation (e.g., a literal or a constant), an error (MMdl109) is issued.
See also Example: Assert Operator.
See also
Using the Assert Operator (SWC Editors)
Assert Attributes Dialog Window