×

Index

Software Engineering Tutorial

Discrete Mathematics Tutorial

Digital Electronics Tutorial

Construction of Code Converters

In this tutorial, we will learn about the Construction of Code Converters: Designing of Binary to Gray Code converter, Designing of Gray to Binary Code converter. By Saurabh Gupta Last updated : May 11, 2023

In this article, we are going to read about how these code converters are designed and are implemented inside the system?

1. Designing of Binary to Gray Code converter

4-bit binary to gray code converter converts a 4-bit binary number to 4-bit gray code. Binary numbers are provided as input in the form of B3 B2 B1 B0 (MSB is the leftmost and LSB is the rightmost) and we get output in the form of Gray code as G3 G2 G1 G0 (MSB is the leftmost and LSB is the rightmost). Thus, the code converter is equivalent to four different logic circuits. One for each of the truth table. The next step is to derive simplified Boolean expressions for each truth table using the K-Map and then we can get the relation between input and output.

Let's create a conversion table that stores the inputs and their corresponding output for all possible cases of the 4-bit binary number.

Input (Binary Code) Output (Gray Code)
B3 B2 B1 B0 G3 G2 G1 G0
00000000
00010001
00100011
00110010
01000110
01010111
01100101
01110100
10001100
10011101
10101111
10111110
11001010
11011011
11101001
11111000

From the truth table, we can observe that,

  1. The values in G4 are exactly the same as B4, thus we can get G4 = B4.
  2. The values in G3 is actually the output of XOR operation between the B4 and B3. Thus, G3 = B3 B3.
  3. The values in G2 is actually the output of XOR operation between the B3 and B2. Thus, G2 = B2 B2.
  4. The values in G1 is actually the output of XOR operation between the B2 and B1. Thus, G1 = B1 B1.

We can verify our observation by solving and obtaining Boolean expression from the K-Map for each of Gray code bits, we already know by convention 1s are the minterms for K-Maps, thus K-map can be solved as,

Construction of Code Converters (1) Construction of Code Converters (2) Construction of Code Converters (3) Construction of Code Converters (4)

Thus, the logic circuit for 4-bit Binary to Gray code can be drawn as,

Construction of Code Converters (5)

2. Designing of Gray to Binary Code converter

Gray code to Binary code converter can be designed in the same procedure as we have followed above. For all the possible cases of input (4-bit Gray code) G3 G2 G1 G0, we need to obtain simplified expressions for output (4-bit Binary code) B3 B2 B1 B0 by solving the K-Map. All possible inputs and outputs can be summarized in a truth table as,

Gray Code (Input) Binary Code (Output)
G3 G2 G1 G0 B3 B2 B1 B0
00000000
00010001
00100011
00110010
01000111
01010110
01100100
01110101
10001111
10011110
10101100
10111101
11001000
11011001
11101011
11111010

Solving K-Map to get the required Boolean expressions,

Construction of Code Converters (6) Construction of Code Converters (7) Construction of Code Converters (8) Construction of Code Converters (9)

Logic Diagram for Gray to Binary converter can be drawn as,

Construction of Code Converters (10)


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.