Variables | Functions
CONDITIONAL_TRANSITION

Overview

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.

Usage Example

Todo:
Add Example Usage

Example API Call(s):

CONDITIONAL_TRANSITION( 0, input_sig(0) = '1', st_done, next_state_rec, state_reg_rec );

Call Data [ 6 parameters (5 mandatory) ]

Parameters
[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

Command Reference

Voice and Hotkey Commands:

See also
Conditional Transition Commands

Return Data

None

Command Parameter Mapping

Parameters
[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>)"

Command Return Data

None

Voice/HotKey Command Sequence

Voice Command HotKey Sequence
"conditional transition state done" cc2
goto st_done
"when input sig zero equal one" when input_sig(0) 1

Notes and Warnings

Note
1) The boolean expression must not contain 'and' or 'or' expression. If a compound operation is necessary, first create a signal assigment then create a boolean expression using that signal.
2) The CONDITIONAL_TRANSITION procedure call also allows a non-synthesizable trigger_time_option parameter that can be used for simulation purposes. This optional parameter takes a VHDL time type as an input value and specifies the simulation time to trigger a conditional transition and bypass the condition parameter. The use case for this non-synthesizable option occurs frequently when writing a testbench. The optional parameter exists for convenience and by simply removing the optional parameter, the design would become synthesizable once again.
3) If the use of "if-then-else" statements are absolutely necessary, these statements can be placed within a component.
4) In SpeakHDL, the 'when-then-else' signal assignment and the CONDITIONAL_TRANSITION procedure call make up the only 2 ways to infer conditional branching of data flow.
Warning
The optional trigger_time_option parameter is a non-synthesizable construct and should only be used during simulation.

See also
SIGNAL ASSIGNMENTS
TRANSITION
REGISTER_FOR_EVENT
STATE MACHINE CONSTRUCTION

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)