4-bit binary to gray code converter.

**Step 1:** Truth table.

| Input (Binary) | Output (Gray code) | |----|----|

- | B3 | B2 | B1 | B0 | G3 | G2 | G1 | GO |
---|---|---|---|---|---|---|---|---|

0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |

1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 |

2 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 |

3 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 |

4 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |

5 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 1 |

6 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 |

7 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 |

8 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 |

9 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 |

10 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 1 |

11 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 1 |

12 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 0 |

13 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 |

14 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 1 |

15 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 |

$G_3 = \sum m$ (8,9,10,11,12,13,14,15)

$G_2 = \sum m$ (4,5,6,7,8,9,10,11)

$G_1 = \sum m$ (2,3,4,5,1011,12,13)

$G_0 = \sum m$ (1,2,5,6,9,10,13,14)

**Step 2:** Simplification using K-maps

K-Map for $G_3$

$\therefore G_3 = B_3$

K-map for $G_2$

$\therefore G_2 = B_3 B_2 + B_3 B_2$

=B3 + B2

K-map for $G_1$

$\therefore G_1 = B_2 B_1 + B_2 B_1$

= B2 + B1

K-map for $G_o$

$\therefore G_o = B_1 B_o + B_1 B_o$

= B1 + Bo

**Step 3:** Logic gate implementation.

4-bit BCD adder using IC 7483 and necessary gate.

ABCD adder is a circuit that adds two BCD digits in parallel and produces a sum digit which is also in BCD.

This adder has two 4-bit BCD inputs $X_3 X_2 X_1 X_0$ and $Y_3 Y_2 Y_1 Y_0$ and a carry input (in). It also has 4-bit sum output $(\sum_3 \sum_2 \sum_1 \sum_0)$ and carry output (out)

ABCD adder circuit must be able to do the following:

1] Add two 4-bit BCD numbers using straight binary addition.

2] If the 4-bit sum is equal to or less than 9, the sum is in proper BCD form and no correction is needed.

3] If the 4-bit sum is greater than 9 or if a carry is generated from the sum, the sum is not in BCD form. then, the digit 6(0110) should be added to the sum to produce the BCD results. The carry may be produced due to this addition and it is added to the next decimal position.

The outputs of adder 1 $(S_3 S_2 S_1 S_0)$ and (out) are checked to ascertain whether the output is greater than 9 by AND - OR gate combinations.

If correction is required, then a 0110 is added with the output of adder 1.

The adder 2 output forms the BCD result $(\sum_3 \sum_2 \sum_1 \sum_0)$ with carry output (out).