A counting device includes a set of memory cells, which are configured to
store respective bits of a count code. A controller is coupled to the
memory cells so as to increment, in response to occurrences of a count
input, the count code in the set of the memory cells from an initial
value up to a preset bound in each of a plurality of successive
iterations, and to shift the bits of the count code that are respectively
stored in the memory cells in each of the iterations relative to a
preceding iteration.