Sub topic 15
Ripple and Synchronous Counters, Modulus and Design
Prerequisites and working model
This chapter assumes that you can read binary numbers, understand Boolean logic, and use flip-flop characteristic tables. A counter is a sequential circuit whose stored binary value changes on each active clock edge. Its flip-flops store the current count, and combinational logic determines the next count.
A counter with \(n\) flip-flops can represent up to \(2^n\) states. A counter that uses exactly \(M\) states is a modulo-\(M\) counter. It counts through \(M\) states and then returns to its initial state.
Ripple counters
A ripple counter, also called an asynchronous counter, connects the output of one flip-flop to the clock input of the next flip-flop. Only the first flip-flop receives the external clock. The state changes ripple through the remaining flip-flops.
For a three-bit up-counter using toggle flip-flops:
- The least significant bit toggles on every clock edge.
- The next bit toggles whenever the first bit produces the required edge.
- The most significant bit toggles after the lower bits complete their cycle.
The counter sequence is:
\[ 000 \rightarrow 001 \rightarrow 010 \rightarrow 011 \rightarrow 100 \rightarrow 101 \rightarrow 110 \rightarrow 111 \]
Each flip-flop adds propagation delay. During a transition such as \(011 \rightarrow 100\), intermediate values can briefly appear as the bits change at different times. Therefore, ripple counters are simple but unsuitable when other logic must sample the count immediately after a clock edge.
Synchronous counters
In a synchronous counter, every flip-flop receives the same external clock. Combinational input logic decides which flip-flops toggle on that edge. All state bits update nearly together, so synchronous counters avoid ripple delay.
For a binary up-counter built from T flip-flops:
- \(T_0 = 1\)
- \(T1 = Q0\)
- \(T2 = Q0Q_1\)
- In general, \(Ti = Q0Q1\cdots Q{i-1}\)
A bit toggles when every less significant bit is 1. JK flip-flops can implement the same design by setting \(Ji=Ki=T_i\).
| Feature | Ripple counter | Synchronous counter |
|---|---|---|
| Clock connection | Clock ripples between flip-flops | One clock reaches every flip-flop |
| Hardware | Simpler | More combinational logic |
| Delay | Accumulates across stages | Mainly logic-path delay |
| Use | Low-speed counting | High-speed and precise timing |
Modulus and truncated counters
To design a modulo-\(M\) counter, choose the smallest \(n\) satisfying:
\[ 2^n \geq M \]
A modulo-6 counter needs three flip-flops because \(2^2<6\) and \(2^3\geq6\). It uses states 000 through 101. The unused states 110 and 111 must be handled safely.
In a synchronous design, detect state 101 and load 000 on the next clock edge. This creates the sequence 0, 1, 2, 3, 4, 5, 0. A synchronous reset changes the state only on a clock edge.
module mod6_counter(
input clk,
input rst,
output reg [2:0] q
);
always @(posedge clk) begin
if (rst || q == 3'd5)
q <= 3'd0;
else
q <= q + 3'd1;
end
endmoduleExercise
How many flip-flops are required for a modulo-10 counter, and which states are normally used?
Show answer
Four flip-flops are required because 2^3 < 10 <= 2^4. The counter normally uses states 0000 through 1001, representing 0 through 9.