Combinational Logic
Combinational Logic
COMBINATIONAL LOGIC
Ms.R.Gayathri,
Assistant Professor (Sr. Gr.)/ECE
COMBINATIONAL LOGIC INTRODUCTION
•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 n-input binary variables come from an external source; the m- output variables are
produced by the internal combinational logic circuit and go to an external destination.
Analysis & Design of combinational circuits
Steps to be followed:
• To obtain the output Boolean functions from a logic diagram.
• Label all gate outputs that are a function of input variables with arbitrary symbols or
names. Determine the Boolean functions for each gate output.
• Label the gates that are a function of input variables and previously labeled gates with
other arbitrary symbols or names. Find the Boolean functions for these gates.
• Repeat the process in step 2 until the outputs of the circuit are obtained.
• By repeated substitution of previously defined functions, obtain the output Boolean
functions in terms of input variables.
Logic diagram for analysis example:
• To obtain the truth table directly from the logic diagram without going through the
derivations of Boolean functions:
• Arithmetic circuits are the ones which perform arithmetic operations like addition,
Adders
• Adders are the basic building blocks of all arithmetic circuits; There are two types of
adders.
1. Half Adder.
2. Full Adder.
Half Adder
• A half-adder is an arithmetic circuit block that can be used to add two bits.
• Circuit 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.
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.
4-Bit Adder
• Chain single-bit adders together.
• What does this do to delay?
A
3B3 A
2B2 A
1B1 A
0B0
Full Adder
Full Adder
Full Adder
Full Adde
0
C C C
3 2 1
C
4 S
3 S
2 S
1 S
0
C 1 1 1 0
A 0 1 0 1
B 0 1 1 1
S 1 1 0 0
BCD Adder
• BCD addition is the same as binary addition with a bit of variation: whenever a sum
is greater than 1001, it is not a valid BCD number, so we add 0110 to it, to do the
correction. This will produce a carry, which is added to the next BCD position.
• Add the two 4-bit BCD code inputs.
• Determine if the sum of this addition is greater than 1001; if yes, then add 0110 to
this sum and generate a carry to the next decimal position
Subtractor
• Subtractor circuits take two binary numbers as input and subtract one binary number
input from the other binary number input. There are two types of subtractors,
1. Half Subtractor
2. full Subtractor
Half Subtractor
• The half-subtractor is a combinational circuit which is used to perform subtraction
of two bits. It has two inputs, X (minuend) and Y (subtrahend) and two outputs D
(difference) and B (borrow).
Full Subtractor
• A full subtractor is a combinational circuit that performs subtraction
involving three bits, namely minuend, subtrahend, and borrow-in. There are two
outputs, namely the DIFFERENCE output D and the BORROW output Bo.
4-bit Subtractor: E = 1
A3 B3 A2 B2 A1 B1 A0 B0
C4 SD 3 SD 2 SD 1 SD 0
• Magnitude comparators
– Compare two multi-bit binary numbers
• Multiplexers
– Select one out of several bits
• Design Approaches
– the truth table
2n
• 2 entries - too cumbersome for large n
28 = 256
Magnitude Comparator
A0 C0
B0 D01
A1 C1
B1 A_EQ_B Find A > B
A2 C2
B2
A3 C3 D23
B3
Because A3 > B3
– A = A3A2A1A0 ; B = B3B2B1B0
• (A=B) = x3x2x1x0
– xi = (AiBi'+Ai'Bi)’
Magnitude
Comparison
• Hardware chips
Magnitude Comparator
Real-world application
• Thermostat controller
Multiplexers
4 bit inputs
Multiplexer as combinational modules
• Connect input variables to select inputs of multiplexer (n-1 for n variables)
• Set data inputs to multiplexer equal to values of function for corresponding
assignment of select variables
• Using a variable at data inputs reduces size of the multiplexer
Implementing a Four- Input Function with a Multiplexer
• Binary decoders
– Converts an n-bit code to a single active output
• Binary encoders
– Converts one of 2n inputs to an n-bit output
n Binary
Decoder 2n outputs
inputs
2-to-4 Binary Decoder
Truth Table:
XY F0 F1 F2 F3
0 0 1 0 0 0
0 1 0 1 0 0 F0 = X'Y'
1 0 0 0 1 0
1 1 0 0 0 1
F1 = X'Y
• From truth table, circuit for
F2 = XY'
2x4 decoder is:
F6 = xyz'
F0
F1 F7 = xyz
X
F2
Y
3-to-8 F3
Z
Decoder F4
F5
F6
x y z
F7
Implementing Functions Using Decoders
• Any n-variable logic function can be implemented using a single n-to-2n decoder to generate
the minterms
– OR gate forms the sum.
– The output lines of the decoder corresponding to the minterms of the function are used as
inputs to the or gate.
• Any combinational circuit with n inputs and m outputs can be implemented with an n-to-2n
decoder with m OR gates.
• Suitable when a circuit has many outputs, and each output function is expressed with few
minterms.
Implementing Functions Using Decoders
x y z C S
• Example: Full adder 0 0 0 0 0
0 0 1 0 1
S(x, y, z) = S (1,2,4,7) 0 1 0 0 1
0 1 1 1 0
C(x, y, z) = S (3,5,6,7) 1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
3-to-8 0
Decoder 1 S
2
x S2 3
y 4
S1
5 C
z S0 6
7
Standard MSI Binary Decoders Example
74138 (3-to-8 decoder)
e.g. 2n-to-n
• The simplest encoder is a 2n-to-n binary encoder
– One of 2n inputs = 1
– Output is an n-bit binary number
Binary
2n encoder n
. .
inputs . . outputs
. .
8-to-3 Binary Encoder
At any one time, only Inputs Outputs
Alarm Contoller
Signal Response
Machine 1
Machine n
Thank you