The CONDITIONAL_TRANSITION procedure call schedules a state machine transition to occur in response to a signal change. When multiple calls to CONDITIONAL_TRANSITION are made within the same state, each boolean conditional is evaluated based on a priority_index. This priority_index is set by the first parameter of the procedure call. There can be up to five CONDITIONAL_TRANSITION calls made within in each state machine state. The conditional procedure call with the lowest priority_index that evaluates to TRUE indicates which state transition will occur.
For example, consider the following CONDITIONAL_TRANSITION procedure calls and the corresponding state diagram:
The semantics is such that if input_sig = '0' then the state machine will transition to st_start but if srr.shared_register(0) = '1' then the state machine will transition to st_wait. In the rare occurrence that input_sig = '0' occurs in the same clock cycle that srr.shared_register(0) = '1', then the transition will be to st_start. This due to the fact that SpeakHDL designates the conditional transition with the lowest priority_index to take action.
The use case for the CONDITIONAL_TRANSITION procedure calls is to emulate the conditional branching functionality that normally would be coded using if-then-else statements while still staying within the procedural programming paradigm. Inside a process, conditional operations are limited scheduling a state machine transition. This very limited range of operations is by design, and forces all branching operations to be explicitly mapped to a state. Doing so dramatically reduces the amount of debugging time that could result by inferring implicit states using traditional RTL.
CONDITIONAL_TRANSITION( 0, input_sig(0) = '1', st_done, next_state_rec, state_reg_rec );
[in] | priority_index | [1] index indicating priority of boolean expression emulating priority if else (0 highest priority) |
[in] | condition | [2] boolean expression which when evaluates to true, action occurs |
[in] | transition_state | [3] state to transition to |
[out] | next_state_rec | [4] |
[in] | state_reg_rec | [5] |
[in] | trigger_time_option*:[6] | time type (simulation only) simulation time in which to bypass conditional to bypass waiting for condition to become true |
Voice and Hotkey Commands:
None
[in] | priority_index | [1] "index <integer>" |
[in] | condition | [2] "when <boolean expression>" |
[in] | transition_state | [3] "go to [state] (<state>|<integer>)" |
[out] | next_state_rec | [4] |
[in] | state_reg_rec | [5] |
[in] | trigger_time_option* | [6] "(trigger time| timeout) (<timing function>)" |
None
Voice Command | HotKey Sequence |
---|---|
"conditional transition state done" | cc2 |
goto st_done | |
"when input sig zero equal one" | when input_sig(0) 1 |
Types | |
CONDITIONAL_ACTION | ( CONDITIONAL_FIRE_EVENT , ONE_HOT_TRANSITION , ATTACH_EVENT ) |
Procedures | |
CONDITIONAL_TRANSITION( priority_index: in PRIORITY_INTEGER condition: in boolean transition_state: STATE_INTEGER signal next_state_rec: out NSR state_reg_rec: in SRR ) | |
CONDITIONAL_TRANSITION( priority_index: in PRIORITY_INTEGER condition: in boolean transition_state: STATE_INTEGER signal next_state_rec: out NSR_ARRAY state_reg_rec: in SRR_ARRAY ) | |
overloaded for indexed priority (array interface) |