Home › Practice › RTL Design › A dial that changes one bit at a time

A dial that changes one bit at a time

EasyRTLcombinational

A rotating knob reports its position in binary. Going from 7 (0111) to 8 (1000) flips four bits at once, and a reading taken in the middle of the flip can be garbage.

Concept first. Gray code is a way to number positions so that neighbouring numbers differ in exactly one bit. For 2 bits the order is 00, 01, 11, 10: each step changes one bit, even from the last back to the first. Because only one bit changes at a time, a reading caught mid-change is at worst off by one position, never wild. Work out the 3-bit Gray sequence by hand from the 2-bit one. Then put each binary number next to its Gray partner and look for a pattern that links a Gray bit to the binary bits around it.

What to build.

Solve in your browser →

No install and no sign-up needed. You write your answer in the editor and Nishkam checks it.

More in this track

← One circuit, two jobsReading the dial back →