Sequential logic counters
The "trick" with JK flip-flops

Since we don't have a previous answer about designing state machines with JK flip-flops...

Designing with JK flip-flops is pretty much the same as design with D flip-flops (or T flip-flops or any other kind of flip-flops.)  But with the JK flip-flop the excitation table is such that there is a trick that makes dealing with the state transition logic slightly simpler.

For any state machine/counter design you need the excitation table for your particular flip flop.

For JK flip flops the excitation table looks like

Previous State -&gt; Present State    J K
0 -&gt; 0                             0 X
0 -&gt; 1                             1 X
1 -&gt; 0                             X 1
1 -&gt; 1                             X 0


The special property we are going to leverage is that when the previous state is 0 then the K input is a don't care, and when the previous state is 1 then the J input is always a don't care.

First you have to complete your table.  Not only do you have to have the inputs and the Qs, you also need all the J and K entries:

x|y|Q1|Q2|Q3||Q1+|Q2+|Q3+||J1|K1|J2|K2|J3|K3
--------------------------------------------
0|0|0 |0 |0 || 1 | 1 |0  ||1 |X |...
0|0|0 |0 |1 || 0 | 0 |0  ||0 |X |
0|0|0 |1 |0 || 0 | 0 |1  ||0 |X |
0|0|0 |1 |1 || 0 | 1 |0  ||0 |X |
...


Now we need to draw the 6 K-Maps for J1,K1,J2,K2,J3, and K3.  If we weren't using our "trick" we would need these to be 5-variable maps (x,y,Q1,Q2, and Q3).

But because J1 is don't care whenever Q1 is 1 we only need to do the map for J1 for the case that Q1 is 0.  And of course, in that case we know that Q1 is 0, so we can just do a 4 variable map (with input variables x,y,Q2, and Q3).