[[amaranth - python hardware description language|amaranth]]
reference: https://cfu-playground.readthedocs.io/en/latest/crash-course/gateware.html#edge-detection
Defining an FSM:
```python
def elaborate(self.platform):
m = Module()
with m.FSM() as fsm:
with m.State("A"):
pass
with m.State("B"):
pass
```
==The default/starting state is the first one.==. If you want to change that, you can call `m.FSM(reset="B")`