API Description | Functions
COUNTER API


Overview

The Counter API consists of the CONFIGURE_COUNTER, TIME_COUNTER, RESET_COUNTER procedure calls, and possibly the TRANSITION procedure call depending on the context. The functionality given by the CONFIGURE_COUNTER call is the most flexible when compared to the functionality given by TIME_COUNTER and TRANSITION. However, the use case for each procedure is quite different and mostly has to do with when and how the counters are enabled, and when and how the counter values are reset to zero before rollover.

When using the CONFIGURE_COUNTER API, general purpose counters can hold their count between clock cycles, but must be explicitly reset to zero by using the RESET_COUNTER procedure call. When using TIME_COUNTER and TRANSITION, the delay and divide counters never hold their count between clock cycles. They either are incrementing every clock or are implicitly reset to zero. For the TIME_COUNTER, the delay and divide counter are reset to zero whenever they are not enabled, but with the TRANSITION procedure, the counters are implicitly are reset when a state machine transition occurs.

In addition, counters configured by CONFIGURE_COUNTER can be chained and arbitrary amount of times. Whereas, the delay and divide counter are pre-configured as chained counters but are only chained once. The slight overlap in functionality between counters functionality by design, and the user should utilize the counter API that produces the cleanest code and makes the most sense for the use case.

See also
COMMUNICATIONS API
EDGE DETECTION API
STATE MACHINE API
SHIFT REGISTER API

API Description

 CONFIGURE_COUNTER
 Procedure to count clock cycles, signal edges or transitions. (overloaded)
 
 RESET_COUNTER
 Procedure to reset a general purpose counter back to count zero. (overloaded)
 
 TIME_COUNTER
 Procedure to set hardware timeouts and generate timing patterns (overloaded)
 

Procedures

  CONFIGURE_COUNTER(
counter_index: natural
terminal_count: integer
transition_state: STATE_INTEGER
signal next_state_rec: out NSR
state_reg_rec: in SRR
enable: boolean
)
  CONFIGURE_COUNTER(
counter_index: natural
terminal_count: integer
transition_state: STATE_INTEGER
signal next_state_rec: out NSR_ARRAY
state_reg_rec: in SRR_ARRAY
enable: boolean
)
  CONFIGURE_COUNTER(
counter_index: natural
terminal_count: integer
transition_state: STATE_INTEGER
signal next_state_rec: out NSR
state_reg_rec: in SRR
enable: TRANS_TUPLE
)
  CONFIGURE_COUNTER(
counter_index: natural
terminal_count: integer
transition_state: STATE_INTEGER
signal next_state_rec: out NSR_ARRAY
state_reg_rec: in SRR_ARRAY
enable: TRANS_TUPLE
)
  CONFIGURE_COUNTER(
counter_index: positive
terminal_count: integer
transition_state: STATE_INTEGER
signal next_state_rec: out NSR
state_reg_rec: in SRR
enable: chain_type
)
  CONFIGURE_COUNTER(
counter_index: positive
terminal_count: integer
transition_state: STATE_INTEGER
signal next_state_rec: out NSR_ARRAY
state_reg_rec: in SRR_ARRAY
enable: chain_type
)
  RESET_COUNTER(
counter_index: in ALL_COUNTERS_TYPE
signal next_state_rec: out NSR
state_reg_rec: in SRR
)
  RESET_COUNTER(
counter_index: in ALL_COUNTERS_TYPE
signal next_state_rec: out NSR_ARRAY
state_reg_rec: in SRR_ARRAY
)