Design and implement Binary – to – Gray code converter.

Binary, Decimal and Gray Code Table:
Here I am representing gray code bits with A, Decimal values with D and Binary bits with B.


Binary to Gray Code Converter:
This same technique can be applied to make gray to binary converter. There will be 4 input bits, which represent binary and 4 output bits which represent equivalent gray code.
Since we are creating binary to gray code converter so, we need to find expressions for each gray code output in terms of input binary bits.
So, there will be four output bits A_3, A_2, A_1, A_0 . For these output bits the input will be different combinations of B_3, B_2, B_1, B_0  based on minimized expression.

Karnaugh Maps:

A3:



4 bit binary to gray code A3 expression
4 bit binary to gray code A3 expression

Minimized expression from the above k map,
A_3 = B_3

A2:



4 bit binary to gray code A2 k map
4 bit binary to gray code A2 k map

Minimized expression from the above k map,
A_2 = B_3 \overline{B_2} + B_2 \overline{B_3}
But, the expression of XOR Gate is (Let, A and B be the inputs),
A.\overline{B} + B.\overline{A} = A \oplus B
[Note: This is not related to this problem but, only showing how XOR can be made from And, Or, Not gates]
Similarly,it can be shown that,
B_3 \overline{B_2} + B_2 \overline{B_3} = B_2 \oplus B_3
If XOR gate is not available then the former expression can be used with and, or and not gates to design the gray code converter.

A1:



4 bit binary to gray code A1 k map
4 bit binary to gray code A1 k map

Minimized expression from the above k map,
A_1 = B_1 \overline{B_2} + B_2 \overline{B_1}
Similarly,it can be shown that,
B_1 \overline{B_2} + B_2 \overline{B_1} = B_1 \oplus B_2

A0:



4 bit binary to gray code A0 k map
4 bit binary to gray code A0 k map

Minimized expression from the above k map,
A_0 = B_0 \overline{B_1} + B_1 \overline{B_0}
Similarly,it can be shown that,
B_0 \overline{B_1} + B_1 \overline{B_0} = B_0 \oplus B_1

Circuit Diagram using XOR gates:


4 bit binary to Gray Code Converter using XOR gates
4 bit binary to Gray Code Converter using XOR gates


Circuit Diagram without using XOR gates:


4 bit binary to Gray Code Converter without using XOR gates
4 bit binary to Gray Code Converter without using XOR gates