Edge-triggered JK flip flop

Discussion in 'Homework Help' started by dudeperfect, Apr 15, 2015.

  1. dudeperfect

    Thread Starter New Member

    Apr 15, 2015
    4
    0
    I have this scheme:
    Be pavadinimo54.png
    And here is my test code:
    Code (Text):
    1. clock_proc : process begin -- sinchrosignal ą valdantis procesas
    2. x1 <= '0';
    3. wait for 8 ns ;
    4. x1 <= '1';
    5. wait for 8 ns ;
    6. end process ;
    7.  
    8. reset_proc : process begin -- nustatymo i 0 signal ą valdantis procesas
    9. reset <= '0';
    10. wait for 2 ns ;
    11. reset <= '1';
    12. wait ;
    13. end process ;                            
    14.  
    15. test_proc : process begin -- trigerio signalus valdantis procesas
    16. x2 <= '0'; x3 <= '0'; x4 <= '1'; -- saugo
    17. wait for 5 ns ;
    18. x2 <= '1'; x3 <= '1'; x4 <= '0'; -- iraso 0
    19. wait for 5 ns ;
    20. x2 <= '0'; x3 <= '0'; x4 <= '1'; -- saugo
    21. wait for 5 ns ;
    22. x2 <= '1'; x3 <= '1'; x4 <= '1'; -- iraso 1
    23. wait for 5 ns ;
    24. x2 <= '0'; x3 <= '0'; x4 <= '1'; -- saugo
    25. wait for 5 ns ;  
    26. end process;
    It should reset Q to 0 at the beginning, then hold, then reset it to 0, then hold, then set it to 1 and then hold. But what I get is this:
    Be pavadinimo.png
    As you can see, at the beginning when Q should be reset to 0, it is set to 1 and then stays at 1 till the end. J and K are okay, so I guess something is wrong with my scheme, but I can't find the issue.

    It would be great if someone could check out it and maybe spot the mistake.
     
  2. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    Have you implemented this layout using a set of Boolean equations? If so, I'd recommend going through each data path and find out if your implementation matches your equations.

    What are x1-x4 supposed to be/do?
     
  3. dudeperfect

    Thread Starter New Member

    Apr 15, 2015
    4
    0
    I used the same boolean equations while doing the static JK trigger, and it works fine. Even master-slave implementation is done great, so I guess equations are OK.
    I add them here, not a lot of computations.
    Be pavadinimo.png

    And x1-x4 are the inputs. I assign values to them in my test code.
     
Loading...