CodiodeCodiode
Home
Problem Solving
Skill Tracks
My Assignments
Contests
Leaderboard
Community
Settings
Codiode/Problems/Sequential Logic

3-Bit Gray Code Counter

MediumLogic CircuitBuild

Asynchronous FIFOs and clock domain crossing circuits rely on pointers that change only one bit at a time to prevent metastability. The 3-bit Gray code counter generates this safe sequence, cycling through all eight possible states without intermediate glitches.

The counter updates its 3-bit output {Q2, Q1, Q0} on the rising edge of clk. When rst is 1, the output synchronously resets to 000. When rst is 0, the counter follows the standard 3-bit Gray code sequence.

| Q2 | Q1 | Q0 | D2 | D1 | D0 | |------|------|------|------|------|------| | 0 | 0 | 0 | 0 | 0 | 1 | | 0 | 0 | 1 | 0 | 1 | 1 | | 0 | 1 | 1 | 0 | 1 | 0 | | 0 | 1 | 0 | 1 | 1 | 0 | | 1 | 1 | 0 | 1 | 1 | 1 | | 1 | 1 | 1 | 1 | 0 | 1 | | 1 | 0 | 1 | 1 | 0 | 0 | | 1 | 0 | 0 | 0 | 0 | 0 |

Constraints

  • Use exactly three D flip-flops for state storage.
  • Implement the next-state logic using basic combinational logic gates.
  • The reset must be synchronous and active-high.
  • Do not use high-level arithmetic components like adders.

Topics

Gray CodeState MachineCounters

Solve this problem

Place the gates, wire them up and watch the signals settle. Every submission runs on the same simulation engine that grades it.

This problem is part of Codiode Pro. The statement above is free to read.

Sign in to solveSee what Pro unlocks

The circuit builder and code editor need a desktop screen. On a phone, read the problem here and open it on a laptop to solve.

Related problems

  • 3-bit Ripple Counter from Toggle Flip-FlopsEasy
  • D Latch from a 2:1 MUXEasy
  • 2-bit Ring CounterEasy
  • T Flip-Flop from a D Flip-FlopEasy
  • Handshake Deadlock Due to Early ResetHard
  • Reconvergence of Individually Synchronized BitsHard
  • Debug: Asynchronous Clear GlitchHard
  • Clock Gate Enable Crossing DomainsHard

Browse all problems · Learning tracks