# J-K Flip Flop and Toggle

While investigating the design of J-K Flip Flop, I cannot get my head around how toggle work. I know it only toggle as the clock goes from 0 to 1.

Here's my false understanding of how the toggle works.

Assume it's Q = 0, Q' = 1, and J = K = 1. Now the clock goes up, the detectors picks it up, and send an impulse.

The next state is Q = 1, Q' = 1, and that's nowhere near Q = 1, Q' = 0. Worse, as J = K = 1 and clock stays high so no impulse is sent, it actually oscillate between 00 and 11.

What's wrong with my understanding?

I'm simulating the one constructed by 4 NAND, and next state is determined by the following equations:

 Anext = not (Clock and J and Q')
Bnext = not (Clock and K and Q )
Qnext = not (  Q'  and A)
Q'next = not (  Q   and B)


JK latch truth table

J   K   Qnext   Comment

0   0   Q       No change

0   1   0       Reset

1   0   1       Set

1   1   Q       Toggle


The mistake here is that you are treating Q and Q' as two separate variables or states. There is only one bit of storage, represented by Q. When we refer to Q', it is defined as Q' = NOT Q, meaning it is always derived from the value of Q. As soon as Q changes from 0 to 1 in your example, Q' changes from 1 to 0.