DigiFlop

XOR each bit with its neighbor and the ambiguity disappears.

Verilog Coding Exercise · Combinational I
Binary to Gray Code Converter
XOR each bit with its neighbor and the ambiguity disappears.

Converts a 4-bit binary value into Gray code, where only one bit ever changes between two consecutive values — the same property that makes Gray code safe for crossing clock domains.

Boolean expressionsG3=B3, G2=B3⊕B2, G1=B2⊕B1, G0=B1⊕B0
▶ Try the interactive version