examples: add an FSM usage example (UART receiver).
This commit is contained in:
parent
72039b6072
commit
597d778cf6
2 changed files with 61 additions and 1 deletions
|
|
@ -299,7 +299,7 @@ class Module(_ModuleBuilderRoot):
|
|||
fsm_signal.nbits = bits_for(len(fsm_encoding) - 1)
|
||||
# The FSM is encoded such that the state with encoding 0 is always the reset state.
|
||||
fsm_decoding = {n: s for s, n in fsm_encoding.items()}
|
||||
fsm_signal.decoder = lambda v: "{}/{}".format(fsm_decoding[n], n)
|
||||
fsm_signal.decoder = lambda n: "{}/{}".format(fsm_decoding[n], n)
|
||||
self._statements.append(Switch(fsm_signal,
|
||||
OrderedDict((fsm_encoding[name], stmts) for name, stmts in fsm_states.items())))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue