your idea for draw logic circuit using D flip-flop not for one flip flop per stateNormally, if you only have four states, you can get by with using only 2 flip-flops. 2^2=4.
With four states, you could arbitrarily number them S0, S1, S2, and S3. Suppose you call the two flip-flops X and Y. Most designers just encode the states into the binary number created by using this convention: n= 2*X + Y, so now you can refer to Sn, so for S3, X=1 and Y=1, for S2, X=1 and Y=0, and so on...
Note that by doing it this way, the state machine begins to look like a simple two-bit binary counter...
If you use one FF per state, with four states, you have created a state machine with 2^4=16 possible states. If only using four of the 16, what happens if the machine accidentally gets into one of the 12 non-used states?
by Aaron Carman
by Robert Keim
by Duane Benson
by Jake Hertz