Skip to main content

Sequence detector 1011 using JK flip-flops

Short answer

Use a Mealy machine with states A(00), B(01), C(10), D(11) for no bits, 1, 10, 101. Overlapping allowed. J1=Q0 X', K1=Q0 X+Q0' X', J0=X, K0=X', Z=Q1 Q0 X. Implement with two J-K flip-flops.

Design a sequential machine with one input x and one output z which gives output z=1 when serial input contains 1011 message. Use J-K flip-flop.

A Mealy machine is used (output depends on present state and input), so fewer states are needed. Overlapping sequences are allowed: after a detection the machine keeps the useful tail of the input. One input X and one output Z; Z = 1 in the clock period in which the last bit of 1011 arrives. Flip-flops: J-K.

States (what has been received so far):

  • A: reset / no useful bits
  • B: "1" received
  • C: "10" received
  • D: "101" received

State diagram (Mealy)

Arc label = input/output

 A --1/0--> B --0/0--> C --1/0--> D --1/1--> B

 A --0/0--> A  (self loop)
 B --1/0--> B  (self loop)
 C --0/0--> A
 D --0/0--> C

State table

Present stateNext, X=0Next, X=1Z (X=0)Z (X=1)
AAB00
BCB00
CAD00
DCB01

State assignment

A = 00, B = 01, C = 10, D = 11 (flip-flop outputs Q1Q0Q_1 Q_0).

Excitation table of J-K flip-flop

QQ+JK
000x
011x
10x1
11x0

Transition and excitation table

Q1 Q0XQ1+ Q0+J1K1J0K0Z
0 000 00x0x0
0 010 10x1x0
0 101 01xx10
0 110 10xx00
1 000 0x10x0
1 011 1x01x0
1 101 0x0x10
1 110 1x1x01

K-maps and simplified equations

J1          X=0  X=1
Q1Q0=00       0    0
Q1Q0=01       1    0
Q1Q0=11       x    x
Q1Q0=10       x    x

K1          X=0  X=1
Q1Q0=00       x    x
Q1Q0=01       x    x
Q1Q0=11       0    1
Q1Q0=10       1    0

J0          X=0  X=1
Q1Q0=00       0    1
Q1Q0=01       x    x
Q1Q0=11       x    x
Q1Q0=10       0    1

K0          X=0  X=1
Q1Q0=00       x    x
Q1Q0=01       1    0
Q1Q0=11       1    0
Q1Q0=10       x    x

Z           X=0  X=1
Q1Q0=00       0    0
Q1Q0=01       0    0
Q1Q0=11       0    1
Q1Q0=10       0    0
J1=Q0X′K1=Q0X+Q0′X′J0=XK0=X′Z=Q1Q0X\begin{aligned} J_1 &= Q_0 X' \\ K_1 &= Q_0 X + Q_0' X' \\ J_0 &= X \\ K_0 &= X' \\ Z &= Q_1 Q_0 X \end{aligned}

Logic diagram

           +-------------+     +----------+
 X  ------>| next-state  |---->| FF1, FF0 |--+--> Q1, Q0
    +----->| logic       |     |  (CLK)   |  |
    |      +-------------+     +----------+  |
    +-------------------<--------------------+
    |      +-------------+
    +----->| output      |----> Z
 X  ------>| logic       |
           +-------------+

Gates needed (two J-K flip-flops with a common clock; complements are taken from the Q′Q' outputs or NOT gates):

  • J1J_1: a 2-input AND for Q0X′Q_0 X'.
  • K1K_1: a 2-input AND for Q0XQ_0 X; a 2-input AND for Q0′X′Q_0' X', combined in a 2-input OR gate.
  • J0J_0: direct line XX.
  • K0K_0: direct line X′X'.
  • ZZ: a 3-input AND for Q1Q0XQ_1 Q_0 X.

Check: input X = 1011011 gives Z = 0001001; Z = 1 at bits 4 and 7 (overlapping 1011011). From D, input 0 gives "1010" whose useful tail is "10", so D goes to C.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Digital Logic chapter 9 questions →