Counters and pointers cross clock domains constantly, and a binary counter changes several bits at once. Gray coding changes one bit per step, so a sample taken mid-change is at worst the old or the new value, never a mixture. These four lessons state that rule exactly, build a Gray counter, list where Gray fails, and cover non-power-of-two depths.
Lesson | After it you can... |
|---|---|
State exactly when a Gray sample is safe and what stale means. | |
Build a registered Gray counter and prove its steps exhaustively. | |
Spot jumps, skips and post-conversion logic that break the rule. | |
Say why odd depths can never cycle and what to do instead. |
Study in order: the rule, then the counter, then the failure modes, then the depth limits.
The binary sample can show any mixture of old and new bits, a value that never existed. A Gray counter changes one bit per step, so the sample shows the old or the new value only.