Moore “01010” sequence detector

Discussion in 'Homework Help' started by boablahuj, May 25, 2016.

  1. boablahuj

    Thread Starter New Member

    Mar 3, 2016
    14
    0
    My task is to design Moore sequence detector. As my teacher said, my graph is okay.

    skan.png
    I wrote down next states and outputs, then decided which flip-flops I'll use. With Karnaugh tables, I miminalized functions for them. My problem is, it's not working correctly. When I'm simulating it in Xilinx, after my desired sequence "01010" on the input, I don't get logical 1 on the output. My question is: are my K-tables and way of thinking correct? Below my scheme in Xilinx and the outcome:
    scheme.png

    sim.png

    Also, my VHDL code:
     
  2. WBahn

    Moderator

    Mar 31, 2012
    17,737
    4,789
    You state diagram should accept an initial 01010, but it is not correct. For instance, shouldn't it accept 0101010 since it ends with the desired sequence. Will your state diagram accept that?

    To troubleshoot your system, include the internal state with the simulation output so that you can see if it is walking through the state diagram like you expect.

    One recommendation to make your like easier -- label your states starting with S0. This allows you to immediately map the state label to the state encoding. For instance, S5 encodes as 101.

    BTW, Thank you so much for posting your work!
     
  3. boablahuj

    Thread Starter New Member

    Mar 3, 2016
    14
    0
    Next time I'll label states as you said, good idea and it will simplify whole process a bit.
    By saying "internal state" you meant to connect output to every ff output like this?
    scheme1.png

    and the outcome:
    sim1.png
    So it detects "01010101" combination. I forgot to mention, it should be without reset (not sure how it's called in english, I mean it can continue as long as sequence matches).
     
  4. WBahn

    Moderator

    Mar 31, 2012
    17,737
    4,789
    You made some kind of change to the circuit since the youtput result is no longer the same that it was.

    It is detecting 01010, it is NOT detecting 0101010 -- look at youput after that much of the sequence is read. Your machine is resetting to the initial state after recognizing a valid input sequence, so it starts over and asserts HI again after reading the sequence all over again (i.e., [01010]1[01010]). But is SHOULD assert for each of the following:

    [01010]
    01[01010]
    0101[01010]
    010101[01010]
    01010101[01010]

    Keep in mind that the assertion happens while the input symbol following the match is read -- that's a consequence of it being a Moore machine.
     
  5. boablahuj

    Thread Starter New Member

    Mar 3, 2016
    14
    0
    I changed my VHDL code. I was playing with it again and managed to make it work - I shouldn't change data on a positive edge. My final outcome looks like this, maybe someone will find it useful (I know clock is not entirely correct, but it's a matter of few seconds):
    sim2.png

    To change it to accept sequences you've wrote, I would have to change my state diagram, but it's not that hard to correct now.
    Thanks for the help!
     
Loading...