Lesson 20 +35 XP

Ripple (Asynchronous) Counters

Ripple (Asynchronous) Counters

A counter is a register that goes through a fixed sequence of states when clock pulses arrive. Counters count events, divide frequencies, generate timing signals and sequence the steps of a control unit. There are two families: ripple (asynchronous) counters, covered here, and synchronous counters, covered in Lesson 21.

1. Counter Vocabulary

TermMeaning
Modulus (mod-N)number of distinct states in the count cycle
n-bit binary countermod-2n, counts 0 to 2n - 1
Up / down countercount increases / decreases with each clock
Ripple (asynchronous)only the first flip-flop gets the external clock; each later flip-flop is clocked by the previous one
Synchronousevery flip-flop gets the same clock

A mod-N counter needs at least ⌈ log2 N ⌉ flip-flops.

2. The 4-Bit Ripple Up Counter

Look at the binary count sequence: bit Q0 toggles on every count, and each higher bit toggles exactly when the bit below it goes from 1 to 0. So:

  • Every flip-flop is a T flip-flop with T = 1 (a JK with J = K = 1).
  • Flip-flop 0 is clocked by the input clock.
  • Flip-flop i is clocked by Qi-1, and must trigger on the negative edge (1 → 0).

4-bit ripple up counter with negative-edge JK flip-flops4-bit ripple up counter with negative-edge JK flip-flops

The name comes from the way a change ripples through the stages one after another, like a row of falling dominoes.

Timing diagram of the 4-bit ripple counterTiming diagram of the 4-bit ripple counter

Each output has half the frequency of the one before it: a ripple counter is a chain of divide-by-2 stages.

SolvedExample 1 · Frequency division

A 16 kHz clock drives a 4-bit ripple counter. Find the frequency at each output.

  1. Q0 = 16 / 2 = 8 kHz.
  2. Q1 = 4 kHz, Q2 = 2 kHz, Q3 = 16 / 24 = 1 kHz.
Answer8 kHz, 4 kHz, 2 kHz, 1 kHz (stage n divides by 2n+1)

3. Ripple Down Counter and Up/Down Counter

In a down count, a bit toggles when the bit below it goes from 0 to 1. Two equivalent ways to get that:

  • Clock each negative-edge stage from Q' of the previous stage (when Q rises, Q' falls), or
  • Clock each positive-edge stage from Q of the previous stage.

3-bit ripple down counter3-bit ripple down counter

An up/down ripple counter selects between Q and Q' with a control input M (M = 0 up, M = 1 down). The clock of stage i is

CLKi = M'Qi-1 + MQ'i-1 = M oplus Qi-1

so one XOR gate (or a 2-to-1 multiplexer) sits between every pair of stages.

⚠️ Warning

Changing M while the counter is running can itself create a falling edge on some CLKi and change the count by mistake. Change the direction only between clock pulses, or use a synchronous up/down counter.

4. Mod-N Ripple Counters with an Asynchronous Clear

To count to some N that is not a power of 2, use ⌈ log2 N ⌉ flip-flops and clear all of them the moment the count reaches N. A NAND gate detects state N (only the bits that are 1 in N are needed) and drives the active-low CLR inputs.

Decade ripple counter with NAND clearDecade ripple counter with NAND clear

SolvedExample 2 · Decade (mod-10) ripple counter

Design a mod-10 ripple counter and explain the state 1010.

  1. Flip-flops: ⌈ log2 10 ⌉ = 4.
  2. The counter must go 0, 1, ..., 9, 0. The first unwanted state is 10 = 1010.
  3. In the valid states 0 to 9, Q3 and Q1 are both 1 only in 1010 (11, 14, 15 never occur). So CLR' = (Q3 Q1)'.
  4. When the count goes from 1001 to 1010, the NAND output falls and clears all flip-flops within a few nanoseconds. 1010 exists only as a short glitch and is never seen as a stable count.
Answer4 JK flip-flops (J = K = 1), CLR' = (Q3 Q1)', sequence 0 to 9
SolvedExample 3 · Mod-6 and mod-12 counters

Find the number of flip-flops and the clear logic for (a) a mod-6 and (b) a mod-12 ripple counter.

  1. (a) ⌈ log2 6 ⌉ = 3 flip-flops. Clear at 6 = 110: CLR' = (Q2 Q1)'.
  2. (b) ⌈ log2 12 ⌉ = 4 flip-flops. Clear at 12 = 1100: CLR' = (Q3 Q2)'.
Answer(a) 3 FFs, NAND of Q2, Q1; (b) 4 FFs, NAND of Q3, Q2
SolvedExample 4 · Flip-flops for larger moduli

How many flip-flops are needed for a mod-60 and a mod-100 counter? What is the largest modulus with 5 flip-flops?

  1. 25 = 32 < 60 ≤ 64 = 26: mod-60 needs 6.
  2. 26 = 64 < 100 ≤ 128 = 27: mod-100 needs 7.
  3. 5 flip-flops have 25 = 32 states: the largest modulus is 32.
Answer6, 7 and mod-32

5. Speed Limit of a Ripple Counter

Each stage waits for the one before it, so the delays add up. In the worst case (for example 0111 → 1000 or 1111 → 0000) the change has to ripple through all n stages. The counter shows false transient states on the way: 0111 → 0110 → 0100 → 0000 → 1000.

If each flip-flop has delay tpd, the count is only stable n · tpd after the clock edge. Any circuit that decodes the count must wait for that (plus its own delay, ts):

fmax = frac{1}{n · tpd + ts}
SolvedExample 5 · Maximum clock frequency

A 4-bit ripple counter uses flip-flops with tpd = 25 ns. (a) What is the maximum clock frequency? (b) If the count is decoded by a gate needing 20 ns, what then? (c) Compare with a 4-bit synchronous counter.

  1. (a) 4 × 25 = 100 ns: fmax = 1 / 100 ns = 10 MHz.
  2. (b) 100 + 20 = 120 ns: fmax = 8.33 MHz.
  3. (c) In a synchronous counter all flip-flops change together: about 25 ns plus the AND-gate delay, so it is roughly 4 times faster, and the advantage grows with n.
Answer10 MHz; 8.33 MHz with decoding; synchronous counters do not slow down as bits are added
Ripple counterSynchronous counter
Clockonly to the first flip-flopto every flip-flop
Extra gatesnone (binary)AND gates for the toggle conditions
Delayn · tpd, grows with nabout one tpd
Glitches when decodedyes (transient states)far fewer
Uselow-power, low-cost frequency dividerseverything fast

6. Ripple Counters in Verilog

A T flip-flop that toggles on the falling edge, four of them chained by their outputs, and a decade counter that adds the NAND clear:

VERILOG
// Ripple counters: negative-edge T flip-flops, each clocked by the previous Q
module t_ff (
    input      clk,
    input      clr_n,       // asynchronous active-low clear
    output reg q
);
    always @(negedge clk or negedge clr_n) begin
        if (!clr_n)
            q <= 1'b0;
        else
            q <= ~q;        // T = 1: toggle on every falling edge
    end
endmodule

module ripple4 (
    input        clk,
    input        clr_n,
    output [3:0] q
);
    t_ff f0 (.clk(clk),  .clr_n(clr_n), .q(q[0]));
    t_ff f1 (.clk(q[0]), .clr_n(clr_n), .q(q[1]));
    t_ff f2 (.clk(q[1]), .clr_n(clr_n), .q(q[2]));
    t_ff f3 (.clk(q[2]), .clr_n(clr_n), .q(q[3]));
endmodule

module decade (
    input        clk,
    input        rst_n,
    output [3:0] q
);
    wire clr_n = rst_n & ~(q[3] & q[1]);    // NAND of Q3 and Q1 clears at 1010
    ripple4 r (.clk(clk), .clr_n(clr_n), .q(q));
endmodule

module tb;
    reg clk = 1, rst_n = 0;
    wire [3:0] c16, c10;
    integer i;

    ripple4 u1 (.clk(clk), .clr_n(rst_n), .q(c16));
    decade  u2 (.clk(clk), .rst_n(rst_n), .q(c10));

    initial begin
        #1 rst_n = 1;
        $write("mod-16:");
        for (i = 0; i < 18; i = i + 1) begin
            $write(" %0d", c16);
            #5 clk = 0;
            #5 clk = 1;
        end
        $write("\nmod-10:");
        rst_n = 0;
        #1 rst_n = 1;
        for (i = 0; i < 12; i = i + 1) begin
            $write(" %0d", c10);
            #5 clk = 0;
            #5 clk = 1;
        end
        $display("");
    end
endmodule

The binary counter wraps after 15 and the decade counter after 9; the state 1010 is cleared before it can be printed:

OUTPUT
mod-16: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1
mod-10: 0 1 2 3 4 5 6 7 8 9 0 1
💡 Tip

Key points to remember

  • Ripple counter: T = 1 flip-flops, stage i clocked by stage i - 1; each stage divides the frequency by 2.
  • Up count: negative-edge stages clocked by Q. Down count: clocked by Q' (or positive-edge by Q).
  • Mod-N: ⌈ log2 N ⌉ flip-flops, NAND of the 1-bits of N drives the clear.
  • Delay n · tpd, so fmax = 1 / (n · tpd + ts); transient false states appear.
🎯 END-TERM EXAM PREP

📝 IPU End-Term Exam Corner (5-10 Marks)

  • Q1. Design a 4-bit asynchronous (ripple) up counter using JK flip-flops. Draw the timing diagram. (10 Marks)
  • Write: four JK flip-flops with J = K = 1, negative-edge clocks from the previous Q, the waveforms of Q0 to Q3 and the count.
  • Q2. Design a decade (mod-10) ripple counter. Why does the state 1010 appear briefly? (5 Marks)
  • Q3. How is a ripple down counter obtained? Draw a 3-bit ripple up/down counter with a mode control. (5 Marks)
  • Q4. A 4-bit ripple counter uses flip-flops with 25 ns delay. Find the maximum clock frequency. (2.5 Marks)
  • Q5. Compare ripple and synchronous counters. (5 Marks)