# 4-bit Self-correcting Johnson Counter on D flip-flops

I had a task assigned by my teacher to implement self correcting Johnson Counter. The task goes this way:

Design a self-adjusted 4 bit Johnson counter. Counter must be implemented on d flip flops and perform self adjusting only on 1st bit. Design should preferably be made with use of Johnson's code.

Frankly, I have no idea how to tackle this task. I made all but this one, I read the other questions/answers here but I'm still not sure.

Could you please at least give me a hint how to do this task?

• What do you know? Do you what an ideal Johnson counter i? Do you know the difference between legal and illegal states? How would you detect an illegal state? How would you adjust a bit? Jul 16, 2019 at 7:50
• I know that Johnson counter is one of ring counters and 4-bit one basically has 8 legal and 8 illegal states from what I can say. I think I could detect the illegal state through putting out outputs from flip-flops through and gates to see if the combination of outputs is legal or not. I don't know however what to do if I actually find that illegal state, and what 'adjusting only on first bit' means. Jul 16, 2019 at 8:09
• I suspect that only adjusting the first bit means only applying the correction at the first flip-flop, Jul 16, 2019 at 8:33
• @Slajni OK then, edit this information into your question, so that we have some idea of where to pitch the level of the answer, and that we also have some sense that your are doing some thinking for yourself. You might like to draw a schematic for an ideal 4 bit 8 state counter (the pencil/diode/resistor/capacitor button on the edit bar). Think about the word 'adjust', especially in the context of logic, which has only 0 and 1 states. In an ideal counter, you'd normally send a bit unaltered to the next flop. Now 'adjusting' that bit could mean only ??? what ??? Jul 16, 2019 at 9:12
• Right, give me some time, I will try to sketch what I can. Jul 16, 2019 at 9:16

## 1 Answer

A correctly-operating 4-bit Johnson counter loops through 8 legal states. But any collection of four FFs has a total of 24 = 16 possible states. Therefore, there are also 8 "illegal" states.

Since you know the circuit for a Johnson counter, you can draw the complete state transition diagram (or table) for all 16 states. The illegal states will form one or more loops, too. Some of the illegal states can be converted to legal states by flipping only the first bit.

Find them, and implement the logic to do this. Then verify that ALL of the illegal states eventually get to a legal state.