sequence recognizer

Discussion in 'Homework Help' started by miklee, May 10, 2011.

  1. miklee

    Thread Starter New Member

    Mar 27, 2011
    I done a sequence recognizer for the string 1001 with FF JK

    The equations are:
    J1 = X' Q0
    K1 = X + Q0
    J0 = X + Q1
    K0 = X'
    Z = Q1 Q0 X

    Now I have to simulate it with LTspice, but it doesn't work. The output of the FFs is always 0. Can you help me?
    I simulated the circuit with an other logic simulator and it works, i don't know if I set some wrong value.
    Thank you.
  2. miklee

    Thread Starter New Member

    Mar 27, 2011
    I remake the circuit using D FF (i change cause may the jkff downloaded from LTspice group don't works).

    D1=Q1 Q0' X' + Q1' Q0 X'
    D0=X + Q1 Q0'
    Z=Q1 Q0 X

    I set the source V2 for the sequence 1001 (1st clock high value, 2nd and 3rd low value and 4th clock hight again). But when I start the simulation I have an error: "Analysis: Time step too small; time = 0.00012, timestep = 1.25e-019: trouble with dflop-instence a2"

    Thank you
  3. Georacer


    Nov 25, 2009
    I ran your first circuit by hand and I disagree with something:
    You have the state 00 as the Reset state.
    With a '1' you go to 01 and you start reading the '1001' sequence.
    A '0' drives you to 10.
    Another 0 gets you to 11.
    And then with the final '1' you go to 01, which should be your final state but it has been used before.

    I understand that you tried to build a Mealy machine, but to be honest I don't trust them much in actual fast circuits. I would use a fifth state even though that would add another Flip Flop.

    That said, your JK circuit works in theory as you would like to, but I don't know what problems your software might cause. Maybe you could make the input last a bit longer, in order to avoid gate delays and propagation of them.

    For example, make a clock tick every 1ms and synchronize your input in the same period and make your '1's last at about half a ms.