A state diagram is the picture of a finite state machine.
- Each circle is a state. A moore machine also writes the output inside, for example S1 / 1.
- Each arrow is a state transition, labeled with the input value that makes it happen. A mealy machine labels arrows input/output, for example 1/0.
- An arrow that comes straight back to its own circle is a self loop: "stay here on this input".
- One state is marked as the initial state.
To find the next state, start at the present state, find the arrow leaving it with the input's label, and follow it. Arrows are one-way: an arrow from S0 to S1 says nothing about getting back.
A complete diagram has exactly one arrow out of every state for every input combination. With one input bit that's two arrows per state; with k input bits, 2ᵏ. That's how you know the machine never gets stuck or has to guess.
The same information can be written as a state table, which is easier to turn into equations. The diagram is easier to read and to design with.