Skip to content
GATEiit

GATE EC · Digital Circuits

Counters

Asynchronous (ripple) and synchronous counters, up/down and mod-N counters, ring and Johnson counters, counter design with excitation tables, maximum clock frequency and frequency division.

Before you start

This topic comes before: Finite state machines, Propagation delay

Concept notes

1. Ripple (asynchronous) counters

In a ripple counter only the first flip-flop gets the external clock. Each later flip-flop is clocked by the output of the one before it. Every flip-flop is wired to toggle (T=1, or J=K=1).

With n flip-flops the counter has 2n states, so it is a mod-2n counter. Flip-flop k toggles at half the rate of flip-flop k−1, so the output of the last stage has frequency fclk/2n.

Up or down? It depends on the edge and on which output drives the next clock:

Flip-flops trigger on Next clock taken from Q Next clock taken from Q‾
Falling edge up counter down counter
Rising edge down counter up counter

Delay. The clock ripples through the chain, so after an edge the last output settles only after n tpd. All outputs must settle before the next edge, which gives

fmax=1n tpd

(if a decoding gate reads the outputs, add its delay too). While the outputs ripple, the counter passes through short wrong states, for example 011 → 010 → 000 → 100 on the way from 3 to 4. A decoder on the outputs can produce glitches during these.

FF0TQ>1Q0FF1TQ>1Q1FF2TQ>1Q2CLKEach T = 1; each flip-flop toggles on the falling edge at its clock input
3-bit ripple up counter with falling-edge T flip-flops: CLK drives FF0, and each Q drives the next clock input.

2. Reading the waveforms and mod-N ripple counters

In a falling-edge ripple up counter, Q0 toggles at every clock falling edge, Q1 toggles whenever Q0 falls, and Q2 toggles whenever Q1 falls. Reading Q2Q1Q0 after each edge gives 0, 1, 2, …, 7, 0. After P clock pulses an n-bit up counter from 0 shows P mod 2n.

Mod-N by reset. To count 0 to N−1, use ⌈log⁡2N⌉ flip-flops and clear them all when the count reaches N. Feed the outputs that are 1 in the binary of N into a NAND gate whose output drives the active-low CLR inputs.

  • Mod-10 (decade): N=10=10102, NAND of Q3 and Q1.
  • Mod-6: N=1102, NAND of Q2 and Q1.
  • Mod-12: N=11002, NAND of Q3 and Q2.

Only the 1 bits are needed, because N is the first count at which all of them are 1. State N lasts only for the clear delay, so it is a transient state, not one of the N counted states.

CLKQ0Q1Q212345670count
Waveforms of the 3-bit ripple up counter. Dashed lines mark clock falling edges; the count Q2 Q1 Q0 after each edge is shown below (ripple delays ignored).

3. Synchronous counters

In a synchronous counter every flip-flop receives the same clock, so all outputs change together, one flip-flop delay after the edge. There are no ripple wrong states.

Binary up counter with T flip-flops: a bit toggles when all lower bits are 1.

T0=1,T1=Q0,T2=Q1Q0,Tk=Qk−1⋯Q1Q0

For a down counter use the complements: Tk=Q‾k−1⋯Q‾0. An up/down counter selects between the two with a control input M.

Maximum clock frequency. In one period the signal must leave a flip-flop, pass the gating logic and meet the setup time of the next flip-flop:

fmax=1tpd,FF+tlogic+tsetup

With parallel AND gates (one gate per stage) tlogic is one gate delay, so fmax does not depend on n. That is the main advantage over the ripple counter.

Ripple Synchronous
Clock first flip-flop only all flip-flops
Settling delay n tpd tpd (plus logic)
Decoding glitches yes no
Hardware least extra gates

4. Designing a synchronous counter for any sequence

A synchronous counter can step through any chosen sequence. The method:

  1. Number of flip-flops n with 2n≥ number of states.
  2. Write the state table: present state → next state.
  3. For each flip-flop, read the needed input from its excitation table (D: D=Q+; T: T=Q⊕Q+; JK: 0→0 is 0X, 0→1 is 1X, 1→0 is X1, 1→1 is X0).
  4. Put unused states as don't-cares and minimise each input with a K-map.
  5. Check the unused states. Find where each one goes with the final equations. If every unused state reaches the main cycle in a few clocks, the counter is self-starting. If an unused state loops among unused states, the counter can get stuck there (lock-out).

Analysis is the reverse: given the flip-flop input equations, start from the initial state, compute all inputs from the present outputs, apply one edge to all flip-flops at once, and repeat until a state repeats. The number of distinct states in the loop is the modulus.

5. Ring and Johnson counters

Both are shift registers with feedback from the last stage to the first.

Ring counter: D0=Qn−1. It is loaded with a single 1 (say 1000) and that 1 circulates: 1000, 0100, 0010, 0001, 1000. So n flip-flops give only n states (mod-n). Each state has a single 1, so no decoding gate is needed.

Johnson (twisted ring, switch-tail) counter: D0=Q‾n−1. From all zeros it fills with 1s and then with 0s, giving 2n states (mod-2n). Any state can be decoded with one 2-input AND gate.

Counter States with n flip-flops Unused states Output frequency of each flip-flop
Binary 2n 0 f/2,f/4,…,f/2n
Ring n 2n−n f/n
Johnson 2n 2n−2n f/2n (square wave)

Neither ring nor Johnson counters are self-starting in general; extra logic is added to correct an unused state.

Cascading. A mod-M counter whose output clocks a mod-N counter forms a mod-MN counter, and the final output frequency is f/(MN). Minimum flip-flops for mod-N in binary: ⌈log⁡2N⌉.

DQQ̅>FF0Q0DQQ̅>FF1Q1DQQ̅>FF2Q2DQQ̅>FF3Q3CLKQ̄3 fed back to D0; from 0000: 1000, 1100, 1110, 1111, 0111, 0011, 0001, 0000
4-bit Johnson counter: four D flip-flops on a common clock, with the complement of the last output fed back to the first input. It has 8 states.

Formulas to remember

States of an n-bit binary counterFinal output frequency fclk/2n
2n
Minimum flip-flops for mod-N
n=⌈log⁡2N⌉
Ripple counter maximum clockAdd decoding gate delay if the outputs are decoded
fmax=1n tpd
Synchronous counter maximum clock
fmax=1tpd,FF+tlogic+tsetup
Ring and Johnson counters
Ring: n states,Johnson: 2n states
Synchronous binary up counter (T flip-flops)
Tk=Qk−1 Qk−2⋯Q0,T0=1
Cascaded counters
fout=finM×N

Common mistakes

  • Using the wrong up/down rule for ripple counters; with falling-edge flip-flops Q to the next clock gives up counting, but with rising-edge flip-flops it gives down counting.
  • Counting the transient reset state as a valid state; in a mod-N ripple counter the state N lasts only a few nanoseconds.
  • Taking the ripple counter delay as one flip-flop delay; the last output settles only after n times the flip-flop delay.
  • Confusing ring and Johnson counters; ring has n states, Johnson has 2n states for n flip-flops.
  • Updating flip-flops one at a time in a synchronous circuit; all inputs are computed from the present state before the edge.
  • Forgetting to check unused states; a designed counter may lock out if an unused state never returns to the main cycle.

Worked examples

Try each step yourself, then reveal the working.

Example 1: Speed of a ripple counter

numerical

A 4-bit ripple counter uses flip-flops with propagation delay 10 ns each. Find the maximum clock frequency, and the frequency at Q3 when it is clocked at 16 MHz.

  1. Step 1: How long does the last output take to settle after a clock edge?

    Try it on paper first.

Example 2: A 2-bit Gray-code counter with D flip-flops

numerical

Design a synchronous counter with D flip-flops that goes Q1Q0: 00 → 01 → 11 → 10 → 00.

  1. Step 1: Write the state table.

    Try it on paper first.

Example 3: Analysing a JK counter

numerical

Two JK flip-flops A and B share a clock. JA=QB, KA=1, JB=Q‾A, KB=1. Starting from QAQB=00, find the sequence and the modulus. Is it self-starting?

  1. Step 1: Apply the first edge from 00.

    Try it on paper first.

Example 4: Decade ripple counter

conceptual

A 4-bit falling-edge ripple up counter has active-low CLR inputs. Which outputs should feed the NAND gate that drives CLR to make it a decade counter, and what does a fast logic analyser see at the tenth clock edge?

  1. Step 1: Write 10 in binary.

    Try it on paper first.

Previous year questions

1 official GATE EC question on this topic, newest first.

Topic test

9 questions: up to 1 official PYQs and original practice questions, with GATE marking (MCQ wrong answers lose marks). Score 60% or more to pass. A new set is drawn each time.

Mark as mastered

Loading your progress…

My revision notes

Notes written by the GATEiit team against the official GATE EC syllabus; being checked by a reviewer. Updated 2026-11-28. Spotted a mistake? Use Report an issue on any question, or contact us.