Example: Assert Operator

A small block diagram example for the Assert operator has been created:

The explicit interrunnable variable a, variables b and c are implemented as sint8, the implicit interrunnable variable x is implemented as sint16. The assertion interval is set as follows:

In ESDL, the same example looks as follows:

x = (a + b).assert(0, 100) + c;

Code is generated for the ANSI-C target, the Object Based Controller Implementation code generator and an AUTOSAR operating system. The assertion is not visible in the generated code, except for brackets and possibly suppressed optimizations.

The resulting C code reads as follows:

1

FUNC(void, SWC_assert_CODE) C_assert_Impl_runnable (void)

2

{

3

Rte_IrvIWrite_runnable_x((SInt16)Rte_IrvRead_runnable_a() + _b + _c);

4

}

See also

Assert Operator – Block Diagram Editor for SWCs