Implementation Casts in ESDL

Implementation casts are available in ESDL for modules and classes (except CT blocks).

In the specification of an operation in ESDL, implementation casts must be represented by their names. An addition with implementation casts may appear as follows in a block diagram editor:

The same addition is represented in ESDL as such:

c = cast_3 ( cast_1 (a) + cast_2 (b) );

Here it is important that an implementation cast is written like a method call: it is always placed before the element to which it refers; the element is enclosed in parentheses, like a method argument. If the implementation cast is to be applied to the result of an operation, the entire operation must be enclosed in parentheses.

In the example above, cast_1 refers to variable a, cast_2 to b, and cast_3 to the result of the operation a + b.

If intermediate results of arithmetic operations are to be manipulated using an implementation cast, the corresponding intermediate results have to be enclosed in parentheses.

Thus, in this statement:

x = cast_1 (( cast_2 ( (a + b) * c - d )) / e );

cast_2 refers to the intermediate result of the operation,

(a + b) * c - d

while cast_1 changes the overall result of the operation:

((a + b) * c - d) / e

Note

An implementation cast in ESDL always refers to the value in the code that immediately follows the implementation cast.

It is important to note here that the use of the syntax as described above is limited to implementation casts. The parentheses must contain an existing implementation cast; if you specify a standard type, such as uint8 (a), an error message (MMdl20) is displayed.

When using implementation casts, remember that they are not available for use with logical variables. If an implementation cast is applied to a logical variable, the code generator generates an error message.

See also

Implementation Casts

Implementation Casts in Software Components

Working with Methods and Processes

ESDL Syntax

Variable Names

Data Types

Type Conversion

Primitive Methods