Model discrete events
events when EventPredicate AssignmentList end end
events begins the events section, which
is terminated by an
end keyword. The
in a component file manages event updates. It is executed throughout
events section can contain only
when clause serves to update the values
of the event variables. The syntax is
when EventPredicate var1 = expr1; var2 = expr2; ... end
EventPredicate is an expression that
defines when an event occurs. It must be an expression of event data
type, as described in Event Data Type and edge Operator.
The variables in the body of the
must be declared as event variables. When the event predicate
returns true, all the variables in the body of the
simultaneously get updated to the new values.
when clause can optionally have one or
when EventPredicate var1 = expr1; var2 = expr2; ... elsewhen EventPredicate var1 = expr3; ... end
else branch in a
The following rules apply:
The order of
whenclauses does not matter.
The order of the variable assignments in the body of a
whenclause does not matter because all updates happen simultaneously.
whenclause cannot update an event variable more than once within the same assignments list.
whenclauses may not update the same event variable. You must use an
elsewhenbranch to do this.
The order of
elsewhenbranches matters. If multiple predicates become true at the same point in time, only the branch with the highest precedence is activated. The precedence of the branches in a
whenclause is determined by their declaration order. That is, the
whenbranch has the highest priority, while the last
elsewhenbranch has the lowest priority.