ANML Documentation

Counter Element

The counter element is a special type of automaton element used to count and, less commonly, perform control operations and maintain state in automata networks.

The counter element is programmed with a target value and mode of operation that determines the behavior when the count reaches the target. The counter element is comprised of two required attributes, one optional attribute, two outputs, and two input terminals.

Required attributes:

  • ID
  • target

Optional attribute:

  • at_target

Optional outputs:

  • report-on-target
  • activate-on-target

Input terminals:

  • <ID>:cnt
  • <ID>:rst

Counter elements cannot accept symbols from the input source; therefore, in most circumstances, they will work in conjunction with STEs to perform their operation on the same symbol set as the STEs that activate them. The counter element does not function unless it is connected to elements driving input.

Figure 1 shows the syntax of the counter element.

Figure 2 shows a counter element as constructed in the AP Workbench.

Figure 1. Counter Element
Railroad counter

Figure 2. Counter Element (AP Workbench)
Counter workbench

ID Attribute

The ID attribute is a user-defined unique identifier (name) for the counter element. The ID must start with a character, but can then contain other characters, digits, or underscore symbols.

Target Attribute

The target attribute is the target value of the counter. When this value is reached, an activation signal is raised and the designated action (as defined by the at_target attribute) occurs.

The target attribute must consist of digits only and is typically greater than or equal to 1. The maximum counter value is not defined in ANML; however, for practical purposes, the maximum value should be no higher than 248.

Figure 3. Target Attribute
Railroad counter target attribute

At Target Attribute

The at_target attribute configures the mode of operation for a counter when the target value is reached. If not specified, the default mode (pulse) is used.

  • latch: The counter continuously drives its outputs on every subsequent cycle. The counter holds at the target and behaves as if, on each cycle, it has reached the target value. In the AP Workbench, the latch attribute appears to the right of the counter, as shown in the first example in Figure 5.

  • pulse: The counter generates its outputs for a single cycle and then goes dormant until it is reset. Subsequent activations on the cnt input have no effect. If an activation signal is receive on the rst input, the counter is reset to zero and resumes normal operation. In the AP Workbench, the pulse attribute appears to the right of the counter, as shown in the middle example in Figure 5.

  • roll: The counter generates its outputs for a single cycle and then automatically resets to zero to resume normal operation. This mode effectively combines the pulse mode behavior with an automatic internally generated reset. In the AP Workbench, the roll attribute appears to the right of the counter, as shown in the last example in Figure 5.
Figure 4. At Target Attribute
Railroad counter at target attribute

Figure 5. Counter At Target Attribute—Counter Modes (AP Workbench)
Counter modes

Report-on-Target Attribute

The report-on-target attribute causes the counter to generate a report event when the target value is reached.

Because the report-on-target output is a characteristic of the counter, there will only be a single indicator to represent it; therefore, a counter will either have a report-on-target or it will not. This is in contrast to activate-on-target, where a counter can have any number of activate-on-target outputs.

The report-on-target element must precede any activate-on-target elements.

Figure 6. Report-on-Target Attribute
Railroad counter report on match attribute

Activate-on-Target Attribute

The activate-on-target attribute indicates which other automata network entities are activated when the counter reaches its target, creating activation connections (transitions) from this counter to other elements in the automata network.

Figure 7. Activate-on-Target Attribute
Railroad counter activate on target

Count Input Terminal

The count input terminal (<ID>:cnt) is a connection point where other automata network elements can connect activation signals. When one or more activation signals are active, the counter advances by one during that cycle.

If the reset and count input terminals are both driven during the same symbol cycle, the reset function will have priority. The counter will reset, it will not increment.

Reset Input Terminal

The reset input terminal (<ID>:rst) is a connection point where other automata network elements can connect activation signals. When one or more activation signals are active, the counter will reset to zero during that cycle.

If the reset and the count input terminals are both driven during the same cycle, the reset function will have priority. The counter will reset, it will not increment.