# How to design and implement a sequence detector

I have to implement a Moore machine that has an input L and an output Z.

The input line L provides values of 1 and 0 as input, in a random order.

The output line Z takes the value 1 whenever two values of 0 and two values of 1 have been detected in the input, no matter the order. For example the sequences 0011, 00001001 and 1010 would all set line Z to 1.

I have to use D flip-flops and NAND gates only but am stuck halfway.

So far I have drawn the state diagram and the table below: (CS stands for current state and FS stands for future state).

I know that I must draw 8 Karnaugh maps I think but I am not sure and I have to use 3 or 4 flip flops.

Could you point me in the right direction?

EDIT After some more research I managed to finally draw the Karnaugh maps and extract the functions, and I designed a circuit using LogiSim. I am not sure what I have done wrong and have no idea how to proceed. The circuit is not doing what it's supposed to do. Here is a link to my LogiSim circuit.

• Remember that you can build OR, NOR, NOT, AND, and NAND by combining NANDs. Dec 1, 2014 at 11:10
• Maybe try to design a circuit which will detect and store the first 1 (or 0) bit it sees. Then combine some of those elements to the complete circuit. Dec 1, 2014 at 11:12

Being kind of old myself, I expect you to study like #### too. :D

One question may help clarify the circuit you need : how does it distinguish between 2 successive states that are the same? Or alternatively : Is there a separate clock signal, not mentioned above? If so, the basic pattern of the circuit may become clear.