ScholarQuill logoScholarQuillUniversity Notes
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
Study Tools
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
Contact
ScholarQuill logo
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
ScholarQuill logoScholarQuillUniversity Notes
Study PortalCSI-306Combinational Logic De…
Ctrl + K
Login
Explore
Search
Semester
Papers
CGPA
    CSI-306

    Digital Logic Design

    Progress0 / 47 done
    Topics47
    1Overview of Binary Numbers2Boolean Algebra3Switching Algebra4Logic Gates5Karnaugh Map6Quin-McCluskey Methods7Simplification of Boolean Functions
    8Two-Level NAND/NOR Implementation9Tabular Minimization
    10Adders11Subtracters12Code Converters13Parity Checkers14Multilevel NAND/NOR/XOR Circuits15MSI Components16Design and Use of Encoders17Design and Use of Decoders18Design and Use of Multiplexers19BCD Adders20Comparators21Latches and Flip-Flops22Synchronous Sequential Circuit Design and Analysis23Registers24Synchronous and Asynchronous Counters25Memories26Control Logic Design27Wired Logic and Characteristics of Logic Gate Families28ROMs29PLDs30PLAs31State Reduction and Good State Variable Assignments32Algorithmic State Machine (ASM) Charts33Asynchronous Circuits34Memory Systems35Functional Organization36Multiprocessor and Alternative Architectures37Introduction to SIMD38Introduction to MIMD39Introduction to VLIW40Introduction to EPIC41Systolic Architecture42Interconnection Networks43Shared Memory Systems44Cache Coherence45Memory Models and Memory Consistency46Performance Enhancements47Contemporary Architectures
    9 min read
    Topic 12 of 47
    Topic Study Note Illustration
    12

    Combinational Logic Design: Code Converters

    Code converters are combinational circuits used to convert a number or code from one form to another. In digital electronics, different representations of numbers or data are...

    Combinational Logic Design: Code Converters

    Code converters are combinational circuits used to convert a number or code from one form to another. In digital electronics, different representations of numbers or data are used for various applications, and code converters facilitate the conversion between these different coding schemes. These conversions are vital for a variety of systems, such as arithmetic operations, data transmission, and data storage.

    1. Types of Code Converters

    Some of the common types of code converters are:

    • Binary to Gray Code Converter
    • Gray Code to Binary Converter
    • BCD (Binary Coded Decimal) to Binary Converter
    • Binary to BCD Converter
    • Excess-3 Code to Binary Converter
    • Binary to Excess-3 Converter

    We will explore some of these converters in detail.


    2. Binary to Gray Code Converter

    The Gray Code is a binary numeral system where two successive values differ in only one bit. It is used in applications where minimizing errors due to bit changes is important, such as in digital encoders (e.g., rotary encoders).

    Binary to Gray Code Conversion

    To convert from binary to Gray code, the most significant bit (MSB) of the binary number is the same in the Gray code, and each subsequent bit in the Gray code is calculated as the XOR of the corresponding bit in the binary number and the previous bit in the binary number.

    Steps for Conversion:

    1. The MSB of the Gray code is equal to the MSB of the binary number.
    2. For each subsequent bit, the corresponding Gray code bit is calculated as the XOR of the binary bit and the previous binary bit.

    Example:

    Convert the binary number 1011 to Gray code:

    1. MSB (Gray) = MSB (Binary) → 1
    2. Second bit: G2=B2⊕B1=0⊕1=1G_2 = B_2 \oplus B_1 = 0 \oplus 1 = 1G2​=B2​⊕B1​=0⊕1=1
    3. Third bit: G3=B3⊕B2=1⊕0=1G_3 = B_3 \oplus B_2 = 1 \oplus 0 = 1G3​=B3​⊕B2​=1⊕0=1
    4. Fourth bit: G4=B4⊕B3=1⊕1=0G_4 = B_4 \oplus B_3 = 1 \oplus 1 = 0G4​=B4​⊕B3​=1⊕1=0

    So, the Gray code for 1011 (binary) is 1110 (Gray code).

    Circuit Design for Binary to Gray Code Converter:

    The circuit for converting a binary number to Gray code typically involves XOR gates. Here's how you can design it for a 4-bit number:

    • The first Gray bit (MSB) is the same as the binary MSB.
    • Each subsequent Gray bit is the XOR of two adjacent binary bits.

    Circuit Diagram for a 4-bit Binary to Gray Converter:

    Binary Input: B3 B2 B1 B0
    
    Gray Code Output: G3 G2 G1 G0
    
    G3 = B3
    G2 = B3 ⊕ B2
    G1 = B2 ⊕ B1
    G0 = B1 ⊕ B0
    

    For each of the XOR gates:

    • The input to the XOR gates would be the respective bits from the binary input.
    • The Gray code outputs are generated as shown above.

    3. Gray Code to Binary Converter

    In a Gray code to binary converter, the goal is to reverse the process used to convert binary to Gray code. Given a Gray code, the conversion is done by the following method:

    1. The MSB of the binary number is the same as the MSB of the Gray code.
    2. For each subsequent bit, the corresponding binary bit is the XOR of the previous binary bit and the current Gray code bit.

    Steps for Conversion:

    1. MSB (Binary) = MSB (Gray)
    2. For each subsequent bit, the binary bit is calculated by XORing the previous binary bit with the current Gray code bit.

    Example:

    Convert the Gray code 1110 to binary:

    1. MSB (Binary) = MSB (Gray) → 1
    2. Second bit: B2=G2⊕B1=1⊕1=0B_2 = G_2 \oplus B_1 = 1 \oplus 1 = 0B2​=G2​⊕B1​=1⊕1=0
    3. Third bit: B3=G3⊕B2=1⊕0=1B_3 = G_3 \oplus B_2 = 1 \oplus 0 = 1B3​=G3​⊕B2​=1⊕0=1
    4. Fourth bit: B4=G4⊕B3=0⊕1=1B_4 = G_4 \oplus B_3 = 0 \oplus 1 = 1B4​=G4​⊕B3​=0⊕1=1

    So, the binary equivalent of Gray code 1110 is 1011.

    Circuit Design for Gray Code to Binary Converter:

    The circuit involves XOR gates, and the conversion for a 4-bit Gray code would be as follows:

    Circuit Diagram for a 4-bit Gray Code to Binary Converter:

    Gray Code Input: G3 G2 G1 G0
    
    Binary Output: B3 B2 B1 B0
    
    B3 = G3
    B2 = G2 ⊕ B3
    B1 = G1 ⊕ B2
    B0 = G0 ⊕ B1
    

    Here, each XOR gate takes the current Gray code bit and the previous binary bit as inputs to generate the corresponding binary bit.


    4. BCD to Binary Converter

    BCD (Binary Coded Decimal) is a form of binary encoding where each decimal digit is represented by a 4-bit binary number. For example, the decimal digit 9 is represented in BCD as 1001.

    To convert a BCD number to binary, we simply need to treat each 4-bit BCD group as a separate binary number and combine them to form the complete binary number.

    Example:

    Convert the BCD number 0001 0010 0011 (BCD representation of 123) to binary:

    • The first BCD digit 0001 is 1 in decimal, which is 0001 in binary.
    • The second BCD digit 0010 is 2 in decimal, which is 0010 in binary.
    • The third BCD digit 0011 is 3 in decimal, which is 0011 in binary.

    So, the binary equivalent of BCD 0001 0010 0011 is 0001 0010 0011 (which is 123 in decimal).

    Circuit Design for BCD to Binary Converter:

    A simple BCD to binary converter involves directly mapping the 4-bit BCD digits to their corresponding binary values.


    5. Binary to BCD Converter

    A Binary to BCD converter takes a binary number and converts it into its BCD representation. This process can be done using a method called double-dabble or digit-by-digit conversion, where the binary number is processed in stages and each digit is separately converted into BCD.

    The steps involved are:

    1. Take the binary number and separate it into groups of 4 bits.
    2. Convert each group to its decimal equivalent, which is then encoded as BCD.
    3. Shift and adjust the binary number to account for any carries and overflow.

    Example:

    Convert the binary number 1011 (11 in decimal) into BCD:

    • Divide the number into groups of 4 bits: 1011.
    • Convert 1011 into BCD: 0001 0001 (BCD representation of 11).

    Thus, 1011 (binary) equals 0001 0001 (BCD).

    Circuit Design for Binary to BCD Converter:

    For a 4-bit binary to BCD converter, the circuit would typically involve a shift register and adders to compute the corresponding BCD digits.


    6. Excess-3 Code Converter

    Excess-3 code is a binary-coded decimal (BCD) code in which each decimal digit is represented by the 4-bit binary number that is 3 greater than the corresponding decimal value.

    Example:

    For decimal digit 5, the Excess-3 code would be 1000 because 5+3=85 + 3 = 85+3=8, which is 1000 in binary.

    To convert a decimal number to Excess-3 code:

    • Add 3 to each decimal digit, then convert the result to binary.

    Circuit Design for Excess-3 to Binary Converter:

    The conversion can be done by first subtracting 3 from each Excess-3 digit and then converting the result to binary.


    7. Applications of Code Converters

    Code converters are used in a wide range of applications:

    • Data Communication: For data transmission, data often needs to be converted into formats that minimize transmission errors (e.g., Gray code in rotary encoders).
    • Data Storage: Converting binary data to BCD or Excess-3 formats for storage in digital systems.
    • Arithmetic Operations: Converting between different numeric representations (e.g., binary to BCD for decimal arithmetic).
    • Display Systems: Code converters are used in digital displays, where binary or BCD codes are converted for visual representation.

    Conclusion

    Code converters are essential in digital systems for converting between different types of numerical representations. Examples include converting binary to Gray code, BCD to binary, and Excess-3 to binary. These converters help in reducing errors, facilitating arithmetic operations, and ensuring compatibility between different systems. The design of these converters involves using basic combinational logic gates like XOR, AND, and OR gates to perform the required operations.

    ← Previous topic 11
    Combinational Logic Design: Subtracters
    Next topic 13 →
    Combinational Logic Design: Parity Checkers

    Past Papers

    Open this section to view and download past papers

    Click on Show Past Papers to load available exam papers.

    Reading Progress
    0%
    9mremaining
    1.5kwords
    Intermediatelevel
    On This Page

    No headings found

    Study Toolkit

    Subject Portal

    Digital Logic Design