# Unit-2 Combinational Circuit- DECO | BCA 2nd Sem

**Unit-2 Combinational Circuit- DECO | BCA 2nd Sem-** Hello everyone welcome to the pencilchampins.com website. This website provide Unit-2 Combinational Circuit- DECO Notes in BCA CCS University. Thankyou for visiting.

## Unit-2

## Combinational Building Block

### Meaning of Combinational Circuit

- Combinational Circuit building blocks are essential components in digital circuit design. These building blocks consist of logic gates that are interconnected to perform specific functions. Each logic gate takes one or more inputs and produces an output based on its internal operation. By combining different logic gates, complex digital circuits can be created to perform various tasks.
- commonly used combinational building block is the multiplexer. A multiplexer, also known as a data selector, selects one of many input lines and forwards it to the output line. It is controlled by a set of selection inputs that determine which input line is active. Multiplexers are widely used in data routing and signal switching applications.
- Another important building block is the decoder. A decoder takes a binary input and activates a specific output line based on the input value. It is commonly used in applications where multiple input combinations need to be decoded into individual outputs. Decoders are often used in memory address decoding and control signal generation.
- The third building block is the encoder. An encoder performs the opposite function of a decoder. It takes multiple input lines and generates a binary code output based on the active input line. Encoders are frequently used in applications such as data compression and error detection.
- Lastly, the comparator is a building block used to compare two binary numbers and determine their relationship (greater than, less than, or equal to). Comparators are widely used in arithmetic operations and decision-making circuits.

**Read more- **https://pencilchampions.com/unit-3-crm-strategy-bba-3rd-semester-notes/

### Half Adder

- A half adder is a fundamental building block in digital circuit design that performs basic addition operations on binary numbers. It takes two input bits, typically labeled as A and B, and produces two outputs: a sum bit (S) and a carry bit (C). The sum bit represents the result of the addition, while the carry bit indicates if there is an overflow from the addition.
- To understand how a half adder works, let’s break it down into its key components. It consists of two main parts: an XOR gate and an AND gate. The XOR gate, also known as an exclusive OR gate, produces an output of 1 when the inputs are different and 0 when they are the same. The AND gate, on the other hand, produces an output of 1 only when both inputs are 1; otherwise, it produces a 0.
- In a half adder, the XOR gate is used to calculate the sum bit (S). It takes the two input bits (A and B) and produces the sum by performing a bitwise addition. If the inputs are different, the XOR gate outputs a 1, indicating a sum of 1. If the inputs are the same, the XOR gate outputs a 0, indicating a sum of 0.
- The AND gate in the half adder is used to calculate the carry bit (C). It takes the two input bits (A and B) and produces the carry bit by performing a bitwise logical AND operation. If both inputs are 1, the AND gate outputs a 1, indicating a carry. If either or both inputs are 0, the AND gate outputs a 0, indicating no carry.
- By combining the outputs of the XOR gate and the AND gate, we get the final outputs of the half adder: the sum bit (S) and the carry bit (C). These outputs can then be used as inputs to higher-level adder circuits for more complex arithmetic operations.

**Wikipedia- **https://en.wikipedia.org/wiki/Combinational_logic

### Full Adder

- A full adder is a crucial component in digital circuit design that allows for the addition of three binary inputs: A, B, and a carry-in (C-in). It produces two outputs: a sum bit (S) and a carry-out (C-out). The sum bit represents the result of the addition, while the carry-out indicates if there is an overflow from the addition.
- Similar to a half adder, a full adder also consists of XOR and AND gates. However, it includes an additional OR gate to handle the carry-in. The XOR gates calculate the sum bit by performing bitwise addition on the inputs A, B, and the carry-in. The AND gates generate intermediate carry bits by performing logical AND operations on the inputs. The OR gate combines these intermediate carry bits with the carry-in to produce the final carry-out.
- To understand the operation of a full adder, let’s break it down step by step. First, the XOR gates calculate the sum bit by considering the inputs A, B, and the carry-in. If any two of these inputs are high (1), the XOR gate produces a high output, indicating a sum of 1. If only one or none of the inputs are high, the XOR gate outputs a low, indicating a sum of 0.
- Next, the AND gates generate intermediate carry bits by performing logical AND operations on the inputs. Each AND gate takes two inputs: one from the XOR gate and one from the carry-in. If both inputs are high, the AND gate outputs a high, indicating a carry. If either or both inputs are low, the AND gate outputs a low, indicating no carry.
- Finally, the OR gate combines the intermediate carry bits with the carry-in to produce the final carry-out. If any of the inputs (intermediate carry bits or carry-in) are high, the OR gate outputs a high, indicating a carry-out. If all inputs are low, the OR gate outputs a low, indicating no carry-out

### N-Bit Parallel Adder

- An N-bit parallel adder is a digital circuit that can perform the addition of N-bit binary numbers in parallel. It is a key component in arithmetic operations, allowing for efficient and fast addition of multiple binary values.
- In an N-bit parallel adder, each bit of the binary numbers is processed simultaneously, enabling the addition to be performed in parallel rather than sequentially. This results in faster computation times and increased efficiency.
- The N-bit parallel adder consists of multiple full adders connected in a cascading manner. Each full adder takes two input bits from the binary numbers being added and a carry-in bit from the previous stage. It produces a sum bit and a carry-out bit. The sum bits from each full adder form the final sum of the N-bit addition, while the carry-out bit from the last full adder represents the overflow or carry-out from the addition.
- By utilizing the parallel processing capability of the N-bit parallel adder, complex arithmetic operations can be performed efficiently, such as adding large numbers or performing multi-digit calculations. It is a fundamental component in digital circuit design and plays a vital role in various applications, including computer processors, calculators, and other arithmetic units.

### 4 Bit Parallel Adder

- A 4-bit parallel adder is a digital circuit that can add two 4-bit binary numbers together. It performs the addition operation in parallel, allowing for faster computation and efficient processing of binary values.
- The 4-bit parallel adder consists of four full adders connected in a cascading manner. Each full adder takes two input bits from the binary numbers being added and a carry-in bit from the previous stage. It produces a sum bit and a carry-out bit. The sum bits from each full adder form the final sum of the 4-bit addition, while the carry-out bit from the last full adder represents the overflow or carry-out from the addition.
- By utilizing the parallel processing capability of the 4-bit parallel adder, it becomes possible to add two 4-bit binary numbers simultaneously, reducing the overall computation time. This is particularly useful in applications where fast arithmetic operations are required, such as in computer processors, calculators, and other digital systems.

### N- Bit Parallel Sub-tractor

- An N-bit parallel sub-tractor is a digital circuit that performs subtraction operations on N-bit binary numbers in parallel. It is a fundamental component in digital arithmetic and plays a crucial role in various applications, including computer processors, calculators, and other arithmetic units.
- In an N-bit parallel sub-tractor, each bit of the binary numbers is processed simultaneously, allowing for faster computation. This is achieved by utilizing the concept of two’s complement representation. In two’s complement, negative numbers are represented by taking the complement of the positive number and adding 1. This representation simplifies the subtraction operation, as it allows for the addition of the two’s complement of the second number to the first number.
- The N-bit parallel sub-tractor consists of multiple full sub-tractors connected in a cascading manner. Each full sub-tractor takes two input bits from the binary numbers being subtracted and a borrow-in bit from the previous stage. It produces a difference bit and a borrow-out bit. The difference bits from each full sub-tractor form the final difference of the N-bit subtraction, while the borrow-out bit from the last full sub-tractor represents the borrow or underflow from the subtraction.
- By utilizing the parallel processing capability of the N-bit parallel sub-tractor, complex subtraction operations can be performed efficiently, such as subtracting large numbers or performing multi-digit calculations. It allows for faster computation and improved efficiency in digital arithmetic.

### 4 Bit Parallel Sub-tractor

- A 4-bit parallel subtractor is a digital circuit that performs subtraction operations on 4-bit binary numbers in parallel. It is similar to a 4-bit parallel adder, but with a slight modification to handle subtraction.
- In a 4-bit parallel subtractor, each bit of the binary numbers is processed simultaneously. It uses the concept of two’s complement representation to simplify the subtraction operation. To subtract one 4-bit binary number from another, we take the two’s complement of the number being subtracted and add it to the first number using a 4-bit parallel adder.
- The 4-bit parallel subtractor consists of four full subtractors connected in a cascading manner. Each full subtractor takes two input bits from the binary numbers being subtracted and a borrow-in bit from the previous stage. It produces a difference bit and a borrow-out bit. The difference bits from each full subtractor form the final difference of the 4-bit subtraction, while the borrow-out bit from the last full subtractor represents the borrow or underflow from the subtraction.
- By utilizing the parallel processing capability of the 4-bit parallel subtractor, subtraction operations can be performed efficiently, allowing for faster computation and improved efficiency in digital arithmetic.

### Half Sub-tractor

- A half subtractor is a fundamental digital circuit used for subtracting two single-bit binary numbers. It serves as the building block for more complex subtractors and plays a crucial role in digital arithmetic.
- The purpose of a half subtractor is to determine the difference between two binary numbers and whether a borrow or underflow occurs during the subtraction process. It takes two inputs, representing the bits of the numbers being subtracted, and produces two outputs: the difference bit and the borrow bit.
- The difference bit indicates the result of the subtraction operation. If the two input bits are different, the difference bit will be set to 1, indicating that subtraction has taken place. However, if the two input bits are the same, the difference bit will be 0, indicating that there is no difference between the numbers being subtracted.
- The borrow bit, on the other hand, indicates whether a borrow or underflow has occurred during the subtraction. If the second input bit is greater than the first input bit, a borrow occurs, and the borrow bit is set to 0. However, if the second input bit is smaller than or equal to the first input bit, no borrow occurs, and the borrow bit is set to 1.
- By utilizing half subtractors, more complex subtractors can be constructed to handle multi-bit subtraction operations. These circuits are essential in digital systems for performing arithmetic calculations, data manipulation, and various other applications.

### Full Sub-tractor

- A full subtractor is a digital circuit used to subtract two binary numbers, just like a half subtractor. However, unlike a half subtractor, a full subtractor can handle not only the current bit being subtracted but also the borrow or underflow from the previous bit.
- A full subtractor takes three inputs: the two bits being subtracted and a borrow bit from the previous subtraction. It produces two outputs: the difference bit and a new borrow bit.
- The difference bit represents the result of the subtraction, similar to the half subtractor. If the two input bits are different, the difference bit will be set to 1, indicating a subtraction has occurred. If the two input bits are the same, the difference bit will be 0, indicating no difference between the numbers being subtracted.
- The borrow bit, however, is where the full subtractor differs. It considers the borrow from the previous bit’s subtraction. If there is a borrow from the previous bit, or if the second input bit is greater than the first input bit, the borrow bit will be set to 0. This indicates that a borrow or underflow has occurred. If there is no borrow from the previous bit and the second input bit is smaller than or equal to the first input bit, the borrow bit will be set to 1, indicating no borrow or underflow.
- A full subtractor is an essential component in digital systems for performing accurate and efficient subtraction operations. It allows for the subtraction of multi-bit binary numbers by considering both the current bit and the borrow from the previous bit.

### Multiplexers

- A multiplexer, also known as a mux, is a digital circuit that combines multiple input signals into a single output signal. It acts like a data selector, choosing which input signal to pass through based on the control signals it receives.
- A multiplexer has two main components: the data inputs and the control inputs. The data inputs are the signals that you want to combine, and the control inputs determine which data input is selected. The number of data inputs and control inputs depends on the size of the multiplexer.
- Let’s say you have a 4-to-1 multiplexer, which means it has 4 data inputs and 2 control inputs. The control inputs determine which data input is connected to the output. For example, if the control inputs are set to “00,” the first data input is selected. If the control inputs are set to “01,” the second data input is selected, and so on.
- The selected data input is then passed through to the output, while the other data inputs are ignored. This allows you to choose which input signal is transmitted to the output based on the control inputs.
- Multiplexers are widely used in digital systems for various purposes. They can be used to reduce the number of wires required for transmitting multiple signals, conserve space on integrated circuits, and enable efficient data routing.
- In addition to data inputs and control inputs, multiplexers also have an output and sometimes an enable input. The enable input allows you to control whether the multiplexer is active or not. When the enable input is high, the multiplexer operates normally, but when it is low, the output is typically set to a predefined state, such as all zeros.

### De-multiplexers

- A demultiplexer, also known as a demux, is a digital circuit that performs the opposite function of a multiplexer. It takes a single input signal and distributes it to multiple output signals based on the control inputs it receives.
- Similar to a multiplexer, a demultiplexer has two main components: the input and the control inputs. The input is the signal you want to distribute, and the control inputs determine which output the input signal is directed to. The number of control inputs depends on the size of the demultiplexer.
- Let’s consider a 1-to-4 demultiplexer as an example. It has one input and two control inputs. The control inputs determine which output the input signal is directed to. For instance, if the control inputs are set to “00,” the input signal is directed to the first output. If the control inputs are set to “01,” the input signal is directed to the second output, and so on.
- The selected output receives the input signal, while the other outputs remain inactive. This allows you to distribute the input signal to specific outputs based on the control inputs.
- Demultiplexers are commonly used in digital systems for various purposes. They can be employed to route data to different destinations, enable efficient data distribution, and facilitate communication between different components of a system.
- In addition to the input and control inputs, demultiplexers may also have an enable input. The enable input allows you to control whether the demultiplexer is active or not. When the enable input is high, the demultiplexer operates normally, but when it is low, the outputs are typically set to a predefined state, such as all zeros.

### Decoder

- A decoder is a crucial component in digital circuits that takes coded inputs and produces specific outputs based on the input code. Its primary function is to decode the input code and provide a corresponding output.
- Decoders come in various types, each with its own unique purpose. One common type is the binary decoder, which takes binary-coded inputs and generates a single output line based on the input code. Another type is the decimal decoder, which decodes binary-coded decimal (BCD) inputs into corresponding decimal outputs.
- Priority encoders are also important. They assign priority to input lines based on their position and produce a binary output code indicating the highest priority input. Address decoders are used in memory systems to select specific memory locations based on input addresses.
- Another type is the 7-segment decoder, specifically designed for 7-segment displays. It maps binary input codes to the appropriate segments of the display to show desired digits or characters.
- Decoders are vital in digital systems for tasks such as data processing, memory management, display systems, and control systems. They enable efficient decoding of input codes and provide the desired outputs based on the input information

### Types of Decoder

- Binary Decoder: A binary decoder is the simplest type of decoder. It takes binary-coded inputs and produces a single output line based on the input code. For example, a 2-to-4 binary decoder takes two binary inputs and produces four output lines, with each output line corresponding to a specific input code.
- Decimal Decoder: A decimal decoder is used to decode binary-coded decimal (BCD) inputs into corresponding decimal outputs. BCD is a coding system that represents decimal numbers using a four-bit binary code. A 4-to-16 decimal decoder, for instance, takes a 4-bit BCD input and produces sixteen output lines, with each line representing a specific decimal digit.
- Priority Encoder: A priority encoder is a type of encoder that assigns priority to the input lines based on their position. It takes multiple inputs and produces a binary output code, indicating the highest priority input. Priority encoders are commonly used in applications where multiple inputs need to be prioritized, such as interrupt handling in microprocessors.
- 7-Segment Decoder: A 7-segment decoder is specifically designed to decode binary inputs into outputs that can be displayed on a 7-segment display. A 7-segment display is a common type of display that can represent decimal digits from 0 to 9 and some additional characters. The decoder maps the binary input code to the appropriate segments of the display to show the desired digit or character.
- Address Decoder: An address decoder is used in memory systems to select a specific memory location based on the input address. It takes a binary address as input and activates the corresponding memory location. Address decoders play a critical role in memory management and enable efficient access to specific memory locations.

### Encoder

- An encoder is a vital component in digital circuits that takes input signals and converts them into coded outputs based on specific encoding rules. Its primary function is to encode the input signals into a desired format for transmission or storage.
- Encoders come in various types, each with its own unique purpose. One common type is the binary encoder, which encodes multiple input lines into a binary code output. Another type is the priority encoder, which assigns priority to input lines and produces a binary output code indicating the highest priority input.
- There are also encoders designed for specific applications, such as the quadrature encoder used in rotary encoders to measure rotational position or speed. These encoders convert the mechanical motion into electrical signals that can be further processed by digital systems.
- Encoders play a crucial role in various fields, including telecommunications, computer systems, and digital media. They ensure accurate and efficient transmission of data by encoding signals into a suitable format for communication or storage purposes.

### Types of Encoder

- Binary Encoder: A binary encoder takes multiple input lines and encodes them into a binary code output. It assigns a unique binary value to each input combination, allowing for efficient data representation and transmission.
- Priority Encoder: A priority encoder assigns priority to input lines and produces a binary output code indicating the highest priority input. This type of encoder is commonly used in applications where multiple inputs need to be prioritized, such as interrupt handling in computer systems.
- Decimal Encoder: A decimal encoder converts binary-coded decimal (BCD) inputs into corresponding decimal outputs. It is particularly useful in applications where decimal representation is required, such as in digital displays or arithmetic operations.
- Gray Code Encoder: A Gray code encoder converts binary inputs into Gray code outputs. Gray code is a binary numeral system where adjacent codes differ by only one bit, reducing the possibility of errors during transitions between codes.
- Absolute Encoder: An absolute encoder provides a unique digital code for each position of a rotating shaft or linear motion. It directly measures the position without relying on incremental measurements, making it highly accurate and reliable.
- Incremental Encoder: An incremental encoder generates pulses that indicate relative position changes. It provides information about the direction and magnitude of movement, making it suitable for applications such as motor control and motion tracking.

### Discover more from

Subscribe to get the latest posts sent to your email.