Synchronous and asynchronous counters
Counters from flip-flops: ripple (asynchronous) counters and their glitches and delay, synchronous counters and their design with excitation tables, modulus and frequency division, up-down counters, and the ring and Johnson counters.
Why it exists
A counter is a register that steps through a fixed sequence of states, one step per clock pulse. It counts events, divides a clock frequency, generates addresses (the program counter), makes timing signals and steps a control unit. There are two ways to build one. The asynchronous (ripple) counter is the cheapest: the output of each flip-flop clocks the next, so the clock ripples down the chain. The synchronous counter clocks every flip-flop together and uses gates to decide which flip-flops toggle. GATE asks for the count sequence, the modulus, the frequency of an output, the maximum clock frequency, the glitches of a ripple counter, the number of flip-flops, and the input equations of a synchronous design.
Prerequisites
You need T and JK flip-flops and the excitation table from flip-flop conversion.
Precise definitions
Modulus. An -bit counter that uses all its states has modulus (a mod- counter): 3 bits count 0 to 7, 4 bits 0 to 15. A mod- counter has states and needs flip-flops. The decade (BCD) counter is mod-10 with 4 flip-flops.
Frequency division. Each flip-flop of a binary counter divides the frequency by 2. If the clock has frequency , the output (counting from ) has frequency . A mod- counter's last stage divides by when it produces one output pulse per cycle.
Asynchronous (ripple) counter. T flip-flops with (or JK with ). The first is clocked by the external clock, and each following flip-flop is clocked by the output of the previous one.
| Flip-flop triggers on | clock of stage is | counts |
|---|---|---|
| falling edge | up | |
| falling edge | down | |
| rising edge | up | |
| rising edge | down |
For a falling-edge flip-flop clocked by : when falls from 1 to 0 (the stage wraps from 1 back to 0) the next stage toggles, which is exactly the carry of a binary counter.
Ripple delay and glitches. Each stage changes only after the previous one, so a change at the input ripples through the chain with a delay per stage. After a clock edge the counter passes through intermediate false counts: the worst case, 011 to 100, shows 011, then 010, then 000, then 100. The outputs are valid only after the clock edge, so the clock period must exceed and the maximum clock frequency is about : it falls as the counter gets longer. A decoder on the outputs can respond to the false counts.
Mod- ripple counter by reset. For a count of states, add a gate that detects the state and clears all flip-flops asynchronously. The counter then counts , but the state exists for a very short time (a glitch) before the clear takes effect.
Synchronous counter. All flip-flops share the clock, so all changes happen at the same time. For a binary up counter with T flip-flops:
that is, a stage toggles when all lower bits are 1. For a down counter each in the AND is complemented (). An up-down counter selects between them with a control input. Delay: one flip-flop delay plus the delay of the largest AND gate, independent of the number of stages in the simple model, so a synchronous counter can run faster than a ripple counter of the same size and has no false counts.
Design procedure for a synchronous counter with any sequence. (1) Draw the state sequence and assign the flip-flop outputs. (2) For each present state find the next state. (3) From the excitation table of the chosen flip-flop type, find the required inputs for every flip-flop. (4) Treat unused states as don't cares and minimise each input equation with a K-map. (5) Check what the unused states do: the design should lead them back into the main sequence (self-correcting).
Ring counter. An -stage shift register whose last output feeds the first input; initialised to one-hot (1000...). It cycles through states, one flip-flop per state, and its outputs are directly the timing signals. Johnson (twisted-ring) counter. The same but with the inverted last output fed back: flip-flops give states. A 3-stage Johnson counter runs 000, 100, 110, 111, 011, 001. Each state can be decoded with a 2-input AND gate. Both have unused states ( and ) and need a self-starting circuit or an initial reset.
How it works
Step through a 3-bit asynchronous counter. Falling clock edges are marked by the cursor. Watch the bus line at the bottom around the transition from 3 to 4: the three bits do not change together, so the count passes through 010 and 000 on the way from 011 to 100.
3-bit asynchronous (ripple) counter: Start
Simulated, not typedDashed lines mark rising clock edges. Green is an output, blue a stored state, black an input, grey the clock. One tick = one flip-flop delay.
Step 1
Three T flip-flops with T = 1, each triggered by a falling edge. The first is clocked by CLK, the second by Q0 and the third by Q1, so the clock ripples through the chain. Each flip-flop has a delay of one tick from trigger to output.
Now the same counter with all flip-flops on one clock and , , . All changes line up and the count goes straight from 011 to 100.
3-bit synchronous counter: Start
Simulated, not typedDashed lines mark rising clock edges. Green is an output, blue a stored state, black an input, grey the clock. One tick = one flip-flop delay.
Step 1
Three T flip-flops all clocked by the same CLK. T0 = 1, T1 = Q0, T2 = Q1 Q0, so each stage toggles when all the lower bits are 1.
For a design example, a synchronous mod-6 counter (states 0 to 5) with T flip-flops. The top bit toggles on the transitions 3 to 4 and 5 to 0, so is 1 in states 3 and 5; the unused states 6 and 7 are don't cares.
Mod-6 counter with T flip-flops: the T input of the top flip-flop: Fill in the map
Exact minimiser, not typed| Q2\Q1Q0 | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 0 | 00 | 01 | 13 | 02 |
| 1 | 04 | 15 | X7 | X6 |
Small number = minterm index. X = don't care. Row and column labels are in Gray-code order.
Groups so far (product terms)
None yet.
Step 1
The counter runs 0, 1, 2, 3, 4, 5 and back to 0. The top bit Q2 has to toggle on the transitions 3 to 4 (011 to 100) and 5 to 0 (101 to 000), so T2 = 1 in the states 3 and 5. States 6 and 7 never occur and are don't cares.
Doing the same for the other bits gives (the lowest bit changes at every pulse), (it toggles in states 1 and 3), and from the map.
Worked examples
EX 1Counting sequences in a program
EasyThe program implements the synchronous mod-6 and mod-10 designs (from their T equations), the 3-stage Johnson counter and the 4-stage ring counter.
#include <stdio.h>
/* synchronous mod-6 counter with T flip-flops: T0 = 1, T1 = Q2' Q0, T2 = Q1 Q0 + Q2 Q0 */
static int mod6_next(int s) {
int q2 = (s >> 2) & 1, q1 = (s >> 1) & 1, q0 = s & 1;
int t0 = 1, t1 = !q2 && q0, t2 = (q1 && q0) || (q2 && q0);
return s ^ (t2 << 2 | t1 << 1 | t0);
}
/* synchronous decade counter: T0 = 1, T1 = Q3' Q0, T2 = Q1 Q0, T3 = Q2 Q1 Q0 + Q3 Q0 */
static int mod10_next(int s) {
int q3 = (s >> 3) & 1, q2 = (s >> 2) & 1, q1 = (s >> 1) & 1, q0 = s & 1;
int t0 = 1, t1 = !q3 && q0, t2 = q1 && q0, t3 = (q2 && q1 && q0) || (q3 && q0);
return s ^ (t3 << 3 | t2 << 2 | t1 << 1 | t0);
}
int main(void) {
int s = 0;
printf("mod-6:");
for (int i = 0; i < 8; i++) {
printf(" %d", s);
s = mod6_next(s);
}
printf("\nunused states: 6 -> %d, 7 -> %d\n", mod6_next(6), mod6_next(7));
s = 0;
printf("mod-10:");
for (int i = 0; i < 12; i++) {
printf(" %d", s);
s = mod10_next(s);
}
printf("\n");
int j = 0;
printf("Johnson, 3 stages:");
for (int i = 0; i < 7; i++) {
printf(" %d%d%d", (j >> 2) & 1, (j >> 1) & 1, j & 1);
int in = !(j & 1);
j = (j >> 1) | (in << 2);
}
printf("\nring, 4 stages:");
int r = 8;
for (int i = 0; i < 5; i++) {
printf(" %d%d%d%d", (r >> 3) & 1, (r >> 2) & 1, (r >> 1) & 1, r & 1);
r = ((r >> 1) | ((r & 1) << 3)) & 15;
}
printf("\n");
double tpd = 10.0;
printf("4-stage ripple counter, delay %.0f ns per stage: fmax about %.1f MHz\n", tpd, 1000.0 / (4 * tpd));
return 0;
}mod-6: 0 1 2 3 4 5 0 1
unused states: 6 -> 7, 7 -> 2
mod-10: 0 1 2 3 4 5 6 7 8 9 0 1
Johnson, 3 stages: 000 100 110 111 011 001 000
ring, 4 stages: 1000 0100 0010 0001 1000
4-stage ripple counter, delay 10 ns per stage: fmax about 25.0 MHzMod-6. The sequence is 0 to 5 and back. The unused states fix themselves: , which is inside the main cycle, so the counter is self-correcting. Mod-10. The decade counter counts 0 to 9. Johnson and ring sequences as defined above. The last line gives the maximum frequency of a 4-stage ripple counter with 10 ns per stage: about 25 MHz.
EX 2Modulus, flip-flops and frequency
Easy(a) A mod-12 counter needs flip-flops. (b) A 5-bit binary counter has modulus 32. (c) A 40 MHz clock drives a 4-bit binary counter: has 20 MHz, 10 MHz, 5 MHz, 2.5 MHz. (d) To divide a 1 MHz clock down to 1 kHz you need about 10 stages (), and an exact division by 1000 needs a mod-1000 counter (three decade counters).
EX 3Which way does the ripple counter count?
MediumA 3-bit ripple counter uses falling-edge JK flip-flops with and the clock of stage taken from . Stage 1 toggles when falls, that is when rises (0 to 1). Starting from 000: the first pulse makes , which makes toggle to 1, then falls ... so the counter goes to 111 and counts down: 000, 111, 110, 101, 100, 011, ... (checked for all four wirings in the script).
EX 4Maximum clock frequency
MediumA 4-bit ripple counter's flip-flops have a clock-to-output delay of 10 ns. The change takes up to ns to settle after a clock edge, so the clock period must be at least 40 ns: MHz. A synchronous 4-bit counter with the same flip-flops and a 3-input AND gate of 5 ns has a path of about ns, so about 67 MHz (ignoring setup time). Always add the setup time if the question gives it.
EX 5Design the mod-6 counter with T flip-flops
GATE levelPresent states 0 to 5, next states 1, 2, 3, 4, 5, 0. A bit toggles () when it differs between present and next state.
| state | next | |||
|---|---|---|---|---|
| 000 | 001 | 0 | 0 | 1 |
| 001 | 010 | 0 | 1 | 1 |
| 010 | 011 | 0 | 0 | 1 |
| 011 | 100 | 1 | 1 | 1 |
| 100 | 101 | 0 | 0 | 1 |
| 101 | 000 | 1 | 0 | 1 |
| 110, 111 | X | X | X | X |
Minimising with 110 and 111 as don't cares: , , . Gates: 1 AND with one inverted input for , two ANDs and an OR for , a total of 4 gates plus the inverter. As the program shows, 6 goes to 7 and 7 goes to 2, so the unused states return to the cycle.
EX 6The glitch in the ripple counter
GATE levelFor the transition 011 to 100 in the animation: the clock falls; falls one delay later (011 becomes 010); the falling clocks stage 1, which falls one delay later (010 becomes 000); the falling clocks stage 2, which rises (000 becomes 100). The outputs show the false counts 010 and 000, so a decoder looking for the state 000 or 010 would produce a spurious pulse. The total time is 3 flip-flop delays for 3 stages. In the synchronous counter all three bits change in the same delay and no false count appears (assuming equal delays).
EX 7Ring and Johnson counters
GATE levelA 4-stage ring counter has 4 states; a 4-stage Johnson counter has 8. To get 8 distinct timing signals from a ring counter you need 8 flip-flops; from a Johnson counter, 4 flip-flops plus 8 two-input AND gates. A 4-stage ring counter has unused states, a 4-stage Johnson counter has .
Cheat box
Cheat box
- flip-flops: modulus up to . Mod- needs flip-flops. Output has frequency .
- Ripple up counter: falling-edge flip-flops clocked by (or rising-edge clocked by ). Swap and to count down.
- Ripple delay , ; glitch states appear (011 to 100 passes 010, 000).
- Synchronous up counter with T: . Down counter: use . Faster, no glitches.
- Design: excitation table, K-map with unused states as don't cares, check that the unused states return to the cycle.
- Decade counter (T): , , , . Mod-6 (T): , , .
- Ring counter: states, one-hot. Johnson: states, 2-input decoding.
Traps and GATE patterns
Connections
Across subjects
A counter is a special case of a state machine whose next state does not depend on any input. A ring or Johnson counter is a shift register with feedback. The input equations come from the excitation table and are minimised with a K-map. The program counter of the instruction cycle is a loadable counter.
PYQs
13 previous year questions from your book. I re-solved each one myself (13 by running or simulating, 0 by reasoning only); the book's key is shown next to my answer. All PYQs
Consider a 2-bit saturating up/down counter that performs the saturating up count when the input P is 0, and the saturating down count when P is 1. The Next State table of the counter is as shown. The counter is built as a synchronous sequential circuit using D flip-flops. Input Current State Next State P Q1 Q1 + Q0 + 0 0 0 0 1 0 0 1 1 0 0 1 0 1 1 0 1 1 1 1 1 0 0 0 0 1 0 1 0 0 1 1 0 0 1 1 1 1 1 0
- (a)D1 = PQ1 + P ̅Q0 + Q1Q0 D0 = PQ0 + P ̅Q1 + Q1Q0
- (b)D1 = P̅Q1 + P̅Q0 + Q1Q0 D0 = P̅Q0̅̅̅̅ + P̅Q1 + Q1Q0
- (c)D1 = P ̅Q ̅1 + P ̅Q0 + Q1Q0 D0 = P ̅Q0 + P ̅Q1 + Q1Q ̅0
- (d)D1 = PQ1 + P ̅Q0 + Q1Q0 D0 = PQ0 + P ̅Q1 + Q1Q0
Consider the given sequential circuit designed using D-Flip-flops. The circuit is initialized with some value (initial state). The number of distinct states the circuit will go through before returning to the initial state is . (Answer in integer)
In a 4-bit ripple counter, if the period of the waveform at the last flip-flop is 64 microseconds, then the frequency of the ripple counter in kHz is ________. (Answer in integer)
Consider a sequential digital circuit consisting of T flip-flops and D flip-flops as shown in the figure. CLKIN is the clock input to the circuit. At the beginning, Q1, Q2 and Q3 have values 0, 1 and 1, respectively. Which one of the given values of (Q1, Q2, Q3) can NEVER be obtained with this digital circuit?
- (a)(0, 0, 1)
- (b)(1, 0, 0)
- (c)(1, 0, 1)
- (d)(1, 1, 1)
Consider a 3-bit counter, designed using T flip-flops, as shown below : Assuming the initial state of the counter given by PQR as 000, what are the next three states?
- (a)001, 010, 111
- (b)011, 101, 000
- (c)001, 010, 000
- (d)011, 101, 111
The next state table of a 2-bit saturating up-counter is given below. Q1 Q0 Q1 + Q0 + 0 0 0 1 0 1 1 0 1 0 1 1 1 1 1 1 DIGITAL LOGIC The counter is built as a synchronous sequential circuit using T flip-flops. The expressions for T1 and T0 are
- (a)T1 = Q0Q1 , T0 = Q'0Q'1
- (b)T1 = Q'1Q0 , T0 = Q'1 + Q'0
- (c)T1 = Q1 + Q0 , T0 = Q'1Q'0
- (d)T1 = Q'1Q0 , T0 = Q1 + Q0
We want to design a synchronous counter that counts the sequence 0-1-0-2-0-3 and then repeats. The minimum number of J-K flip-flops required to implement this counter is __________.
Consider a 4-bit Johnson counter with an initial value of 0000. The counting sequence of this counter is
- (a)0, 1, 3, 7, 15, 14, 12, 8, 0
- (b)0, 1, 3, 5, 7, 9, 11, 13, 15, 0
- (c)0, 2, 4, 6, 8, 10, 12, 14, 0
- (d)0, 8, 12, 14, 15, 7, 3, 1, 0
Let k = 2n. A circuit is built by giving the output of an n-bit binary counter as input to an n-to-2n bit decoder. This circuit is equivalent to a ?
- (a)k-bit binary up counter
- (b)k-bit binary down counter
- (c)k-bit ring counter
- (d)k-bit Johnson counter DIGITAL LOGIC
The minimum number of D flip-flops needed to design a mod-258 counter is
- (a)9
- (b)8
- (c)512
- (d)258
Consider the following circuit involving three D- type flip-flops used in a certain type of counter configuration If at some instance prior to the occurrence of the clock edge, and have a value , and respectively, what shall be the value of after the clock edge?
- (a)000
- (b)001
- (c)010
- (d)011
In the sequential circuit shown below, if the initial value of the output is . What are the next four values of ?
- (a)11, 10, 01, 00
- (b)10, 11, 01, 00
- (c)10, 00, 01, 11
- (d)11, 10, 00, 01
The control signal functions of a - binary counter are given below (where is "don't care"): DIGITAL LOGIC Assume that the counter and gate delays are negligible. If the counter starts at then it cycles through the following sequence
- (a)0, 3, 4
- (b)0, 3, 4, 5
- (c)0, 1, 2, 3, 4
- (d)0, 1, 2, 3, 4, 5
Self-check
Question 1
A 4-bit synchronous up counter with T flip-flops is in the state 0111. What are , and what is the next state?
Show answerHide
A stage toggles when all lower bits are 1: , , , . All four toggle: 0111 becomes 1000.
Question 2
How many flip-flops does a mod-60 counter need, and what is the output frequency if the input is 60 Hz?
Show answerHide
flip-flops. The output of the mod-60 counter is Hz.
Question 3
Which states does a 4-stage Johnson counter visit, starting from 0000 with the inverted last output fed to the first stage and shifting right?
Show answerHide
0000, 1000, 1100, 1110, 1111, 0111, 0011, 0001 and back to 0000: 8 states.
Question 4
An asynchronous 3-bit counter uses falling-edge T flip-flops, each clocked by the of the previous stage. How many different values (including the wrong ones) does the bus show while it changes from 011 to 100?
Show answerHide
Four: 011, 010, 000 and 100 (the animation shows the sequence).
Revision card
One-screen revision
- flip-flops give modulus up to ; mod- needs ; runs at .
- Ripple: clock of next stage from (falling-edge) or (rising-edge) counts up; swap to count down. Delay , glitches.
- Synchronous: all clocked together; AND of lower bits. Design from the excitation table; unused states are don't cares; check they recover.
- Ring: states. Johnson: states.
References
- ·Mano and Ciletti, Digital Design, 5th ed., Chapter 6 Registers and Counters (ripple counters, synchronous counters, ring and Johnson counters)
- ·Kohavi and Jha, Switching and Finite Automata Theory, Chapter on counters
Verification
The two timing animations are discrete-time simulations (scripts/gen-dl-seq-traces.py) re-simulated independently in tests/dl-seq-traces.test.ts, including the glitch values of the ripple counter. The counting sequences of all four ripple wirings (edge type and Q or Q' clocking), the synchronous up and down T equations, the mod-6 and mod-10 designs from the exact minimiser (including the fate of the unused states), the ring and Johnson counters and the frequency division figures are checked in scripts/enum-checks/dl_seq.py. The K-map animation is produced by the exact minimiser and re-derived in tests/dl-traces.test.ts. The C program is compiled and run by npm run verify:c. The maximum-clock-frequency formulas use a stated simple delay model and may differ from a GATE question's own model. Textbook chapter titles are from memory; the independent second pass has not been run, so the page stays draft. SECOND PASS (2026-11-02, done by the assistant, not a human check): every Self-check question was solved before the printed answer was read and all agreed; the definitions, worked examples, cheat box and traps were read claim by claim and the numbers re-derived by hand or by a small script (conversions, signed ranges and flags, IEEE 754 fields and custom formats, Boolean identities and counts, K-map groups, adder carries, BCD correction, flip-flop conversions, counter sequences and T equations, state reduction, Quine-McCluskey rounds and covers, floating-point alignment and rounding); long C programs were not re-read line by line (they are compiled and compared by npm run verify:c, and their printed outputs were checked against the prose); tables and animations are machine output and were read, not re-run; No other defect found. Status raised to self-checked; verified needs a textbook or human check.
last verified: never
My notes (saved in this browser)