Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How "fsm" should work #6

Open
tcr opened this issue Nov 27, 2016 · 0 comments
Open

How "fsm" should work #6

tcr opened this issue Nov 27, 2016 · 0 comments

Comments

@tcr
Copy link
Owner

tcr commented Nov 27, 2016

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:

  1. Can we elide my_state in most cases?
  2. Can we reference my_state outside of the fsm? Can we change (or check) its value from other blocks?
  3. Is an explicit my_state <= {value} allowed inside the fsm?
  4. How do you declare the initial state; is it just the first state?
  5. How does scoping of states work inside of fsm?
  6. Can we nest fsms?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant