Design a Moore finite state machine that detects 1 0 1 in consecutive digits in the input stream of 0's and 1's received every clock cycle.
The circuit should output a 1 when it detects 1 0 1 as consecutive digits. Implement the FSM using a combination of sequential and combinatorial logic. Draw the truth table for inputs, outputs, and states. Draw the K-map for everything. Indicate how many flip-flops you are going to use. Draw the final circuit with the flip-flops.
Example:
INPUT: 0 1 0 1 0 1 1 0 1 0 0...
OUTPUT: 0 0 0 1 0 1 0 0 1 0 0...
This is my work so far, describing the state machine:
S_i inp S_{i+1}
000 -> 0 -> 000
000 -> 1 -> 001
001 -> 0 -> 010
001 -> 1 -> 001
010 -> 0 -> 000
010 -> 1 -> 101
101 -> 0 -> 010
101 -> 1 -> 001
Since there are only 4 states involved ("000", "001", "010", and "101"), I represent them with bits A and B:
A | B
-------
s_0 0 | 0 to represent state "000"
s_1 0 | 1 to represent state "001"
s_2 1 | 0 to represent state "010"
s_3 1 | 1 to represent state "101"
I combined this with the previous table to represent the initial states I_A, I_B, with some new input X, and then the destination states D_A and D_B:
I_A I_B | X | D_A D_B
________________________
0 0 | 0 | 0 0
0 0 | 1 | 0 1
0 1 | 0 | 1 0
0 1 | 1 | 0 1
1 0 | 0 | 0 0
1 0 | 1 | 1 1
1 1 | 0 | 1 0
1 1 | 1 | 0 1
I wrote out the K-maps for (I_A, I_B) vs. X for output D_A, as well as (I_A, I_B) vs. X for output D_B, and got this simplification:
D_A = ¬X * I_B + X * I_A * ¬I_B
D_B = X
I'm reasonably sure this is all right so far.
However I am unclear where to go from here. I don't really understand how to model this as an actual circuit using flip-flops. I don't know how to transition the initial states of A and B to their corresponding final states. I don't know how I am supposed to emit a 1 in the event that I end up in the "101" state s_3.
D_A = ¬X * I_B + X * I_A * ¬I_B
D_B = X
I don't really know if this is correct but this is how I tried to model the circuit:
I_B ------o-------------------------o
| |
| v
| AND----->OR--------> D_A
| ^ ^
o---NOT---->A | |
N---->AND-----|--------o
I_A ----------------->D ^ |
| |
X --------o---NOT-------------------o
| |
| |
o------------------o-------------------------> D_B
Where do I go from here?