The problem
Standard binary-to-Gray conversion is normally done with XOR: G3=B3, G2=B3⊕B2, G1=B2⊕B1, G0=B1⊕B0. That formula is correct for a full 4-bit binary input (0-15). But a BCD digit only ever takes values 0-9 — codes 10 through 15 are impossible — which opens the door to simplifying beyond the generic XOR formula, for at least some of the four bits.
| Digit | BCD | Gray (G3 G2 G1 G0) |
|---|---|---|
| 0 | 0000 | 0000 |
| 1 | 0001 | 0001 |
| 2 | 0010 | 0011 |
| 3 | 0011 | 0010 |
| 4 | 0100 | 0110 |
| 5 | 0101 | 0111 |
| 6 | 0110 | 0101 |
| 7 | 0111 | 0100 |
| 8 | 1000 | 1100 |
| 9 | 1001 | 1101 |
G3 and G2: don't-cares do real work
G3 is trivial — it's always just B3 directly, no gates needed at all. G2 is the interesting one:
That's a 2-input OR gate — no XOR required. Checked against every valid BCD digit (0-9), it produces exactly the same output as the full XOR formula B3⊕B2 would. The two only disagree on codes 10-15, which is precisely why the simplification is valid here: those codes are declared don't-care, so it doesn't matter that the simplified version behaves differently there. Outside the guaranteed-valid range, "simpler" and "correct" quietly diverge — which is the whole reason don't-cares need to be genuine impossibilities, not just convenient guesses.
G1 and G0: no simplification available, and that's normal
The lower two bits don't get the same benefit:
G0 = B1′B0 + B1B0′ (i.e. B1 ⊕ B0)
Both reduce to exactly the standard XOR formula, don't-cares included — because the required 1s and 0s for these two bits are checkerboarded across the map in a way that don't-cares can't help consolidate into larger groups. This is a useful thing to internalize: don't-cares help when they sit adjacent to cells that would otherwise be small isolated groups. If the required pattern is inherently XOR-shaped, no amount of don't-care flexibility changes that — XOR is famously the case K-maps can't simplify around (see the parity checker example for the extreme version of this).
Try G2 live below
The solver is pre-loaded with G2's actual truth table. Try clearing the don't-cares (set 10-15 back to 0) and watch the expression grow back into the full XOR form — a direct, hands-on way to see exactly what the don't-cares were doing.