Counter with clear

A counter with clear is a sequential circuit with 1 input and n outputs. It differs from an ordinary counter in that it has an input that sets the contents of the counter to 0.

Here is a state table for a 4-bit counter:

  cl o3 o2 o1 o0 | o3' o2' o1' o0'
  --------------------------------
   0  0  0  0  0 |  0   0   0   1
   0  0  0  0  1 |  0   0   1   0
   0  0  0  1  0 |  0   0   1   1
   0  0  0  1  1 |  0   1   0   0
   0  0  1  0  0 |  0   1   0   1
   0  0  1  0  1 |  0   1   1   0
   0  0  1  1  0 |  0   1   1   1
   0  0  1  1  1 |  1   0   0   0
   0  1  0  0  0 |  1   0   0   1
   0  1  0  0  1 |  1   0   1   0
   0  1  0  1  0 |  1   0   1   1
   0  1  0  1  1 |  1   1   0   0
   0  1  1  0  0 |  1   1   0   1
   0  1  1  0  1 |  1   1   1   0
   0  1  1  1  0 |  1   1   1   1
   0  1  1  1  1 |  0   0   0   0
   1  0  0  0  0 |  0   0   0   0
   1  0  0  0  1 |  0   0   0   0
   1  0  0  1  0 |  0   0   0   0
   1  0  0  1  1 |  0   0   0   0
   1  0  1  0  0 |  0   0   0   0
   1  0  1  0  1 |  0   0   0   0
   1  0  1  1  0 |  0   0   0   0
   1  0  1  1  1 |  0   0   0   0
   1  1  0  0  0 |  0   0   0   0
   1  1  0  0  1 |  0   0   0   0
   1  1  0  1  0 |  0   0   0   0
   1  1  0  1  1 |  0   0   0   0
   1  1  1  0  0 |  0   0   0   0
   1  1  1  0  1 |  0   0   0   0
   1  1  1  1  0 |  0   0   0   0
   1  1  1  1  1 |  0   0   0   0
As you can see, our conter behaves like an ordinary one when the cl signal is 0, and always goes to 0 when the cl signal is 1.