Home / Learn Verilog / Gray-Code Counter
Gray-Code Counter
Counter with single-bit changes.
The gistCounter with single-bit changes.
The idea, explained simply
What it is
Count in binary, convert to Gray.
Why it matters
Safe pointers across clock domains.
Mechanically speaking
gray = bin ^ (bin >> 1).
Shows up in
- Everyday RTL design
- FPGA and ASIC projects
- Testbenches and debugging
Try it
Gray counterVerilog: edit and run
Only one bit differs from line to line.
Check yourself
1. Gray pointers are used for...
Single-bit change is safe.