Digital Electronics Combinational Logic Functions Digital logic circuits can be classified as either combinational or sequential circuits. A combinational circuit is one where the output at any time depends only on the present combination of inputs at that point of time with total disregard to the past state of the inputs. The logic gate is the most basic building block of combinational logic. The logical function performed by a combinational circuit is fully defined by a set of Boolean expressions. The other category of logic circuits, called sequential logic circuits, comprises both logic gates and memory elements such as flip-flops. Owing to the presence of memory elements, the output in a sequential circuit depends upon not only the present but also the past state of inputs. Block Diagram of Combinational Logic Circuit Above figure shows the block schematic representation of a generalized combinational circuit having n input variables and m output variables or simply outputs. Since the number of input variables is n, there are 2n possible combinations of bits at the input. Each output can be expressed in terms of input variables by a Boolean expression, with the result that the generalized system can be expressed by m Boolean expressions. General Design procedure for combinational logic circuits:
The design of combinational circuits starts from verbal outline of the problem and ends in a logic circuit diagram, or a set of Boolean functions from which the logic diagram can be easily obtained. The different steps involved in the design of a combinational logic circuit are as follows: 1. Statement of the problem. 2. Identification of input and output variables. 3. Expressing the relationship between the input and output variables. 4. Construction of a truth table to meet input output requirements. 5. Writing Boolean expressions for various output variables in terms of input variables. 6. Minimization of Boolean expressions. 7. Implementation of minimized Boolean expressions. Design and applications of Binary adders: Half Adder: A half adder is a combinational logic circuit that performs the arithmetic addition of two bits. Such a circuit thus has two inputs that represent the two bits to be added and two outputs, with one producing the SUM output and the other producing the CARRY. For Sum S: For Carry C:
The Boolean expressions for the SUM and CARRY outputs are given by the equations B Half Adder using NAND gates: Full Adder: A full adder circuit is an arithmetic circuit block that can be used to add three bits to produce a SUM and a CARRY output. Two of the input variables and represent the two significant bits to be added and the third input represents the carry from the previous lower significant position. X Y Z S C 0 0 0 0 0 0 0 1 1 0
0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1 1, 2, 4, 7 3, 5, 6, 7 Full adder using SOP Expressions: For Sum S: For Carry C: Full adder with two Half adders: Y Z From the truth table, Y
Full adder using NAND gates: Subtractors: In the method of subtraction, each subtrahend bit of the number is subtracted from its corresponding minuend bit to form a difference bit. If the minuend bit is smaller than the subtrahend bit, a 1 is borrowed from the next significant position. Half-Subtractor: A Half-Subtractor is a combinational circuit that can be used to subtract one binary digit from another to produce a DIFFERENCE output and a BORROW output. The BORROW output here specifies whether a 1 has been borrowed to perform the subtraction. X Y D B 0 0 0 0 0 1 1 1 1 0 1 0 1 1 0 0
Half-Subtractor using NAND gates: Full-Subtractor: A full subtractor performs subtraction operation on two bits, a minuend and a subtrahend, and also takes into consideration whether a 1 has already been borrowed by the previous adjacent lower minuend bit or not. This circuit has three inputs and two outputs. The three inputs,, and denote the minuend, subtrahend, and previous borrow, respectively. The two outputs, D and B represent the difference and output borrow, respectively. X Y Z D B 0 0 0 0 0 0 0 1 1 1 0 1 0 1 1 0 1 1 0 1 1 0 0 1 0 1 0 1 0 0 1 1 0 0 0 1 1 1 1 1 1, 2, 4, 7 1,2,3,7
For Difference D: For Borrow B: Full-Subtractor using two Half-Subtractors: Y Z From truth table, Y Full-Subtractor using NAND gates: Binary Parallel Adder:
A binary adder is a digital circuit that produces the arithmetic sum of two binary numbers. It can be constructed with full adders connected in cascade, with the output carry from each full adder connected to the input carry of the next full adder in the chain. FA FA FA FA Adder/Subtractor: Binary A Binary Adder/Subtractor is used to perform both addition and subtraction using a single circuit. Subtraction of two binary numbers can be accomplished by adding 2 s complement of the subtrahend to the minuend and disregarding the final carry, if any. Full adders can be used to perform subtraction provided we have the necessary additional hardware to generate 2 s complement of the subtrahend and disregard the final carry or overflow. For addition, the addend bits must be added with augend bits and for subtraction, 2 s complement of B is added with A. Hence Ex-OR gate is used as controlled inverter to achieve this operation.
The mode input determines the operation. With 0, the circuit acts as an adder and the outputs provide sum of the two numbers. When 1, the circuit acts as a subtractor and the output bits provide the difference of the two inputs. Comparators: The comparison of two numbers is an operation that determines if one number is greater than, less than, or equal to the other number. A magnitude comparator is a combinational circuit that compares two numbers, and, and determines their relative magnitudes. The outcome of the comparison is specified by three binary variables that indicate whether,,or. One Bit Comparator: The 1-bit comparator compares two 1 bit numbers and gives an output based on the magnitude of two bits. The truth table for the circuit is as shown: 0 0 0 1 0 0 1 0 0 1 1 0 1 0 0 1 1 0 1 0
4 Bit Magnitude Comparator: Consider two numbers, and, with four digits each. ; The two numbers are equal if all pairs of significant digits are equal, i.e., if and and and.the equality of the two numbers and, is displayed in a combinational circuit by an output variable that is designated as (. This binary variable is equal to 1 if the two input numbers and are equal, and it is equal to 0, otherwise. The binary variable ( is equal to 1 if all pairs of digits of the two numbers are equal. To determine if is greater than or less than, the relative magnitudes of pairs of significant digits is inspected starting from the most significant position.
If the two digits are equal, the next lower significant pair of digits is compared. This comparison continues until a pair of unequal digits is reached. If the corresponding digit of is 1 and that of is 0, we conclude that. If the corresponding digit of is 0 and that of is 1, we have that. The sequential comparison can be expressed logically by the following Boolean functions: The symbols and are binary output variables that are equal to 1 when or, respectively. Magnitude Comparator using 7485: Magnitude comparators are available in IC form. For example, 7485 is a four-bit magnitude comparator of the TTL logic family. The logic circuit inside these devices determines whether one four-bit number, binary or BCD, is less than, equal to or greater than a second four-bit number. It can perform comparison of straight binary and straight BCD (8-4-2-1) codes. These devices can be cascaded together to perform operations on larger bit numbers without the help of any external gates. This is facilitated by three additional inputs called cascading or expansion inputs available on the IC. These cascading inputs are also designated as A = B, A > B and A < B inputs.
The functional table for 7485 is as shown below: Cascading of Magnitude Comparators: Magnitude comparators available in IC form are designed in such a way that they can be connected in a cascade arrangement to perform comparison operations on numbers of longer lengths. In cascade arrangement, the A = B, A > B and A < B outputs of a stage handling less significant bits are connected to corresponding inputs of the next adjacent stage handling more significant bits. Also, the stage handling least significant bits must have a HIGH level at the A = B input. The other two cascading inputs (A > B and A < B) may be connected to a LOW level. Ex: Design an 8 bit magnitude comparator using 7485. Decoders: A decoder is a combinational circuit that converts binary information from input lines to a maximum of 2 unique output lines. If the -bit decoded information has unused or don t care combinations, the decoder output will have fewer
than2 outputs. The decoders are called -to- line decoders, where 2. Their purpose is to generate the 2 (or fewer) minterms of input variables. Decoder: In 3 8 decoder or 3-to-8 line decoder, the three inputs are decoded into eight outputs, each output representing one of the minterms of the 3 input variables. It is also known as binary to octal converter. The input variables may represent a binary number, and the outputs will then represent the eight digits in the octal number system. 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 1 0 1 1 1 0 0 0 0 0 0 0 1 Combinational Logic Implementation:
A decoder provides the 2 minterms of input variables. Since any Boolean function can be expressed in sum of minterms, one can use a decoder to generate the minterms and an external OR gate to form the sum. In this way, any combinational circuit with inputs and outputs can be implemented with an to-2 line decoder and OR gates. Example: Implement a Full adder using a decoder and OR gates. From the truth table of Full adder: 1, 2, 4, 7, 3, 5, 6, 7 Decoder with Enable Input: 1 1 1 1 1 0 0 0 0 1 1 1 0 0 1 1 0 1 1 0 1 0 1 1 0 1 0 1 1 1 1 1 0 Decoder using decoders:
Decoder circuits can be connected to form a larger decoder circuit. When 0, the top decoder is enabled and the other is disabled. The bottom decoder outputs are all 0 s, and the top eight outputs generate minterms 0000 to 0111. When 1, the bottom decoder is enabled and generate minterms 1000 to 1111, while the outputs of the top decoder are all 0 s. Encoders: An encoder is a digital circuit that performs the inverse operation of a decoder. An encoder has 2 (or fewer) input lines and output lines. The output lines generate the binary code corresponding to the input value. Octal to Binary Encoder: 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 1 1 1 1
Priority Encoder: A priority encoder is a practical form of an encoder. The encoders available in IC form are all priority encoders. In this type of encoder, a priority is assigned to each input so that, when more than one input is simultaneously active, the input with the highest priority is encoded. -to- line Priority Encoder: 1 0 0 0 0 0 1 0 0 0 1 1 0 1 0 1 1 1 K-map for : K-map for :
Multiplexers: Multiplexing means transmitting a large number of information units over a smaller number of channels or lines. A digital multiplexer is a combinational circuit that selects binary information from any of many input lines and directs it to a single output line. The selection of a particular input lie is controlled by a set of selection lines. Generally, there are 2 input lines and selection lines whose bit combinations determine which input is selected. Multiplexer: A 4 1 Multiplexer shown, consists of four input lines to, two select lines and. Y 0 0 0 1 1 0 1 1
Multiplexer with Enable: Multiplexers usually have an ENABLE input that can be used to control the multiplexing function. When this input is enabled, that is, when it is in logic 1 or logic 0 state, depending upon whether the ENABLE input is active HIGH or active LOW respectively, the output is enabled. The multiplexer functions normally. When the ENABLE input is inactive, the output is disabled and permanently goes to either logic 0 or logic 1 state, depending upon whether the output is un-complemented or complemented. Cascading of Multiplexers: Implement a 8 1 Multiplexer using two 4 1 multiplexers.
Combinational Logic Implementation: One of the most common applications of a multiplexer is its use for implementation of combinational logic Boolean functions. The simplest technique for doing so is to employ a 2n-to-1 MUX to implement an n-variable Boolean function. The input lines corresponding to each of the minterms present in the Boolean function are made equal to logic 1 state. The remaining minterms that are absent in the Boolean function are disabled by making their corresponding input lines equal to logic 0. 1. Implement,, 0,1,2,5,7 using a 8 1 Multiplexer. 2. Implement,, 1,3,5,6 using a 4 1 Multiplexer.
List the inputs of the multiplexer and under them list all the minterms in two rows. The first row lists all those minterms where is complemented, and the second row all the minterms with uncomplemented. Circle all the minterms of the function and inspect each column separately. If the two minterms in a column are not circled, apply 0 to the corresponding multiplexer input. If the two minterms are circled, apply 1 to the corresponding multiplexer input. If the bottom minterm is circled and the top is not circled, apply A to the corresponding multiplexer input. If the top minterm is circled and the bottom is not circled, apply A to the corresponding multiplexer input. Demultiplexer: A Demultiplexer is a circuit that receives information on a single line and transmits this information on one of 2 n possible output lines. The selection of a specific output line is controlled by the bit values of n selection lines. :
0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 1 1 0 1 0 0 1 0 0 0 0 0 0 1 0 1 0 0 1 0 1 1 0 0 0 0 0 1 1 1 0 0 0 1,,, Code Converters: A code converter is a combinational logic circuit that changes data presented in one type of binary code to another type of binary code. Binary to Gray Code Converter:
4 bit Binary to Gray code converter is a logic circuit which converts 4 bit Binary code to corresponding Gray code. 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 1 1 1 1 1 0 0 0 8, 9, 10, 11, 12, 13, 14, 15 4, 5, 6, 7, 8, 9, 10, 11 2, 3, 4, 5, 10, 11, 12, 13 1,2,5,6,9,10,13,14 By simplifying the above expressions using K maps, we get B B B Gray to Binary Code Converter: 4 bit Gray to Binary code converter is a logic circuit which converts 4 bit Gray code to corresponding Binary code.
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 G G G G G G BCD to Excess-3 Code Converter:
Parity Generator and Checker: When digital data is transmitted from one location to another, it is necessary to know at the receiving end, whether the received data is free of error. To help make the transmission accurate, special error detection methods are used. To detect errors, we must keep a constant check on the data being transmitted. To check accuracy we can generate and transmit an extra bit along with the message (data). This extra bit is known as the parity bit and it decides whether the data transmitted is error free or not. There are two types of parity bits, namely, even parity and odd parity. The circuit that generates the parity bit in the transmitter is called a parity generator. The circuit that checks the parity in the receiver is called a parity checker.
Even Parity Generator: X Y Z P 0 0 0 0 0 0 1 1 Y Z 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 Even Parity Checker: y z P
BCD Adder: A BCD adder is a combinational circuit that adds two BCD digits in parallel and produces a sum digit which is also in BCD. Add two 4-bit BCD numbers using straight binary addition. If the four bit sum is equal to or less than 9, the sum is in proper BCD form. If the four bit sum is greater than 9 or if a carry is generated from the sum, the sum is not in BCD form. In this case a correction is required that is obtained by adding the digit 6 (0110) to the sum produced by binary adder.
BCD Subtractor: In BCD subtraction, minuend is added with 9 s complement of subtrahend. The 9 s complement is obtained by using 9 1 1010 When minuend is added with 9 s complement of subtrahend, if there is a carry out, it must be added as an end around carry (EAC) and the result is a positive number. If there is no carry, the result is a negative number and hence 9 s complement of the result is formed to get the magnitude.
BCD Adder/Subtractor: When 0, the circuit acts an adder and when 1, the circuit acts as a Subtractor. Carry Look-ahead adder: The addition of two binary numbers in parallel implies that all the bits of the augend and the addend are available for computation at the same time. The total propagation time is equal to the propagation delay of a typical gate times the number of gate levels in the circuit. The longest delay time in a parallel adder is the time it takes the carry to propagate through the full-adders, known as carry propagation time. Consider the circuit of the full-adder and we define two new binary variables: The output sum and carry can be expressed as ; ;
is called a carry generate and it produces an output carry when both and are one, regardless of the input carry. is called a carry propagate because it is the term associated with the propagation of the carry from to Look-ahead carry generator: The three Boolean functions for, and are implemented in the look-ahead carry generator. does not have to wait for and to propagate; and it is propagated at the same time as and.
The carry look-ahead adder circuit with look-ahead carry generator is as shown.