Counter is a device which stores the number of times a particular event or process has occurred. As the name suggests, a counter is a device which is used for “counting” – mostly in relation to a clock signal.
A counter is said to be free-running if it contains all possible states in the counter loop. The longest loop in the sequence of numbers generated by the counter is said to be the main counting loop. If the main counting loop extends and covers all the states, only then is the counter said to be free-running. In other words, the main counting loop should cover the entire sequence.
Free-running counters are counters which operate without needing any external interference at any point in time. If at least one point lies outside the main counting loop then some sort of extra effort is needed to force it to come back to the main loop.
In this example, the main counting loop is the entire sequence – it covers all the states in the sequence. Hence it is a free-running counter.
In this example, the subsequence 01->10->11->01 is the main counting loop for the sequence. Since the state 00 is not a part of the main counting loop, it is not a free-running counter.
The main counting loop in this example is 010->001->011->100->101->110->010. Since states 111 and 000 do not form a part of the main counting loop, it is not a free-running loop.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.