core: add FSM support (and example)
This commit is contained in:
parent
2ca58e488f
commit
bfd06f819e
|
@ -59,6 +59,19 @@ class LiteScopeSoC(SoCCore):
|
||||||
self.cpu_or_bridge.wishbone
|
self.cpu_or_bridge.wishbone
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# fsm group
|
||||||
|
fsm = FSM(reset_state="STATE1")
|
||||||
|
self.submodules += fsm
|
||||||
|
fsm.act("STATE1",
|
||||||
|
NextState("STATE2")
|
||||||
|
)
|
||||||
|
fsm.act("STATE2",
|
||||||
|
NextState("STATE1")
|
||||||
|
)
|
||||||
|
analyzer_groups[2] = [
|
||||||
|
fsm
|
||||||
|
]
|
||||||
|
|
||||||
# analyzer
|
# analyzer
|
||||||
self.submodules.analyzer = LiteScopeAnalyzer(analyzer_groups, 512)
|
self.submodules.analyzer = LiteScopeAnalyzer(analyzer_groups, 512)
|
||||||
|
|
||||||
|
|
|
@ -274,6 +274,10 @@ class LiteScopeAnalyzer(Module, AutoCSR):
|
||||||
for s in signals:
|
for s in signals:
|
||||||
if isinstance(s, Record):
|
if isinstance(s, Record):
|
||||||
split_signals.extend(s.flatten())
|
split_signals.extend(s.flatten())
|
||||||
|
elif isinstance(s, FSM):
|
||||||
|
s.do_finalize()
|
||||||
|
s.finalized = True
|
||||||
|
split_signals.append(s.state)
|
||||||
else:
|
else:
|
||||||
split_signals.append(s)
|
split_signals.append(s)
|
||||||
new_groups[n] = split_signals
|
new_groups[n] = split_signals
|
||||||
|
|
Loading…
Reference in New Issue