Messages (C Code)
Messages are part of an intra-task (intra-process) communication concept used within ASCET models (see Interprocess Communication). To achieve data consistency, the ASCET code generation has to create additional message copies.
If messages are used within the functional code (read/write access), additional code is required to ensure safe copying of the current values from message originals to the local copies. Within the process body, only these local copies are used. At the end, all local copies which could change their value within the process body must be written back to the message originals.
In ESDL and block diagram components, ASCET generally detects very well, which messages are changed within a process. However, this functionality is of limited availability when using C code for the body specification. Here, the user has to take care of data consistency on his own.
In general, ASCET is not able to detect where and when a variable is written in user-specified C code. ASCET recognizes only a few special cases where, e.g., the variable name is followed by a =, or where assignment operators like ++ are used. If a variable is changed within a macro, an extern function, or via address operators and pointer arithmetic, ASCET does not detect the change.
When messages are used, this behavior results in message copies being created at the beginning of the process, but—under certain circumstances—not written back at the end.
See also
Variables and Function Parameters
Automatically Generated define Statements for Instance Variables