Assert Operation (ESDL Editor)

The Assert operation allows to specify a restricted interval in ESDL:

X.assert(lower, upper)

X is an expression of arithmetic type (i.e., cont, limitInt, wrapInt, sdisc or udisc). The lower and upper bounds of the interval must be integer expressions that are constant at generation time and can be represented in a common integer type. Otherwise, an error (MMdl361) is issued during code generation. It is possible to use the assert operation with only one boundary; in that case, the other boundary is specified as -INF or +INF.

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 operation conveys user-defined interval information to the code generator. 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:

See also Example: Assert Operation.

See also

Example: Assert Operation

Setting the Limitation

Promoting Messages