FiniteStateMachine<StateIdentifier> class
Simple class for FSM FiniteStateMachine.
Abstraction for representing Finite state machines (FSM). Contains the logic for performing the state transitions.
Constructors
-
FiniteStateMachine(Logic clk, Logic reset, StateIdentifier resetState, List<
State< states, {bool asyncReset = false, List<StateIdentifier> >Conditional> setupActions = const []}) -
Creates an finite state machine for the specified list of
_states, with an initial state ofresetState(when synchronousresetis high) and transitions on positiveclkedges. -
FiniteStateMachine.multi(List<
Logic> _clks, Logic reset, StateIdentifier resetState, List<State< _states, {bool asyncReset = false, List<StateIdentifier> >Conditional> setupActions = const []}) -
Creates an finite state machine for the specified list of
_states, with an initial state ofresetState(whenresetis high) and transitions on positive edges of any of_clks.
Properties
- asyncReset → bool
-
If
true, the reset signal is asynchronous.final - clk → Logic
-
The clock signal to the FSM (when only single-triggered). Otherwise, the
first clock.
no setter
- currentState → Logic
-
The current state of the FSM.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- nextState → Logic
-
The next state of the FSM.
final
- reset → Logic
-
The reset signal to the FSM.
final
- resetState → StateIdentifier
-
The reset state of the FSM to default to when the reset signal is high.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
setupActions
→ List<
Conditional> -
A List of Conditional actions to perform at the beginning of the
evaluation of actions for the FiniteStateMachine. This is useful for
things like setting up default values for signals across all states.
final
-
stateIndexLookup
→ Map<
StateIdentifier, int> -
A Map from the
StateIdentifiers to the internal index used to represent that state in the state machine.latefinal -
states
→ List<
State< StateIdentifier> > -
List of all the States in this machine.
no setter
- stateWidth → int
-
Width of the state.
final
Methods
-
generateDiagram(
{String outputPath = 'diagram_fsm.md'}) → void -
Generate a FSM state diagram
_MermaidStateDiagram. Check on https://mermaid.js.org/intro/ to view the diagram generated. If you are using vscode, you can download the mermaid extension. -
getStateIndex(
StateIdentifier id) → int? -
Provides the corresponding index held in state signals such as
nextState and currentState based on the provided
id. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited