Skip to main content

Sequence detector 1010 using T flip-flops

Short answer

Mealy machine with 2 T flip-flops; states A(00), B(01), C(10), D(11). T1 = Q1Q0X + Q1Q0'X' + Q1'Q0X', T0 = Q0 xor X, Z = Q1Q0X'. Overlapping sequences detected.

Design a sequential machine that has one serial input X and one output Z. The machine is required to give an output Z = 1, when the serial input X contains the message 1010. Use T flip-flop.

The machine has one serial input X and one output Z; Z = 1 when the last four bits received are 1, 0, 1, 0. T flip-flops are used.

A Mealy machine is used (output depends on the present state and the present input), and overlapping sequences are detected. Since the sequence has 4 bits, 4 states are needed, so 2 T flip-flops (Q1Q0Q_1Q_0) are used, clocked on the positive edge. (A Moore machine would need 5 states.)

Step 1: States

Present stateMeaningNext (X=0)Next (X=1)Z (X=0)Z (X=1)
Areset / no useful bitsAB00
B"1" receivedCB00
C"10" receivedAD00
D"101" receivedCB10

Step 2: State diagram

 Main path (label = X/Z):
 A -1/0-> B -0/0-> C -1/0-> D -0/1-> C
 Other transitions:
 A -0/0-> A    B -1/0-> B
 C -0/0-> A    D -1/0-> B

Step 3: State assignment

StateABCD
Q1 Q00 00 11 01 1

Step 4: Excitation table

T excitation: T = 1 when the flip-flop must change, T = 0 when it must hold (T=Q⊕Q+T = Q \oplus Q^+).

Q1 Q0XQ1+ Q0+T1T0Z
0 000 0000
0 010 1010
0 101 0110
0 110 1000
1 000 0100
1 011 1010
1 101 0011
1 110 1100

Step 5: K-maps (rows Q1Q_1, columns Q0XQ_0X)

T1: Q1 / Q0X00011110
00001
11010
T0: Q1 / Q0X00011110
00101
10101
Z: Q1 / Q0X00011110
00000
10001

Step 6: Equations

T1=Q1Q0X+Q1Q0‾X‾+Q1‾Q0X‾T0=Q0X‾+Q0‾XZ=Q1Q0X‾\begin{aligned} &T_1 = Q_1Q_0X + Q_1\overline{Q_0}\overline{X} + \overline{Q_1}Q_0\overline{X} \\ &T_0 = Q_0\overline{X} + \overline{Q_0}X \\ &Z = Q_1Q_0\overline{X} \end{aligned}

Step 7: Logic diagram

   +-----+       +-----+
T0>|T   Q|-Q0 T1>|T   Q|-Q1
   | FF0 |       | FF1 |
   |     |       |     |
   +--^--+       +--^--+
      |             |
CLK---+-------------+
X = serial input, common to the gates
T1 = Q1.Q0.X + Q1.Q0'.X' + Q1'.Q0.X'
T0 = Q0.X' + Q0'.X
Z = Q1.Q0.X'

The gates for each flip-flop input are built from the equations; the output gate gives Z directly (Mealy output).

Check with an input stream

X1010100101
StateABCDCDCABC
Z0001010000

Z = 1 appears exactly on the clock in which the last bit of 1010 arrives; overlapping sequences are also detected.

Note: T0=Q0⊕XT_0 = Q_0 \oplus X, so FF0 needs only one XOR gate.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Digital Logic chapter 9 questions →