The Problem: Derive the state diagram for a circuit that takes one input, A and gives out one output X, X is to be one, if and only if it detects a sequence "101" in A.

Understanding The problem:

if A=0001011011..

then X=00010010..

Now the first problem is how many states have I got?, for me its two, some of my colleagues argue that they are three. the second question is how many bits do I need for each state, shouldn't they be three? This isn't the whole problem, I should then use flip flops to implement it, but I'm stuck at the state diagram.

  • 3
    \$\begingroup\$ What will be the X if A = 1010101 ? \$\endgroup\$
    – across
    Commented Apr 7, 2020 at 20:19
  • 3
    \$\begingroup\$ You need either three or four states, depending on whether or not overlapping patterns are allowed. In either case, it only requires 2 FFs to represent 3 or 4 states. \$\endgroup\$
    – Dave Tweed
    Commented Apr 7, 2020 at 20:45

1 Answer 1


A1, A2 and A3 are shift register outputs (made of 3 D-flip flop) for simplicity. A is your input sequence at IO1, X is your f(A)=seq.101=A1*!A2*A3. table gives all states at every clock rise signal. Key D closed A=1; open A=0. Clock key space close then open to get rise slope. hope this is useful.

enter image description here

  • \$\begingroup\$ Even though I was more concerned with deriving the state diagram, I find this answer really helpful, thank you. \$\endgroup\$
    – Essam
    Commented Apr 8, 2020 at 5:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.