Signal Edge Tracking Operators
In addition to the operators and indicators from the articles Temporal logic operators and Indicators of changes, on transitions signal edge tracking operators can be specified.
The signal edge tracking operators are the functions rising
, falling
and crossing', which return the boolean value `true
at the moment the signal changes in a certain way. This allows the state machine to accurately determine the moment of switching: not by the current value of the signal, but by its change over time.
What is the signal change and the front
In digital systems, signals are often represented by logical values — logical 0 (false) and logical 1 (true). A change in this case is a transition between these two states.
In continuous systems (for example, with analog signals), the values can be any numeric, and the moment when the signal crosses a certain threshold is considered important — especially the value zero.
Signal changes are called edges. There are two main types:
-
Rising edge — signal transition through
0
from a lower value to a higher value (for example, from-1
to0.5
); -
Falling edge — the transition of the signal through
0
from a higher value to a lower one (for example, from1
to-0.2
).
The logic of operator operation
Each of the operators (rising
, falling
, crossing
) is an expression that returns the value true
only when the signal changes in a certain way. The rest of the time is `false'.
Let’s consider the conditions of operation of each operator.
The rising(x)
operator
The rising(x)
operator returns true' at the moment when the signal `x
crosses zero from bottom to top (ascending).
This happens in two cases:
-
The previous value of
x
was negative, and the current value has become zero or positive.; -
The previous value of
x
was zero, and the current value has become positive.
So, 'rising(x)` is a detector for a transition in the positive direction.
For example, let the variable x
change from -0'.2
→ 0.1
. The rising(x)
operator in this case will return true
, since there was a zero crossing from bottom to top. If 'x` changes from 0.1
to -0.1
, then the * operator will not work*.
Similarly, rising(x - 0.5)
tracks the moment when x
crosses the value 0.5 from bottom to top. For example:
-
'x` was
0.4', became `0'.6
→rising(x - 0.5)
will returntrue
; -
'x` was
0.6
, became0.4
→rising(x - 0.5)
returns `false'.
The falling(x)
operator
The falling(x)
operator returns true
at the moment when the signal x
crosses zero from top to bottom. It is triggered when:
-
The previous positive value of
x
, if the current value is zero or negative; -
The previous zero value of `x', if the current value has become negative.
So, falling(x)
reacts to a transition in a negative direction.
+ Example:
-
'x` was
0.2
, became-0.1
→falling(x)
returnstrue
; -
'x` was
-0.1', became `0.2
→ won’t work.
For falling(x - 0.5)
, it is the same: the operator will be triggered when x
crosses 0.5
from top to bottom. For example:
-
'x` changes from
0.6
to0.4
→ triggered; -
The
x
changes from0.4
to0'.6
→ does not work.
The crossing(x)
operator
The crossing(x)
operator is a universal operator that returns true
at any signal crossing through zero (or another specified threshold), regardless of the direction. It is triggered under one of the following conditions:
-
The previous value was positive, and the current value is zero or negative.;
-
The previous value was zero, and the current value is nonzero.;
-
The previous value was negative, and the current value is zero or positive.
So, the crossing(x)
operator captures any transition through zero — both upward (ascending) and downward (descending). For example:
-
'x` changes from
0.6
to0.4
→crossing(x - 0.5)
will returntrue
; -
The
x
changes from0.4
to0'.6
→ alsotrue
; -
The
x
remains below0.5
or higher than0.5
, does not cross the threshold → `false'.
Special attention should be paid to how equality to zero is handled. Unlike the simple condition `x > 0', these operators do not ignore zero, but consider it as a boundary state that plays an important role in the logic of transitions. For example:
|