Initialization of Explicit References

Explicit references must be initialized before they are used.

Reference Type

must be initialized with

array

array of identical or larger size (a warning is issued in the latter case)

matrix

matrix of identical x size and y size

normal or fixed
characteristic line/map

normal or fixed characteristic line/map of kind "variable" and identical

  • dimension (you cannot map a characteristic line to a map or vice versa)
  • type (you cannot map, e.g., a normal characteristic line to a fixed characteristic line)
  • x max size and – for maps – y max size
  • implementation (for implementation experiments)
  • interpolation routine (for ASCET‑SE targets)

normal class
(block diagram, ESDL, C code)

another instance of the same class using the same implementation

state machine

another instance of the same state machine using the same implementation

Boolean table

another instance of the same Boolean table using the same implementation

conditional table

another instance of the same conditional table using the same implementation

record

another instance of the same record using the same implementation

To ensure reference initialization, ASCET requires, by default, that the element specified as Reference must be mapped to an element that is not a reference itself. The mapped element must be an element in the same component, and its type must match the reference (see the table above). The scope of the mapped element depends on the scope of the reference:

Note

Explicit references must not be mapped to arrays, matrices or records used as messages. If they are, an error (MMdl3024) is issued during code generation:

Cannot use the address of a message object <name>.

The mapping is stored with the currently active data set of the component.

In ASCET versions prior to V6.2, the mapping was the only possibility to initialize explicit references. However, to allow customer tool chains to generate data structures and initial values, ASCET V6.2 or higher offers the possibility to generate code for unmapped explicit references. By default, this possibility is deactivated; it can be activated in the context of a project, via the Allow References without Init Valuecode generation option.

Note

If the Allow References without Init Value option is activated, the user is the sole responsible for initialization of references.

If code is generated while Allow References without Init Value is deactivated, an error is issued when an uninitialized reference is found:

GLm3 – Reference init value undefined or not available. Please specify an internal init value for <reference name>.

If code is generated while Allow References without Init Value is activated, a warning is issued if an uninitialized reference is found:

WMdl822 – read access to reference without init value "<reference name>" possibly prior to initialization of reference

By default, this warning is promoted to an error.

In addition, the global analysis, i.e. the analysis of the entire project context, issues an error for an uninitialized reference that is read:

MMdl83 – read access to a definitely uninitialized reference "<reference name>"

Note

The absence of the error does not prove that the reference is always initialized before use. The Closedfollowing list contains three examples for uninitialized references that remain undiscovered.

See also Using References Without Initialization.

See also

Explicit References

Mapping a Reference

Using References Without Initialization

The Scope of Elements

Project Editor – Code Generation Options

Specifying a Reference

Component Manager – Promoting Information and Warnings