Formulas

ASCET supports transformation formulas to define the implementation for fixed-point arithmetic. The identity formula is present in each project, other formulas have to be defined in the project editor of the associated project.

The following rules apply:

  1. If the variable has the model data type cont and the implementation data type real32 or real64, only the identity formula should be selected because only this formula is supported by the code generation. If you select another formula, a warning message is displayed in the implementation editor:

    Float implementation must have identity formula.

    If you do not change the formula, another warning (WIa62) is issued during code generation; the formula is replaced by the identity. See also example 1.

  2. If the variable has the model data type cont and an integer implementation data type, the identity or a linear formula can be used in all circumstances.

    Non-linear formulas are allowed in Closedcertain cases. Therefore, no error or warning message is displayed in the implementation editor.

    In other cases, an error MMdl623 is issued during code generation.

    See also example 2.

  3. If you edit an element with model data type limitInt, wrapInt, sdisc or udisc, and select another formula than the identity, an error message is displayed in the implementation editor:

    Disc model type must have identity formula.

    You must correct the formula (e.g., with the Auto Correction button in the implementation editor) or cancel the implementation.

    Note

    Models from earlier ASCET versions can be used unchanged. During code generation, however, warnings are generated if they contain formulas for discrete elements.

If you make changes in a formula, or recursively replace a formula in a project implementation, you can have all your implementations updated automatically to match the new value ranges and data types. For information on replacing formulas and updating implementations see Global Changes in Implementations.

See also

Examples: Rules for Formulas

Transformation Formulas

Selecting a Formula

Scalar Types: Limited Integer

Scalar Types: Wrap-Around Integer

Adding a Formula

Global Changes in Implementations

Rescalable Implementations