
Counting in Gray - Part III - Putting Everything Together
May 14, 2007In the last post we built the basis for our Gray counter implementation. In this post we will combine all observations and create a “Gray bit cell” which could be instantiated as many times as one wishes to create Gray counters which count up or down and are of any desired length.
As mentioned before, the basic idea is to build a “Gray bit cell”. Naturally it has a single bit output, but the cell also has to get the information from all previous cells whether or not a pattern was identified and whether it has to toggle or not.
The latter point reminds us that we will have to use T-Flops for the implementation, since the patterns we observed in the previous post only concern when a certain Gray bit toggles and not its absolute value. The most basic implementation of a T-Flop is presented on the figure on the right.
The abstract view of the Gray cell is presented to the left. Both the clock and reset inputs have been omitted. The cell inputs and outputs are:
Two implementations of the Gray cell are depicted below, the left one being more intuitive than the right, but the right one is more compact. Both implementations are logically identical.
![]()
![]()
All that is left now is to see how to connect the Gray cells in series to produce a Gray up/down counter.
In the final picture the Gray cells were connected to form a Gray counter. Notice that some cells are connected in a special way:
A few more words on the parity bit. In the given implementation it is generated by a normal D-Flop with its Qbar output connected to its D input. The same functionality can be achieved without this extra D-Flop, by using an Xor tree on the outputs of the Gray counter - remember our first observation from the previous post? the parity changes with each count.
That concludes this series of posts on Gray counters, but don’t worry I promise there will be more interesting stuff coming on Gray codes.