Optimization Node

The Optimization node contains the following options:

Optimize Direct Access Methods (Multiple Levels)

Should be activated to have nested direct-access methods resolved in the generated code. Nesting direct-access methods is possible only when specifying components in ESDL. The effect of this option is the same as for the optimization of simple method calls.

Note

The Optimize Direct Access Methods (*) options do not affect CT blocks in the project context. Direct access methods of CT blocks are always optimized.

The Optimize Direct Access Methods (*) options should have the same value. If one is activated and the other is deactivated, a warning (WMdl000) is issued during code generation.

If you deactivate both Optimize Direct Access Methods (*) methods, a warning (WMdl00) is generated because deactivating Optimize Direct Access Methods (*) is deprecated. Both options will be removed in future versions.

Common Subexpression Elimination

If activated, common subexpressions are calculated once, and the results are stored in temporary variables (if possible). With that, code size and runtime are reduced.

Some advantages of common subexpression elimination over temporary variables in block diagrams are:

ClosedEXAMPLE

Code is generated for the following model, with and without activated Common Subexpression Elimination option.

activated

deactivated

real64 _t1real64;

_t1real64 = _contVar + _contPar;    

_out1 = _t1real64;

_out2 = _t1real64;

_out3 = _t1real64;

_out1 = _contVar + _contPar;

_out2 = _contVar + _contPar;

_out3 = _contVar + _contPar;

See the ASCET‑SE User Guide, section "Common Subexpression Elimination", for more detailed information.

Disable BDE Temp Variable Generation

If activated, this option disables temporary variables that have been inserted in block diagrams. Reason: the generation of temporary variables in block diagrams is sometimes unexpected.

Deactivating temporary variables in block diagrams reduces the efficiency of the generated code. To compensate this efficiency loss, use the Common Subexpression Elimination optimization.

To avoid functional changes in the generated code, a warning (WMdl98) is issued if activating Disable BDE Temp Variable Generation leads to a functional change in the generated code. This can happen if block diagram expressions containing side-effects are "secured" by a temporary variable. By default, this warning is promoted to an error.

Note

Temporary variables in block diagrams are deprecated; they will be removed in a future ASCET version.

If deactivated, temporary variables in block diagrams are created as in ASCET V6.3 or earlier, and a warning (WMDL204) is issued:

deprecated feature: BDE temp variables

use <Project Properties/Build/Code Generation/Optimization/Disable BDE Temp Variable Generation> to disable all BDE temp variables

use <Project Properties/Build/Code Generation/Optimization/Common Subexpression Elimination> to get code size and runtime optimizations nevertheless

Dead Code Elimination

This option determines what happens to Boolean conditions that can be determined by looking at the complete method context.

The following selections are available:

On

The Boolean condition is replaced with true or false.

Comment

The Boolean condition is unchanged. A comment is added: /* always true/false */

Off

The Boolean condition is unchanged. Nothing is added.