class StateMachine extends Area with StateMachineAccessor with ScalaLocated
Defines a state machine with states and transitions.
val fsm = new StateMachine { val idleState: State = StateEntryPoint{ ... } val firstState: State = new State { whenIsActive { goto(idleState) } } }
- See also
- Alphabetic
- By Inheritance
- StateMachine
- StateMachineAccessor
- Area
- OverridedEqualsHashCode
- ValCallbackRec
- ValCallback
- NameableByComponent
- Nameable
- ContextUser
- ScalaLocated
- GlobalDataUser
- OwnableRef
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new StateMachine()
Type Members
-
abstract
type
RefOwnerType
- Definition Classes
- OwnableRef
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
val
_context: Capture
- Definition Classes
- Area
-
def
add(stateMachine: StateMachineAccessor): Unit
- Definition Classes
- StateMachine → StateMachineAccessor
-
def
add(state: State): Int
- Definition Classes
- StateMachine → StateMachineAccessor
- def always(doThat: ⇒ Unit): StateMachine.this.type
- val alwaysTasks: ArrayBuffer[() ⇒ Unit]
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- var autoStart: Boolean
-
def
build(): Unit
- Definition Classes
- StateMachine → StateMachineAccessor
- var builded: Boolean
- val cache: HashMap[Any, Any]
-
def
cacheGet(key: Any): Option[Any]
- Definition Classes
- StateMachine → StateMachineAccessor
-
def
cacheGetOrElseUpdate(key: Any, op: ⇒ Any): Any
- Definition Classes
- StateMachineAccessor
-
def
cachePut(key: Any, value: Any): Unit
- Definition Classes
- StateMachine → StateMachineAccessor
- def checkState(state: State): Unit
-
def
childNamePriority: Byte
- Definition Classes
- Area
- val childStateMachines: LinkedHashSet[StateMachineAccessor]
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @IntrinsicCandidate()
-
def
component: Component
- Definition Classes
- ContextUser
- var corruptedState: Bool
-
def
disableAutoStart(): Unit
- Definition Classes
- StateMachine → StateMachineAccessor
- var entryState: State
- val enumDef: StateMachineEnum
- def enumOf(state: State): SpinalEnumElement[enumDef.type]
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(obj: Any): Boolean
- Definition Classes
- OverridedEqualsHashCode → AnyRef → Any
- def exit(): Unit
-
def
exitFsm(): Unit
- Definition Classes
- StateMachine → StateMachineAccessor
-
def
forceGoto(state: State): Unit
- Definition Classes
- StateMachine → StateMachineAccessor
-
def
foreachReflectableNameables(doThat: (Any) ⇒ Unit): Unit
- Definition Classes
- Nameable
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
-
def
getDisplayName(): String
- Definition Classes
- Nameable
-
def
getEntry(): State
- Definition Classes
- StateMachine → StateMachineAccessor
-
def
getInstanceCounter: Int
- Definition Classes
- ContextUser
-
def
getMode: Byte
- Attributes
- protected
- Definition Classes
- Nameable
-
def
getName(default: String): String
- Definition Classes
- NameableByComponent → Nameable
-
def
getName(): String
- Definition Classes
- NameableByComponent → Nameable
-
def
getPartialName(): String
- Definition Classes
- Nameable
-
def
getPath(from: Component, to: Component): Seq[Component]
- Definition Classes
- NameableByComponent
-
def
getRefOwnersChain(): List[Any]
- Definition Classes
- OwnableRef
-
def
getScalaLocationLong: String
- Definition Classes
- ScalaLocated
-
def
getScalaLocationShort: String
- Definition Classes
- ScalaLocated
-
def
getScalaTrace(): Throwable
- Definition Classes
- ScalaLocated
-
val
globalData: GlobalData
- Definition Classes
- GlobalDataUser
-
def
goto(state: State): Unit
- Definition Classes
- StateMachine → StateMachineAccessor
-
def
hashCode(): Int
- Definition Classes
- OverridedEqualsHashCode → AnyRef → Any
- implicit val implicitFsm: StateMachine
- def inCorruptedState(): Bool
- var inGeneration: Boolean
-
def
isActive(state: State): Bool
Returns True when the state machine is in the given state
Returns True when the state machine is in the given state
- Definition Classes
- StateMachine → StateMachineAccessor
-
def
isCompletelyUnnamed: Boolean
- Definition Classes
- Nameable
-
def
isEntering(state: State): Bool
Returns True when the state machine is entering the given state
Returns True when the state machine is entering the given state
- Definition Classes
- StateMachine → StateMachineAccessor
-
def
isExiting(state: State): Bool
Returns True when the state machine is exiting the given state
Returns True when the state machine is exiting the given state
- Definition Classes
- StateMachine → StateMachineAccessor
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
isNamed: Boolean
- Definition Classes
- Nameable
-
def
isPriorityApplicable(namePriority: Byte): Boolean
- Definition Classes
- Nameable
- def isRunning: Bool
- def isStarted: Bool
-
def
isStateNextBoot(): Bool
- Definition Classes
- StateMachine → StateMachineAccessor
-
def
isStateRegBoot(): Bool
- Definition Classes
- StateMachine → StateMachineAccessor
- def isStopped: Bool
-
def
isUnnamed: Boolean
- Definition Classes
- NameableByComponent → Nameable
- def killFsm(): Unit
-
def
makeInstantEntry(): State
Returns the boot state, active directly after reset.
Returns the boot state, active directly after reset.
This allows to have the state machine directly booting into a user state.
Note that the onEntry of that state will only be called when it transitions from another state to this state and not during boot.
- See also
-
val
name: String
- Definition Classes
- Nameable
- val nameableRef: Nameable
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- def onStart(body: ⇒ Unit): State
-
def
overrideLocalName(name: String): StateMachine.this.type
- Definition Classes
- Nameable
-
val
parentScope: ScopeStatement
- Definition Classes
- ContextUser
- var parentStateMachine: StateMachineAccessor
-
def
postBuild(body: ⇒ Unit): Unit
Allows to do define statement(s) after the elaboration fo the state machine.
Allows to do define statement(s) after the elaboration fo the state machine.
This could be useful if access to
stateRegis needed:// After or inside the fsm's definition. fsm.postBuild { io.status := fsm.stateReg.asBits // io.status is the signal user want to assigned to. }
- See also
Example: - val postBuildTasks: ArrayBuffer[() ⇒ Unit]
-
val
refOwner: RefOwnerType
- Definition Classes
- OwnableRef
- Annotations
- @DontName()
-
def
reflectNames(): Unit
- Definition Classes
- Nameable
-
def
rework[T](body: ⇒ T): T
- Definition Classes
- Area
-
val
scalaTrace: Throwable
- Definition Classes
- ScalaLocated
-
def
setCompositeName(nameable: Nameable, postfix: String, namePriority: Byte): StateMachine.this.type
- Definition Classes
- Nameable
-
def
setCompositeName(nameable: Nameable, postfix: String, weak: Boolean): StateMachine.this.type
- Definition Classes
- Nameable
-
def
setCompositeName(nameable: Nameable, postfix: String): StateMachine.this.type
- Definition Classes
- Nameable
-
def
setCompositeName(nameable: Nameable, namePriority: Byte): StateMachine.this.type
- Definition Classes
- Nameable
-
def
setCompositeName(nameable: Nameable, weak: Boolean): StateMachine.this.type
- Definition Classes
- Nameable
-
def
setCompositeName(nameable: Nameable): StateMachine.this.type
- Definition Classes
- Nameable
-
def
setEncoding(spec: (State, BigInt)*): Unit
Sets a custom encoding for the state machine states.
Sets a custom encoding for the state machine states.
- spec
A mapping of states to their encoded values
val fsm = new StateMachine { val stateA = new State with EntryPoint val stateB = new State ... setEncoding((stateA -> 0x23), (stateB -> 0x22)) }
Example: -
def
setEncoding(encoding: SpinalEnumEncoding): Unit
Sets the encoding for the state machine states.
Sets the encoding for the state machine states.
By default the FSM state vector will be encoded using the native encoding of the language/tools the RTL is generated for (Verilog or VHDL). This default can be overridden by using the setEncoding(...) method which either takes a SpinalEnumEncoding or varargs of type (State, BigInt) for a custom encoding.
-
def
setEntry(state: State): Unit
Defines a State as the entry point.
Defines a State as the entry point.
- Definition Classes
- StateMachine → StateMachineAccessor
- See also
-
def
setLambdaName(isNameBody: ⇒ Boolean)(nameGen: ⇒ String): StateMachine.this.type
- Definition Classes
- Nameable
-
def
setName(name: String, namePriority: Byte): StateMachine.this.type
- Definition Classes
- Nameable
-
def
setName(name: String, weak: Boolean): StateMachine.this.type
- Definition Classes
- Nameable
-
def
setName(name: String): StateMachine.this.type
- Definition Classes
- Nameable
-
def
setNameAsWeak(): StateMachine.this.type
- Definition Classes
- Nameable
-
def
setParentStateMachine(parent: StateMachineAccessor): Unit
- Definition Classes
- StateMachine → StateMachineAccessor
-
def
setPartialName(name: String, namePriority: Byte, owner: Any): StateMachine.this.type
- Definition Classes
- Nameable
-
def
setPartialName(name: String, namePriority: Byte): StateMachine.this.type
- Definition Classes
- Nameable
-
def
setPartialName(name: String, weak: Boolean): StateMachine.this.type
- Definition Classes
- Nameable
-
def
setPartialName(owner: Nameable, name: String, namePriority: Byte): StateMachine.this.type
- Definition Classes
- Nameable
-
def
setPartialName(owner: Nameable, name: String, weak: Boolean): StateMachine.this.type
- Definition Classes
- Nameable
-
def
setPartialName(name: String): StateMachine.this.type
- Definition Classes
- Nameable
-
def
setPartialName(owner: Nameable, name: String): StateMachine.this.type
- Definition Classes
- Nameable
-
def
setPartialName(owner: Nameable): StateMachine.this.type
- Definition Classes
- Nameable
-
def
setRefOwner(that: Any): Unit
- Definition Classes
- OwnableRef
-
def
setScalaLocated(source: ScalaLocated): StateMachine.this.type
- Definition Classes
- ScalaLocated
-
def
setTransitionCondition(condition: Bool): Unit
Set the condition for state transitions.
Set the condition for state transitions.
goto() will only have an effect, if condition is True
-
def
setWeakName(name: String): StateMachine.this.type
- Definition Classes
- Nameable
-
def
startFsm(): Unit
- Definition Classes
- StateMachine → StateMachineAccessor
- var stateBoot: State
- var stateNext: StateMachineEnum.C
- var stateNextCand: StateMachineEnum.C
- var stateReg: StateMachineEnum.C
- val stateToEnumElement: HashMap[State, SpinalEnumElement[enumDef.type]]
- val states: ArrayBuffer[State]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- var transitionCond: Bool
-
def
unsetName(): StateMachine.this.type
- Definition Classes
- Nameable
-
def
valCallback[T](ref: T, name: String): T
- Definition Classes
- ValCallbackRec → ValCallback
-
def
valCallbackOn(ref: Any, name: String, refs: Set[Any]): Unit
- Definition Classes
- ValCallbackRec
-
def
valCallbackRec(obj: Any, name: String): Unit
- Definition Classes
- Area → ValCallbackRec
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
- val wantExit: Bool
- val wantKill: Bool
- val wantStart: Bool
Deprecated Value Members
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated
- Deprecated