Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11
Code conversions
Code converters
Code conversion is used to change the data present in one type
of binary code to another type of binary code.
Some of the conversions are
Binary to Gray code conversion
Gray to Binary code conversion Binary to Gray code conversion
The Gray code is non-weighted code, as the position of bit does
not contain any weight. The Gray code is a reflective digital code which has the special property that any two subsequent numbers codes differ by only one bit. This is also called a unit- distance code. The generation of 4-bit Gray code can be calculated by using formula. G1 = B1 G2 = B1ÅB2 G3 = B2ÅB3 G4 = B3ÅB4 The most significant bit (MSB) of the Gray code is always equal to the MSB of the given binary code other bits of the output Gray code can be obtained by Xoring binary code bit at that index and previous index. The binary to Gray code conversions can be done by using xoring logic gate. A four-bit binary code converter is shown above. The input is binary code and the output is equivalent Gray code. A four-bit binary to Gray code conversion table is as shown below. Four Bit Binary Number Four Bit Gray Code B1 B2 B3 B4 G1 G2 G3 G4 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 1 1 0 0 1 1 0 0 1 0 0 1 0 0 0 1 1 0 0 1 0 1 0 1 1 1 0 1 1 0 0 1 0 1 0 1 1 1 0 1 0 0 1 0 0 0 1 1 0 0 1 0 0 1 1 1 0 1 1 0 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 0 0 1 0 1 0 1 1 0 1 1 0 1 1 1 1 1 0 1 0 0 1 The circuit for Binary to Gray code conversion is Gray to binary code conversion
In Gray to binary conversion, the input is Gray code and output
is its equivalent binary code. The generation of four-bit binary equivalent code can be calculated by using formula. B1 = G1 B2 = G2 Å B1 B3 = G3 Å B2 B4 = G4 Å B3 The MSB of binary code is similar to the MSB of Gray code. To get next bit, use the xoring operation among the MSB of binary to the next bit of the Gray code. Similarly, to get the third bit, it uses the xoring operation among the second bit to the third MSB of the Gray code and so on. The Gray to binary conversion method can be done by using xoring logic gate. A four-bit Gray to binary code converter is as shown below. A four-bit Gray to binary code conversion table is as shown below. Four Bit Gray Code Four Bit Binary Number G1 G2 G3 G4 B1 B2 B3 B4 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 1 0 0 1 0 0 0 1 0 0 0 1 1 0 1 1 0 0 1 0 0 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1 0 0 1 0 0 0 1 1 1 1 1 0 0 1 0 0 0 1 1 0 1 1 0 0 1 1 1 1 1 1 0 1 0 1 1 1 0 1 0 1 1 1 0 1 0 1 1 0 0 1 0 1 1 1 1 0 1 1 0 0 1 1 1 1 0 1 0 0 0 1 1 1 1
Mastering Kubernetes Large scale container deployment and management 1st Edition Gigi Sayfan - Download the ebook now for an unlimited reading experience
Mastering Kubernetes Large scale container deployment and management 1st Edition Gigi Sayfan - Download the ebook now for an unlimited reading experience