Packages

package fsm

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. All

Type Members

  1. trait EntryPoint extends AnyRef

    This trait indicate the entry point of the state machine.

    This trait indicate the entry point of the state machine.

    See also

    setEntry

    StateEntryPoint

  2. class State extends Area with ScalaLocated

    Represents a state within a state machine.

    Represents a state within a state machine.

    States can define behaviors for entry, exit, and active phases using methods like onEntry, onExit, and whenIsActive.

    Example:
    1. val fsm = new StateMachine {
        val stateA: State = new State with EntryPoint {
          onEntry {
            counter := 0
          }
          whenIsActive {
            counter := counter + 1
            when(counter === 4) {
              goto(stateB)
            }
          }
          onExit {
            io.result := True
          }
        }
        val stateB: State = new State {
          whenIsActive {
            goto(stateA)
          }
        }
      }
  3. class StateBoot extends State
  4. trait StateCompletionTrait extends AnyRef
  5. class StateDelay extends State with StateCompletionTrait

    Allows you to create a state which waits for a fixed number of cycles before executing statements in whenCompleted {...}.

    Allows you to create a state which waits for a fixed number of cycles before executing statements in whenCompleted {...}.

    The preferred way to use it is:

    Examples:
    1. val stateG : State = new StateDelay(cyclesCount=40) {
        whenCompleted {
          goto(stateH)
        }
      }

      It can also be written in one line:

    2. ,
    3. val stateG : State = new StateDelay(40) { whenCompleted(goto(stateH)) }
  6. class StateFsm[T <: StateMachineAccessor] extends State with StateCompletionTrait

    Allows you to describe a state containing a nested state machine.

    Allows you to describe a state containing a nested state machine.

    When the nested state machine is done (exited), statements in whenCompleted { ... } are executed.

    This allows embedding a state machine as a state within another state machine. The embedded state machine starts on entry and completes on exit.

    Example:
    1. // internalFsm is a function defined below
      val stateC = new StateFsm(fsm=internalFsm()) {
        whenCompleted {
          goto(stateD)
        }
      }
      
      def internalFsm() = new StateMachine {
        val counter = Reg(UInt(8 bits)) init(0)
      
        val stateA : State = new State with EntryPoint {
          whenIsActive {
            goto(stateB)
          }
        }
      
        val stateB : State = new State {
          onEntry (counter := 0)
          whenIsActive {
            when(counter === 4) {
              exit()
            }
            counter := counter + 1
          }
        }
      }
  7. class StateMachine extends Area with StateMachineAccessor with ScalaLocated

    Defines a state machine with states and transitions.

    Defines a state machine with states and transitions.

    Example:
    1. val fsm = new StateMachine {
        val idleState: State = StateEntryPoint{
          ...
        }
        val firstState: State = new State {
          whenIsActive {
            goto(idleState)
          }
        }
      }
    See also

    State machine library documentation

  8. trait StateMachineAccessor extends AnyRef
  9. class StateMachineEnum extends SpinalEnum
  10. class StateMachineSharableRegUInt extends AnyRef
  11. class StateMachineSlave extends StateMachine
  12. case class StateMachineTask(priority: Int, body: () ⇒ Unit) extends Product with Serializable
  13. class StateParallelFsm extends State with StateCompletionTrait

    Allows you to handle multiple nested state machines.

    Allows you to handle multiple nested state machines.

    When all nested state machine are done, statements in whenCompleted { ... } are executed.

    Example:
    1. val stateD = new StateParallelFsm (internalFsmA(), internalFsmB()) {
        whenCompleted {
          goto(stateE)
        }
      }

Ungrouped