Combinational Logic Circuits: Demultiplexers, Decoders, Encoders, Comparators, and Converters

Combinational Logic Circuits Fundamentals

This document details several fundamental combinational logic circuits: Demultiplexers (DEMUX), Decoders, Encoders, Comparators, and Code Converters. These circuits perform data distribution, decoding, encoding, comparison, and conversion without using memory elements.

1. Demultiplexer (Data Distributor)

A Demultiplexer (DEMUX) is a combinational logic circuit that takes one input and distributes it to one of many output lines. The selection of the output line is controlled by select lines. A demultiplexer works opposite to a multiplexer, so it is also called a data distributor.

Basic Idea of Demultiplexer

  • One input $\rightarrow$ many outputs.
  • Output selection is done using select lines.
  • If the number of select lines is $n$, the number of outputs is $2^n$.
  • Example: 2 select lines $\rightarrow$ 4 outputs (1:4 DEMUX).

Inputs and Outputs

  • Data Input: $D$
  • Select Lines: $S_0, S_1, \dots$
  • Outputs: $Y_0, Y_1, Y_2, \dots$

Only one output line carries the input data at a time.

1:2 Demultiplexer

Select line: $S$. Outputs: $Y_0, Y_1$.

  • Working: $S = 0 \rightarrow D$ goes to $Y_0$.
  • Working: $S = 1 \rightarrow D$ goes to $Y_1$.

Boolean Expressions:

  • $Y_0 = D \cdot S’$
  • $Y_1 = D \cdot S$

1:4 Demultiplexer

Select lines: $S_0, S_1$. Outputs: $Y_0$ to $Y_3$.

Working: Depending on the select line combination, input $D$ is transferred to one output.

$S_1$$S_0$Active Output
00$Y_0$
01$Y_1$
10$Y_2$
11$Y_3$

1:8 Demultiplexer

A 1:8 demultiplexer has:

  • One data input.
  • Three select lines ($S_0, S_1, S_2$).
  • Eight outputs ($Y_0$ to $Y_7$).

Working: Each combination of select lines selects one of the eight outputs to receive the input data.

1:16 Demultiplexer

A 1:16 demultiplexer has:

  • One input.
  • Four select lines.
  • Sixteen outputs ($Y_0$ to $Y_{15}$).

Working: Used in large digital systems where one input must be distributed to many outputs.

Cascaded Demultiplexer

Large demultiplexers can be constructed by connecting smaller demultiplexers together. Example: Two 1:4 demultiplexers can form a 1:8 demultiplexer. This method is called cascading.

Logic Implementation

A demultiplexer is implemented using:

  • AND gates.
  • NOT gates.

Each output is enabled by a unique combination of select lines.

Applications of Demultiplexers

  • Data distribution in digital systems.
  • Serial-to-parallel data conversion.
  • Communication systems.
  • Memory and device selection.
  • Used in CPU and control units.

Advantages of Demultiplexers

  • Simple circuit design.
  • Efficient data distribution.
  • Reduces wiring complexity.
  • Saves hardware cost.

2. Decoder

A Decoder is a combinational logic circuit that converts binary input data into a specific output line. It has $n$ input lines and $2^n$ output lines. For each input combination, only one output is activated (HIGH) while all others remain LOW. Decoders are mainly used for data decoding and selection.

Basic Concept of Decoder

  • $n$ inputs $\rightarrow 2^n$ outputs.
  • Only one output is active at a time.
  • Works opposite to an encoder.
  • Example: 2 inputs $\rightarrow$ 4 outputs (2:4 Decoder).

Inputs and Outputs

  • Input lines: $A, B, C, \dots$
  • Output lines: $Y_0, Y_1, Y_2, \dots$
  • Enable input (optional): Used to activate or deactivate the decoder.

2:4 Decoder

A 2:4 decoder has: Two inputs ($A, B$) and Four outputs ($Y_0$ to $Y_3$).

Truth Table:

$A$$B$Active Output
00$Y_0$
01$Y_1$
10$Y_2$
11$Y_3$

Each output represents a unique binary combination.

3:8 Decoder

A 3:8 decoder has:

  • Three inputs.
  • Eight outputs ($Y_0$ to $Y_7$).

Each output corresponds to one binary input combination from 000 to 111.

Logic Implementation

Decoders are implemented using:

  • AND gates.
  • NOT gates.

Each output is formed by ANDing inputs or their complements.

Applications of Decoder

  • Memory and address decoding.
  • Instruction decoding in CPU.
  • Data demultiplexing.
  • Seven-segment display driving.
  • Digital system control.

Advantages of Decoder

  • Simple circuit design.
  • Fast decoding operation.
  • Accurate output selection.
  • Reduces external logic.

3. Encoder

An Encoder is a combinational logic circuit that converts multiple input lines into a smaller number of output lines. It has $2^n$ input lines and $n$ output lines. Only one input is active at a time, and the encoder produces the corresponding binary code at the output. Encoders are mainly used for data compression and code generation.

Basic Concept of Encoder

  • $2^n$ inputs $\rightarrow n$ outputs.
  • Converts active input into binary code.
  • Works opposite to a decoder.
  • Example: 4 inputs $\rightarrow$ 2 outputs (4:2 Encoder).

Inputs and Outputs

  • Input lines: $I_0, I_1, I_2, I_3, \dots$
  • Output lines: $A, B, C, \dots$
  • Enable input (optional): Used to activate encoder.

4:2 Encoder

A 4:2 encoder has:

  • Four inputs ($I_0$ to $I_3$).
  • Two outputs ($A, B$).

Truth Table:

Active InputOutput ($AB$)
$I_0$00
$I_1$01
$I_2$10
$I_3$11

Only one input should be HIGH at a time.

8:3 Encoder

An 8:3 encoder has:

  • Eight inputs.
  • Three outputs.

Each active input is converted into its corresponding 3-bit binary code.

Priority Encoder

A Priority Encoder is an improved encoder in which priority is assigned to inputs. If more than one input is active, the encoder outputs the code of the highest-priority input. This overcomes the limitation of simple encoders.

Logic Implementation

Encoders are implemented using:

  • OR gates.
  • AND gates.

Each output is formed by ORing specific input lines.

Applications of Encoder

  • Keyboard encoding.
  • Data compression.
  • Interrupt handling.
  • Digital communication.
  • CPU and control systems.

4. Comparator

A Comparator is a combinational logic circuit used to compare two binary numbers. It determines whether one number is greater than, equal to, or less than the other. Comparators are widely used in digital systems for decision-making and control operations.

1-Bit Comparator

A 1-bit comparator compares two single-bit binary inputs $A$ and $B$.

Outputs: $A > B$, $A = B$, $A < B$.

Working:

  • If $A = 1$ and $B = 0 \rightarrow A > B$.
  • If $A = B \rightarrow A = B$.
  • If $A = 0$ and $B = 1 \rightarrow A < B$.

2-Bit Comparator

A 2-bit comparator compares two 2-bit binary numbers.

Working:

  • Comparison starts from the most significant bit (MSB).
  • If MSB bits are equal, the next bit is compared.
  • Final output decides whether $A > B$, $A = B$, or $A < B$.

It is made by combining multiple 1-bit comparators.

N-Bit Comparator

An N-bit comparator compares two binary numbers of any length (4-bit, 8-bit, etc.).

Working:

  • Built by cascading 1-bit comparators.
  • MSB has the highest priority.
  • Used for large binary number comparison (e.g., 4-bit and 8-bit comparators in processors).

Magnitude Comparator

A Magnitude Comparator determines the magnitude relationship between two numbers.

Outputs: $A > B$, $A = B$, $A < B$.

This type of comparator is commonly used in ALU and CPU circuits.

Equality Comparator

An Equality Comparator checks only whether two numbers are equal or not.

Outputs: $A = B$, $A \neq B$.

It is used where only equality checking is required, such as password checking and matching operations.

Applications of Comparators

  • CPU and ALU operations.
  • Digital counters.
  • Sorting and searching circuits.

5. Code Converter

A Code Converter is a combinational logic circuit that converts data from one type of binary code into another type of binary code. It changes the representation of information without changing its value. Code converters are widely used in digital systems for data processing, display, and communication.

Basic Concept of Code Converter

  • Converts one binary code into another.
  • Input and output codes represent the same information.
  • It is a combinational circuit (no memory).
  • Example: Binary $\rightarrow$ Gray code, BCD $\rightarrow$ Excess-3 code.

Need for Code Converters

Code converters are required because:

  • Different digital devices use different codes.
  • To make data suitable for processing or display.
  • To reduce errors and simplify circuit operations.

Types of Code Converters

Binary to Gray Code Converter
  • Converts binary numbers into Gray code.
  • In Gray code, only one bit changes at a time.
  • Used to reduce errors in digital systems.
Gray to Binary Code Converter
  • Converts Gray code back to binary code.
  • Used where Gray code is received but binary processing is required.
BCD to Binary Converter
  • Converts Binary Coded Decimal (BCD) into pure binary.
  • Used in calculators and digital displays.
Binary to BCD Converter
  • Converts binary numbers into BCD format.
  • Useful for decimal display systems.
BCD to Excess-3 Converter
  • Converts BCD code into Excess-3 code.
  • Excess-3 is a self-complementing code.
  • Used in arithmetic operations.

Logic Implementation

Code converters are implemented using:

  • AND gates.
  • OR gates.
  • NOT gates.

Boolean expressions are derived using truth tables.

Applications of Code Converters

  • Digital displays.
  • Calculators.
  • Communication systems.
  • Data encoding and decoding.
  • Computer and microprocessor systems.