FSM Example - A Simple UP/DOWN/STOP Counter

State Diagram

Next State Table

PS NS if in = STOP NS if in = UP NS if in = DOWN out
1 1 2 4 odd
2 2 3 1 even
3 3 4 2 odd
4 4 1 3 even

Simulator

the machine at state S1.

Click on an input value STOP (1) UP (2) DOWN (3)

and see the result:

inputstateoutput

Continue: select a new input value and simulate (clicking simulate applies the CLOCK signal, unshown).