General purpose counters are the most widely used hardware resource in the framework module. The CONFIGURE_COUNTER procedure call configures a general purpose counter to either:
General purpose counters are enabled by default (meaning, the optional enable signal is set to '1') and will begin incrementing upon system reset if no optional parameter is given. For any configuration, the counter will count upward until the count value reaches terminal_count - 1, where at that point, state_reg_rec(M).counter(N).done will be asserted logic '1', and the counter will rollover. In addition, if the caller specifies a transition_state other than -1, then the counter will schedule a state machine transition to the specified state one clock cycle after the state_reg_rec(M).counter(N).done signal is asserted.
Because there can be multiple counters on the same resource domain, each individual counter is identified by a counter_index. Counters on the same resource domain can also be chained together with a counter on the previous index by specifying chain for the enable of the counter with the higher index. When counters are configured for chaining, the counter on the lower index (typically counter_index 0) can accept an enable signal of type std_logic or boolean expression, whereas all counters that are chained on higher indexes must specify the value 'chain' for the enable parameter.
Chaining General Purpose Counters
Multiple Clock Domain Counters
CONFIGURE_COUNTER( 0, 128, -1, next_state_rec, state_reg_rec );
CONFIGURE_COUNTER( 0, 128, -1, next_state_rec, state_reg_rec );
CONFIGURE_COUNTER( 0, 10, st_data, next_state_rec, state_reg_rec, (st_init, st_start) );
CONFIGURE_COUNTER( 1, 10, -1, next_state_rec, state_reg_rec, sig_input(1) = '1' );
CONFIGURE_COUNTER( 1, 10, 3, next_state_rec, state_reg_rec, chain );
[in] | counter_index | [1] 0 to NUM_COUNTERS - 1 |
[in] | terminal_count | [2] integer final value (minus one) before rollover occurs |
[in] | transition_state | [3] integer state to transition to when rollover occurs |
[out] | next_state_rec | [4] |
[in] | state_reg_rec | [5] |
[in] | enable* | [6] (optional) input to enable the counter |
[in] | state_reg_rec(M).counter(N).value | [1] [integer] count value returned from framework |
[in] | state_reg_rec(M).counter(N).done | [2] [std_logic] value asserted before rollover (generally a strobe) |
Voice and Hotkey Commands:
[in] | counter_index | [1] "index <integer>" |
[in] | terminal_count | [2] "count <integer>" |
[in] | transition_state | [3] "go to [state] (<state>|<integer>)" |
[in] | enable* | [6] "enable [when] (<std_logic>|<boolean>|<state tuple>|chain)" |
[in] | state_reg_rec(M).counter(N).value | [1] [integer] "count [<array_index>]" |
[in] | state_reg_rec(M).counter(N).done | [2] [std_logic] "count (done|strobe)" |
Types | |
GENERAL_PURPOSE_COUNT_ARRAY | ( 0 to NUM_GENERAL_PURPOSE_COUNTERS- 1 ) COUNT_REC |
array of counters (field of state_reg_rec that needs to be indexed) |
Records | |
COUNT_REC | |
value | natural |
count value returned from the framework by the API Call | |
done | std_logic |
signal indicating terminal_count - 1 (typically a strobe) |
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: std_logic ' 1 ' ) | |
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: std_logic ' 1 ' ) | |
0verloaded for array next_state_rec and state_reg_rec. Optional std_logic, boolean, and state_tuple enable signal. |