Skip to content
BetterDL

Toggle rule

Also called: counter toggle rule, counting toggle rule

In a binary up counter, a bit toggles at the next edge exactly when every bit below it is 1. In a down counter, when every bit below it is 0.

The toggle rule says which bits of a binary counter change at the next clock edge:

  • Up counter: a bit toggles exactly when every bit below it is 1.
  • Down counter: a bit toggles exactly when every bit below it is 0.
  • Q0 has no bits below it, so it toggles every time.

Why? Adding 1 is just binary addition with a carry. A carry passes through a bit only if that bit is 1 (1 + 1 = 0, carry 1). So the carry reaches bit k only when all the bits below it are 1, and when it arrives it flips bit k. Counting down works the same way with borrows, which pass through 0s.

This one rule is behind every counter circuit:

  • A synchronous counter uses it directly: Tₖ is the AND of all the lower bits, so T2 = .
  • A ripple counter uses it through the wiring: bit k is clocked when bit k − 1 falls from 1 to 0, which is exactly when the carry arrives.

It's also a quick mental check: from 0111, every bit below Q3 is 1, so all four bits flip and the next count is 1000.

00000
00101
01000
01111
10000
10101
11000
11111

Worked examples

Example

Which bits flip from 1011?

A 4-bit up counter holds Q3Q2Q1Q0 = 1011. Ask each bit: are all the bits below me 1?

  1. 1.

    Q0: always toggles → 1 becomes 0.

  2. 2.

    Q1: below it Q0 = 1 → toggles, 1 becomes 0.

  3. 3.

    Q2: below it Q1Q0 = 11 → toggles, 0 becomes 1.

  4. 4.

    Q3: below it Q2Q1Q0 = 011, not all 1 → holds at 1.

  5. 5.

    Next count 1100 = 12 = 11 + 1 ✓.

Example

Down counter from 1000

A 4-bit down counter holds 1000. Now ask: are all the bits below me 0?

  1. 1.

    Q0 toggles: 0 → 1.

  2. 2.

    Q1: Q0 = 0 → toggles, 0 → 1.

  3. 3.

    Q2: Q1Q0 = 00 → toggles, 0 → 1.

  4. 4.

    Q3: Q2Q1Q0 = 000 → toggles, 1 → 0.

  5. 5.

    Next count 0111 = 7 = 8 − 1 ✓.

Common mistakes

  • Looking only one bit down. Q2 toggles when Q1 and Q0 are 1, not just Q1. From 010, Q2 stays put.

  • Reading the bits after the edge. The rule uses the values just before the edge.

  • Using the up rule on a down counter. Going down, the condition is that every lower bit is 0.

Practice Toggle rule

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Toggle rule is taught in Counters.