So a Mod-6 synchronous counter can be designed by using 3 D-flip-flops connecting the output of the previous one to the next and having the complement of the last one as the first ones input. However, we are supposed to include 2 input variables to our counter with some specific behaviors. They are as follows: $$\begin{array} {|r|r|}\hline r_1 & r_2 & Behavior \\ \hline 0 & 0 & Reset \\ \hline 0 & 1 & -1 \\ \hline 1 & 0 & +3 \\ \hline 1 & 1 & -5 \\ \hline \end{array}$$
The state table for the counter:
$$\begin{array} {|r|r|}\hline s & 00 & 01 & 10 & 11 \\ \hline s_0 & s_0 & s_5 & s_3 & s_1 \\ \hline s_1 & s_0 & s_0 & s_4 & s_2 \\ \hline s_2 & s_0 & s_1 & s_5 & s_3 \\ \hline s_3 & s_0 & s_2 & s_0 & s_4 \\ \hline s_4 & s_0 & s_3 & s_1 & s_5 \\ \hline s_5 & s_0 & s_4 & s_2 & s_0 \\ \hline \end{array}$$
I am a bit lost on how to make a counter that count in this specific manner based on input. Like I have the states in a 6-mod counter here:
Now how should I draw this diagram correctly? At every state, input $$(r_1, r_2) = (0, 0)$$ will send the counter back to state $$000$$ Generally at any state there can be 4 inputs that will result in a different state. A normal counter don't really require input and will just count up or maybe down. I'm asking for some tips in how to approach this problem. For context we're only allowed to use NAND-gates, NOT-gates and D flip flops.
UPDATE: Ok so now I drew the state diagram
, did the state transition table
$$\begin{array} {|r|r|}\hline s & 00 & 01 & 10 & 11 \\ \hline s_0 & s_0 & s_5 & s_3 & s_1 \\ \hline s_1 & s_0 & s_0 & s_4 & s_2 \\ \hline s_2 & s_0 & s_1 & s_5 & s_3 \\ \hline s_3 & s_0 & s_2 & s_0 & s_4 \\ \hline s_4 & s_0 & s_3 & s_1 & s_5 \\ \hline s_5 & s_0 & s_4 & s_2 & s_0 \\ \hline \end{array}$$
Then I used a type of reducing algorithm to simplify the state assignment. The algorithm is defined like this:
As an example if we take the pair $$s_0s_2$$ and check for each input which next states should be in the same or a new partition. For in 00, we see that s0 should be in the same partition, which it already is. For 01 we see that s1 and s5 should be in the same partition, since they are not included in the original pair, we create a new partition like so: $$\overline{s_0s_2} ; \overline{s_1s_5}$$ For 10 we see that s3 and s5 should be in the same group, since we already have a partition with s5 we simply add s3 to that group:
$$\overline{s_0s_2} ; \overline{s_1s_5s_3}$$ For 11 we will have that s1 and s3 should be in the same group which they already are. So now we apply the same idea that we did to s0s2 to s1s3s5. We look for each input of this 3-partition where the next states will be. For 00 we get that s0 should be in a partition which we already have, s0s2. But now for 01 we get that s0, s2 and s4 should all be in the partition, and since we have s0s2 we add s4 to that group resulting in:
$$\overline{s_0s_2} ; \overline{s_1s_5s_3} \longrightarrow \overline{s_0s_2s_4} ; \overline{s_1s_3s_5}$$
This 2-part partition can now be coded with 1 bit. Like: $$\overline{s_0s_2s_4}: 0$$ $$\overline{s_1s_3s_5}: 1$$
The problem is basically that when doing this algorithm and coding the different partitions like above and a second 3-part partition like this:
$$\overline{s_0s_3} ; \overline{s_1s_4} ; \overline{s_2s_5}$$
Coded like: $$\overline{s_0s_3}: 00$$ $$\overline{s_1s_4}: 11$$ $$\overline{s_2s_5}: 01$$
This will yield a state assignment table looking like this:
\begin{array} {|r|r|}\hline s & q_1 & q_2 & q_3 & 00 & 01 & 10 & 11 \\ \hline s_0 & 0 & 0 & 0 & 000 & 101 & 100 & 111 \\ \hline s_1 & 1 & 1 & 1 & 000 & 000 & 011 & 001 \\ \hline s_2 & 0 & 0 & 1 & 000 & 111 & 101 & 100 \\ \hline s_3 & 1 & 0 & 0 & 000 & 001 & 000 & 011 \\ \hline s_4 & 0 & 1 & 1 & 000 & 100 & 111 & 100 \\ \hline s_5 & 1 & 0 & 1 & 000 & 011 & 001 & 000 \\ \hline \end{array}
And HERE is where the problem lies. You see the output of the circuit behaves exactly like this table. The issue here is that the state transition is working the way it shall. But the encoding of the partitions does not get the result. The fact that the output is corresponding to the q1, q2, q3 should mean that I should just code it 000, 001, 010 etc and do the Kmaps from there.
Update with solution.
So thanks to James I added a final output logical block. I had this table with the states binary codes and the outputs I wanted them to have:
\begin{array} {|r|r|}\hline q_1,q_2,q_3 & {q_1}^+,{q_2}^+,{q_3}^+ \\ \hline 0,0,0 & 0,0,0 \\ \hline 1,1,1 & 0,0,1 \\ \hline 0,0,1 & 0,1,0 \\ \hline 1,0,0 & 0,1,1 \\ \hline 0,1,1 & 1,0,0 \\ \hline 1,0,1 & 1,0,1 \\ \hline \end{array}
So from this I got these boolean expressions:
$${q_1}^+ = {q_1}^´q_2q_3 \vee q_1{q_2}^´q_3$$ $${q_2}^+ = {q_1}^´{q_2}^´q_3 \vee q_1{q_2}^´{q_3}^´$$ $${q_3}^+ = q_1q_2q_3 \vee q_1{q_2}^´q_3 \vee q_1{q_2}^´{q_3}^´$$
Conneted and tested. Gives the desired behavior for my machine. Question for analysis now is: Is this extra output block more effort than having the states being encoded in their expected output?