Simple Automata Using the Counter Element
This section provides examples of simple automata networks built with the counter element. For more advanced counter automata network examples, see Counter Automata Networks
Basic Counter Automaton
A simple counter automaton with a target value of 123 and an operation mode of pulse:
<counter id="cnt_to_123" target="123" at-target="pulse"> </counter>
The input terminals (cnt and rst) are represented by the C and R input symbols on the left of the counter. The operation mode (at_target = pulse) is represented by the waveform symbol on the right of the counter.
Reset and Counting Automaton
An automaton that counts only sequences of four consecutive symbols (b) using the reset counter:
<state-transition-element id="a1" symbol-set="b" start="all-input"> <activate-on-match-element="c1"/> </state-transition-element> <state-transition-element id="a2" symbol-set="[^b]" start="all-input"> <activate-on-match-element="r1"/> </state-transition-element> <counter countone="c1" reset="r1" target="3" at_target="latch"> <activate-on-target element="a3"/> </counter> <state-transition-element id="a3" symbol-set="b"> <report-on-match/> </state-transition-element>
In this example, if in the first input cycle a b is seen, STE a1 (which is always active) will drive an activation signal to the counter c1. The counter c1 then advances. In the second input cycle if another b is seen, STE a1 will match again and drive another activation signal to c1, causing c1 to advance a second time. If a third b is seen on the next input cycle, STE a1 will drive another activation signal to the counter c1, which will then advance to its target, driving an activation signal to STE a3. The counter c1 remains at the target level (it does not reset).
The process continues with the fourth and fifth input cycles. STE a1 remains active. If a b is seen on each cycle, STE a1 drives an activation signal to c1, which advances to target and drives an activation signal to STE a3. The c1 count remains at target and does not reset.
On the sixth input cycle, however, if an x is seen, STE a2 activates because it matches the x input symbol. STE a2 then drives an activation signal to r1. The counter c1 resets and STE a3 is deactivated.
STE a2 examines each input symbol and resets the counter if a symbol that is not a b is seen. Reset causes the counter value to be restored to the initial value, restarting the count.