The Counter API consists of the CONFIGURE_COUNTER and 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 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. The counters increment every clock or are implicitly reset to zero. For the TIME_COUNTER, the counters are reset to zero whenever they are not enabled, but with the TRANSITION procedure, the counters are implicitly reset when a state machine transition occurs.
In addition, counters configured by CONFIGURE_COUNTER can be chained an arbitrary amount of times. Whereas, the counters are pre-configured as chained counters but are only chained once. The slight overlap in functionality between counters is by design, and the user should utilize the counter API that produces the cleanest code and makes the most sense for the use case.
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) | |
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 ) |