Electronic – How to determine what the states should be in this state diagram

state-machines

I'm trying to make a simple state diagram to understand a concept in class. There is one input and one output \$ \left(X \ \text{and}\ Y\ \text{lets say} \right)\$. The output is \$1\$ if an input is false after exactly two true inputs. For example, \$Y=1\$ if the last three inputs were \$110\$. In all other cases, the output should be \$0\$.

I'm having trouble deriving what the states themselves should be (as in, the bubbles in the diagram). Once I figure that out, I can easily apply the input/output conditions. I tried setting the states to represent the current bit (\$1\$ or \$0\$, so two states), but that didn't work.

Best Answer

You didn't specify whether the state machine was of Mealy or Moore type, so I included them both below: state diagrams