-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
Description
The current "sequence" blocks are designed to convert sequential code into a state machine. This makes state machines easy to write, but hard to leverage their full expressive power.
A complementary "fsm" block may make it easy to author states:
fsm my_state {
IDLE => {
led <= 0;
if start_condition {
my_state <= ACTIVE;
}
}
ACTIVE => {
led <= 1;
if some_condition {
my_state <= IDLE; // maybe "next IDLE;" or "fsm <= IDLE;" for anonymous
}
}
}
Some questions:
- Can we elide
my_statein most cases? - Can we reference
my_stateoutside of the fsm? Can we change (or check) its value from other blocks? - Is an explicit
my_state<= {value} allowed inside the fsm? - How do you declare the initial state; is it just the first state?
- How does scoping of states work inside of fsm?
- Can we nest fsms?