Ring counter

Twisted ring counter as a Minecraft redstone circuit

A ring counter is a type of counter composed of a type of circular shift register. The output of the last shift register is fed to the input of the first register. The hamming distance of an Overbeck counter is 2, the hamming distance of a Johnson counter is 1.

There are two types of ring counters:

Johnson counters are often favoured, not just because they offer twice as many count states from the same number of shift registers, but because they are able to self-initialise from the all-zeros state, without requiring the first count bit to be injected externally at start-up. The Johnson counter generates a Gray code, a code in which adjacent states differ by only one bit.

Four-bit ring counter sequences

Straight ring/Overbeck counter Twisted ring/Johnson counter
StateQ0Q1Q2Q3StateQ0Q1Q2Q3
0 1 0 0 0 0 0 0 0 0
1 0 1 0 0 1 1 0 0 0
2 0 0 1 0 2 1 1 0 0
3 0 0 0 1 3 1 1 1 0
0 1 0 0 0 4 1 1 1 1
1 0 1 0 0 5 0 1 1 1
2 0 0 1 0 6 0 0 1 1
3 0 0 0 1 7 0 0 0 1
0 1 0 0 0 0 0 0 0 0

Johnson counter

A Johnson counter is a ring with an inversion; here is a 4-bit Johnson counter:

[1]

Note the inversion of the Q signal from the last shift register before feeding back to the first D input, making this a Johnson counter.

Applications

Ring counters are used in hardware logic design(e.g. ASIC & FPGA) to create complicated finite state machines. A binary counter will require an adder circuit which is substantially more complex than a ring counter. Additionally, the worst case propagation delay on an adder circuit will be proportional to the number of bits in the code (due to the carry propagation). The propagation delay of a ring counter will be a constant regardless of the number of bits in the code. The complex combinational logic of an adder can create timing errors which may result in erratic hardware performance. Last, ring counters with Hamming distance 2(or more) allow the detection of single bit upsets that can occur in hazardous environments.

The disadvantage of ring counters is that they are lower density codes. A binary counter can represent 2^N states, where N is the number of bits in the code, whereas an Overbeck counter can represent only N states and a Johnson counter can represent only 2N states. This may be an important consideration in hardware implementations where registers are more expensive than combinational logic (e.g. FPGA).

See also

References

External links