Skip to main content

Sequence detector 011 using RS flip-flops

Short answer

Use a Mealy machine with states A(00), B(01), C(10). Z=1 only when 011 completed (C with input 1). S1=Q0 X, R1=Q0', S0=X', R0=X, Z=Q1 X. Two S-R flip-flops.

Design a synchronous sequential machine such that it gives output Z=1 if input contains the sequence of message 011 and it retains in its own state in other condition giving output zero. Use RS-Flip-Flop.

The machine stays in its own state when the input does not advance the sequence (A on 1, B on 0), and gives Z = 0 except when 011 is completed.

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 011 arrives. Flip-flops: S-R.

States (what has been received so far):

  • A: reset, or last bit 1 not part of a sequence (stays in A on 1)
  • B: "0" received (stays in B on further 0s)
  • C: "01" received

State diagram (Mealy)

Arc label = input/output

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

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

State table

Present stateNext, X=0Next, X=1Z (X=0)Z (X=1)
ABA00
BBC00
CBA01

State assignment

A = 00, B = 01, C = 10 (flip-flop outputs Q1Q0Q_1 Q_0). The unused code 11 is taken as don't care (x) in all K-maps. The flip-flops are cleared to 00 at power-on (start state).

Excitation table of S-R flip-flop

QQ+SR
000x
0110
1001
11x0

Transition and excitation table

Q1 Q0XQ1+ Q0+S1R1S0R0Z
0 000 10x100
0 010 00x0x0
0 100 10xx00
0 111 010010
1 000 101100
1 010 0010x1

K-maps and simplified equations

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

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

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

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

Z           X=0  X=1
Q1Q0=00       0    0
Q1Q0=01       0    0
Q1Q0=11       x    x
Q1Q0=10       0    1
S1=Q0XR1=Q0′S0=X′R0=XZ=Q1X\begin{aligned} S_1 &= Q_0 X \\ R_1 &= Q_0' \\ S_0 &= X' \\ R_0 &= X \\ Z &= Q_1 X \end{aligned}

Logic diagram

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

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

  • S1S_1: a 2-input AND for Q0XQ_0 X.
  • R1R_1: direct line Q0′Q_0'.
  • S0S_0: direct line X′X'.
  • R0R_0: direct line XX.
  • ZZ: a 2-input AND for Q1XQ_1 X.

Check: input X = 1011011 gives Z = 0001001; Z = 1 at bits 4 and 7.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Digital Logic chapter 9 questions →