Loading lessons...
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
| Term | Meaning |
|---|---|
| Modulus (mod-N) | number of distinct states in the count cycle |
| n-bit binary counter | mod-2n, counts 0 to 2n - 1 |
| Up / down counter | count 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 |
| Synchronous | every 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-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 counter
Each output has half the frequency of the one before it: a ripple counter is a chain of divide-by-2 stages.
A 16 kHz clock drives a 4-bit ripple counter. Find the frequency at each output.
- Q0 = 16 / 2 = 8 kHz.
- Q1 = 4 kHz, Q2 = 2 kHz, Q3 = 16 / 24 = 1 kHz.
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 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
so one XOR gate (or a 2-to-1 multiplexer) sits between every pair of stages.
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 clear
Design a mod-10 ripple counter and explain the state 1010.
- Flip-flops: ⌈ log2 10 ⌉ = 4.
- The counter must go 0, 1, ..., 9, 0. The first unwanted state is 10 = 1010.
- 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)'.
- 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.
Find the number of flip-flops and the clear logic for (a) a mod-6 and (b) a mod-12 ripple counter.
- (a) ⌈ log2 6 ⌉ = 3 flip-flops. Clear at 6 = 110: CLR' = (Q2 Q1)'.
- (b) ⌈ log2 12 ⌉ = 4 flip-flops. Clear at 12 = 1100: CLR' = (Q3 Q2)'.
How many flip-flops are needed for a mod-60 and a mod-100 counter? What is the largest modulus with 5 flip-flops?
- 25 = 32 < 60 ≤ 64 = 26: mod-60 needs 6.
- 26 = 64 < 100 ≤ 128 = 27: mod-100 needs 7.
- 5 flip-flops have 25 = 32 states: the largest modulus is 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):
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.
- (a) 4 × 25 = 100 ns: fmax = 1 / 100 ns = 10 MHz.
- (b) 100 + 20 = 120 ns: fmax = 8.33 MHz.
- (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.
| Ripple counter | Synchronous counter | |
|---|---|---|
| Clock | only to the first flip-flop | to every flip-flop |
| Extra gates | none (binary) | AND gates for the toggle conditions |
| Delay | n · tpd, grows with n | about one tpd |
| Glitches when decoded | yes (transient states) | far fewer |
| Use | low-power, low-cost frequency dividers | everything 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:
// 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
endmoduleThe binary counter wraps after 15 and the decade counter after 9; the state 1010 is cleared before it can be printed:
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 1Key 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.
📝 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)