Topic 2
Topic 2
❑ It provides a framework for working with binary variables and logical operations, forming the
foundation of modern digital electronics.
❑ Cost of the circuits is an important aspect and finding simpler and cheaper equivalent circuits helps in
reducing the cost.
❑ Boolean algebra aids in designing and optimizing digital circuits by simplifying complex expressions.
LOGICAL OPERATORS
❑ Binary Variables:
In digital electronics, information is represented using binary variables: 0 (False) and 1 (True). Boolean
algebra operates on these binary variables to derive logical outcomes.
❑ Logical Operations:
Fundamental logical operators:
AND: Represents logical conjunction, denoted by ∧.
OR: Represents logical disjunction, denoted by ∨.
NOT: Represents logical negation, denoted by ¬.
AND operator
A B X A.B or AB or A∧B
0 0 0
0 1 0
1 0 0
1 1 1
LOGICAL OPERATORS
OR operator
A B X A + B or A ∨ B
0 0 0
0 1 1
1 0 1
1 1 1
NOT operator
A X A’ or A or ¬A
0 1
1 0
0 0 0 1 0 1
Using truth table verify that (A + B)’ = A’ + B’.
0 0 1 1 0 1
0 1 0 1 0 1
0 1 1 1 1 1
1 0 0 0 0 0
1 0 1 0 0 0
1 1 0 0 0 0
1 1 1 0 1 1
❑ If the output of a Boolean expression is always TRUE it is called a Tautology and if its always FALSE it is
called a FALLACY.
Tautology
❑ Boolean Expression – A + A’, A + (AB)’
A.A’ Fallacy
BOOLEAN ALGEBRA - BASICS
0+A=A, 0. A = 0
1 + A = 1, 1.A = A
DUALITY PRINCIPLE
❑ Associative Law
i) (A + B) + C = A + (B + C)
ii) (A.B).C = A.(B.C)
❑ Distributive Law
i) A.(B + C) = A.B + A.C
ii) A + B.C = (A + B).(A + C) R.H.S = (A + B).(A + C) = A.A + A.C + B.A + B.C
iii) A + A’B = A + B = A .(1 + C) + B.A + B.C
L.H.S = A + A’B = (A + A’).(A + B)
= 1. (A + B) = A += B
A + B.A + B.C
= A.(1 + B) + B.C
❑ Idempotence (Identity) Law = A + B.C
i) A + A = A
ii) A.A = A
BOOLEAN ALGEBRA BASIC THEOREMS
❑ Absorption (Redundance) Law
i) A + A.B = A A.(1 + B) = A.1 = A
ii) A.(A + B) = A A.A + A.B = A + A.B = A
❑ Complementary Law
i) A + A’ = 1
ii) A.A’ = 0
❑ Involution Law
A” = A
(A.B)’ = A’ + B’
❑ The complement of a sum of variables is equal to the product of the complements of the variables.
(A + B)’ = A’.B’
❑ De Morgan’s Theorems also apply to expressions with more than two variables.
We know that X + X’ = 1
If X = A + B then (A + B) + (A + B)’ should be equal to 1
and if (A + B)’ = A’.B’ then (A + B) + A’.B’ should also be equal to 1.
❑ (A.B)’ = A’ + B’
We know that X.X’ = 0
If X = A.B then (A.B).(A.B)’ should be equal to 0
and if (A.B)’ = A’ + B’ then (A.B).(A’ + B’) should also be equal to 0.
❑ For a particular Boolean expression you can only have one canonical form.
❑ To convert SOP into canonical form, multiply each non-standard product term by a term
summing the missing variable and its complement.
❑ Consider AB + AC - Non-canonical
Canonical - AB(C + C’) + A(B + B’)C
= ABC + ABC’ + ABC + AB’C
= ABC + ABC’ + AB’C
0 0 0 1 1 1 0 0 0 0
0 0 1 1 1 0 1 0 0 1 m1
0 1 0 1 0 1 0 0 0 0
0 1 1 1 0 0 0 0 0 0
1 0 0 0 1 1 0 1 0 1 m4
1 0 1 0 1 0 0 0 0 0
1 1 0 0 0 1 0 0 0 0
1 1 1 0 0 0 0 0 1 1 m7
f1 = m1 + m4 + m7 = ∑(1, 4, 7)
0 0 0 1 1 1 0 1 1 0 M0
0 0 1 1 1 0 0 1 1 0 M1
0 1 0 1 0 1 1 1 1 1
0 1 1 1 0 0 1 1 0 0 M3
1 0 0 0 1 1 1 0 1 0 M4
1 0 1 0 1 0 1 1 1 1
M6
1 1 0 0 0 1 1 0 1 0
1 1 1 0 0 0 1 1 0 0 M7
f2 = M0M1M3M4M6M7 = π(0,1,3,4,6,7)
MINIMIZATION OF BOOLEAN EXPRESSION
❑ Canonical forms are usually not minimal.
❑ Karnaugh Maps, often referred to as K-maps, are a graphical method used in Boolean Algebra
for simplifying Boolean expressions.
❑ They provide a visual and systematic approach to reducing complex Boolean expressions into
simpler forms.
❑ These are employed to simplify logical expressions that involve multiple variables and logic
gates.
GROUPING IN K-MAP GRID
❑ Once the Karnaugh Map (K-map) is populated with output values from the truth table, the next
step is to identify adjacent cells with a value of 1 (For SOP).
❑ Group these adjacent cells by drawing circles around them. These circles should encompass
cells that share common variables and differ by only one bit.
❑ Groups must be a rectangle — although this rectangle can wrap around the top or bottom of
the table.
Truth Table
Output – y
yz yz
x 00 01 11 10 x 00 01 11 10
0 1 0 1 1
1 1 1 1 1
1 1 1
yz + xz’ z’ + xy’
bc
yz a 00 01 11 10
x 00 01 11 10
1 1 0 1 1 1
0
1 1 1
1 1 1
CD
AB 00 01 11 10
00 A+B+C+D A + B + C + D’ A + B + C’ + D’ A + B + C’ + D
01 A + B’ + C + D A + B’ + C + D’ A + B’ + C’ + D’ A + B’ + C’ + D
A’ + B’ + C + D A’ + B’ + C + D’ A’ + B’ + C’ + D’ A’ + B’ + C’ + D
11
A’ + B + C + D A’ + B + C + D’ A’ + B + C’ + D’ A’ + B + C’ + D
10
4 VARIABLE K-MAP
F(A,B,C,D) = ∑(4,5,8,13) F(A,B,C,D) = ∑(0,2,4,8,10,12)
CD CD
AB 00 01 11 10 AB 00 01 11 10
00 00 1 1
01 1 1 1 01 1
11 1 11 1
10 10 1 1
CD CD
AB 00 01 11 10 AB 00 01 11 10
00 00 0 0 0
01 0 0 0 01 0 0 0
11 0 0 0 11 0
10 10 0
❑ These conditions can arise due to unspecified states or conditions that are not expected to occur.
Example – States 1010, 1011, 1100, 1101, 1110, 1111 in BCD code
❑ These states can be treated as don’t care since these do not have any effect on the output.
❑ Represented by X in K-map.
❑ We can treat their value as 0 or 1 as per our pairing convenience for simplifying the circuit.
yz
x 00 01 11 10
0 X 1
1 1 X
DON’T CARE CONDITION
F(w,x,y,z) = ∑(1,3,10) + ∑d(0,2,8,12)
yz
wx 00 01 11 10
00 X 1 1 X
01
11 X
10 X 1
w’x’ + x’z’
❑ If our input variables are A,B,C,D and E then there would be two K-maps with inputs B,C,D and E
and A would be 0 for one K-map and 1 for second K-map.
DE DE
BC 00 01 11 10 BC 00 01 11 10
00 00
01 01
11 11
10 10
A=0 A=1
❑ The cell adjacencies can be understood by visualizing that the A = 0 map is placed on top of the A= 1
map.
5 VARIABLE K-MAP
❑ F(A,B,C,D,E) = ∑(2,5,6,7,8,9,10,12,13,14,18,21,22,23,25,26,30)
DE DE
BC 00 01 11 10 BC 00 01 11 10
00 1 Grouping -3 00 1
01 1 1 1 01 1 1 1 Group 1 – DE’
Group 2 – A’BD’
1 1 1 1 Group 3 – B’CE
11 11
Group 4 – BC’D’E
1 1 1 1 1
10 10
Grouping -4
A=0 A=1
Grouping -2
Grouping -1
1 1
1 1 Prime Implicants = 3
❑ Essential Prime Implicants: Subcubes(groups) that cover at least one minterm that can’t be covered
by any other prime implicant. In the above example EPI = 2
❑ Redundant Prime Implicants: Each term in the pairing is covered in some EPI. In above example
RPI = 1
1 1
❑ Selective Prime Implicants: Neither essential nor redundant
SPI = 2 1 1 1
Quine-McCluskey (QM) METHOD
❑ K-map simplification is not very convenient for large number of inputs.
❑ Basic Procedure:
1. Arrange the given minterms according to the number of ones present in their binary representation
(Index) in ascending order.
2. Consider the minterms from adjoining groups, if there is only a one-bit change to make their pair.
Place the ‘-‘ symbol where there is a bit change accordingly and keep the remaining bits the same.
3. Repeat step 2 until we get all prime implicants (when all the bits present in the table are different).
4. Make a prime implicant table that consists of the prime implicants (obtained minterms) as rows and
the given minterms (given in problem) as columns.
Quine-McCluskey (QM) METHOD
5. Place ‘X’ in the minterms (cell) which are covered by each prime implicant.
6. Observe the table, if the minterm is covered by only one prime implicant then it is an essential to
prime implicant.
8. After the essential prime implicants are, delete the dominated rows and dominating columns to find
selective prime implicants.
Quine-McCluskey (QM) METHOD
F(w,x,y,z) = ∑(0,5,7,8,9,10,11,14,15)
Prime Minterms
Implicants
0 5 7 8 9 10 11 14 15
A X X
B X X
C X X
D X X X X
E X X X X
Quine-McCluskey (QM) METHOD
F(w,x,y,z) = ∑(0,5,7,8,9,10,11,14,15)
Prime Minterms
Implicants
0 5 7 8 9 10 11 14 15
A X X
B X X
C X X
D X X X X
E X X X X
22 10110✓
4 23 10111✓
27 11011✓
29 11101✓
Quine-McCluskey (QM) METHOD
F(v,w,x,y,z) =∑(5,7,11,12,27,29) + ∑d (14,20,21,22,23)
Prime Minterms
Implicants
5 7 11 12 27 29
A X
B X X
C X
D X X
❑ The NOR and NAND gates are universal gates. We can create any logical Boolean expression using only NOR
gates or only NAND gates.
❑ In practice, this is advantageous since NOR and NAND gates are economical and easier to fabricate than other
logic gates.
❑ An AND gate is typically implemented as a NAND gate followed by an inverter. Similarly, an OR gate is typically
realized as a NOR gate followed by an inverter.
❑ Other logical gates – such as AND gates, NOT gates and OR gates – do not have this property of universality.
NAND GATE AS A UNIVERSAL GATE
Y = AB
A B Y
0 0 1
0 1 1
1 0 1
1 1 0
A B Y
A Y
0 0 1
0 1
1 1 0
1 0
NAND GATE AS A UNIVERSAL GATE
2. NAND Gate as AND Gate
A B Y Y or Z
Y = AB, Y = AB = AB 0 0 1 0
0 1 1 0
1 0 1 0
1 1 0 1
OR Gate O/P Z = A + B = A + B = A B A B A B Y
0 0 1 1 0
A 0 1 1 0 1
AB 1 0 0 1 1
1 1 0 0 1
B
NAND GATE AS A UNIVERSAL GATE
4. NAND Gate as NOR Gate
A
A+B
A+B
B A B A B A+B O/P
0 0 1 1 0 1
0 1 1 0 1 0
1 0 0 1 1 0
1 1 0 0 1 0
NAND GATE AS A UNIVERSAL GATE
5. NAND Gate as XOR Gate
Y= AB+AB
Y= AB+AB = AB.AB A B A B AB AB Y
0 0 1 1 1 1 0
0 1 1 0 0 1 1
A
AB 1 0 0 1 1 0 1
1 1 0 0 1 1 0
B
AB
NAND GATE AS A UNIVERSAL GATE
NAND Gate as XOR Gate
Y = A B +A B +AA + B B A (AB)
Y = A (A + B) + B (A + B) AB
Y = A (AB) + B (AB)
B (AB)
Y = A (AB) + B (AB)
A B AB A (AB) B (AB) Y
Y = A (AB) . B (AB) 0 0 1 1 1 0
0 1 1 1 0 1
1 0 1 0 1 1
1 1 0 1 1 0
NAND GATE AS A UNIVERSAL GATE
6. NAND Gate as XNOR Gate
A
Y= AB+AB AB
B
Y= AB+AB
Y= AB. AB AB
A B AB A B AB Q
0 0 1 1 1 0 1
0 1 1 1 0 1 0
1 0 1 0 1 1 0
1 1 0 0 0 1 1
NOR GATE AS A UNIVERSAL GATE
Y = A+ B
A B Y
0 0 1
0 1 0
1 0 0
1 1 0
B
NAND GATE AS A UNIVERSAL GATE
4. NOR Gate as NAND Gate
A
AB
AB
A B A B AB O/P
0 0 1 1 0 1
0 1 1 0 0 1
1 0 0 1 0 1
1 1 0 0 1 0
COMBINATIONAL LOGIC
❑ When logic gates are connected together to produce a specified output for certain specified combinations of
input variables, with no storage involved, the resulting circuit is a combinational circuit.
❑ In combinational logic, the output at all given times is only dependent on present the input combinations.
❑ Combinational circuits lack feedback loops, which means they don't have memory elements and don't store data.
1 0 0 1
1 0 1 0
1 1 0 0
x’y’z + x’yz’ + xy’z’ + xyz = x’(y’z + yz’) + x(y’z’ + yz)
1 1 1 1
= x’(y⊕z) + x(y⊕z)’ = x⊕y⊕z
4-BIT BCD TO EXCESS-3 CODE CONVERTER
BCD Code Excess-3 Code BCD Code Excess-3 Code
b3 b2 b1 b0 e3 e2 e1 e0 b3 b2 b1 b0 e3 e2 e1 e0
0 0 0 0 0 0 1 1 1 1 0 1 X X X X
0 0 0 1 0 1 0 0 1 1 1 0 X X X X
0 0 1 0 0 1 0 1 1 1 1 1 X X X X
0 0 1 1 0 1 1 0
0 1 0 0 0 1 1 1
0 1 0 1 1 0 0 0
0 1 1 0 1 0 0 1
0 1 1 1 1 0 1 0
1 0 0 0 1 0 1 1
1 0 0 1 1 1 0 0
1 0 1 0 X X X X
1 0 1 1 X X X X
1 1 0 0 X X X X
4-BIT BINARY TO EXCESS-3 CODE CONVERTER
b1b0 b1b0 b1b0
b3b2 00 01 11 10 b3b2 00 01 11 10 b3b2 00 01 11 10
00 00 1 1 1 00 1 1
1 1 1 01 1 01 1 1
01
11 X X X X 11 X X X X 11 X X X X
10 1 1 X X 10 1 X X 10 1 X X
e3 e2 e1
e0
b1b0
b3b2 00 01 11 10 b0
e3 = b3 + b2b0 + b2b1 b1 e1
00 1 1
e2 = b2’b1 + b2’ b0 + b2 b1’ b0’
01 1 1 e1 = b1’ b0’ + b1b0 b2
e0 = b0’ e2
11 X X X X
10 1 X X
e3
e0 b3
3-BIT BINARY TO GRAY CODE CONVERTER
B1 B0
B2 00 01 11 10
BINARY CODE GRAY CODE
B2 B1 B0 G2 G1 G0 0
1 1 1 1 1
0 0 0 0 0 0
0 0 1 0 0 1 G2 = B2
B1 B0
0 1 0 0 1 1 B2 00 01 11 10
0 1 1 0 1 0 1 1
0
1 0 0 1 1 0 1 1 1
1 0 1 1 1 1
G1 = B2B1’ + B2’B1
1 1 0 1 0 1
B1 B0
1 1 1 1 0 0 B2 00 01 11 10
0 1 1
1 1 1
G1 = B1B0’ + B1’B0
Binary Adder
• A combinational circuit that performs the addition of two bits is
called a half adder.
• The truth table for the half adder is listed below:
S: Sum
C: Carry
S = x’y + xy’
C = xy
56
Implementation of Half-Adder
57
Full-Adder
• Full adder performs the addition of three bits(two
significant bits and a previous carry).
58
Full adder implemented in SOP
S = x’y’z + x’yz’ + xy’z’ + xyz
C = xy + xz + yz
59
Another implementation
• Full-adder can also implemented with two half adders and one OR
gate (Carry Look-Ahead adder).
S = z ⊕ (x ⊕ y)
= z’(xy’ + x’y) + z(xy’ + x’y)’
= xy’z’ + x’yz’ + xyz + x’y’z
C = z(xy’ + x’y) + xy = xy’z + x’yz + xy
60
Binary adder
• This is also called Ripple
Carry Adder ,because of
the construction with full
adders are connected in
cascade.
62
Boolean functions
Pi = Ai ⊕ Bi
Gi = AiBi
Output sum and carry
Si = Pi ⊕ Ci
Ci+1 = Gi + PiCi
Gi : carry generate Pi : carry propagate
C0 = input carry
C1 = G0 + P0C0
C2 = G1 + P1C1 = G1 + P1G0 + P1P0C0
C3 = G2 + P2C2 = G2 + P2G1 + P2P1G0 + P2P1P0C0
64
4-bit adder with carry lookahead
• Delay time of n-bit CLAA = AND Gates = n (n + 1)/2
OR Gates = n
65
HALF SUBTRACTOR
Input Output
Difference = A’B + AB’ = A ⊕ B
A B Difference Borrow
0 0 0 0 Borrow = A’B
0 1 1 1
1 0 1 0
1 1 0 0
FULL SUBTRACTOR
Input Output
A B C Difference BorrowOUT
(BorrowIN)
Difference = A’B’C + A’BC’ + AB’C’ + ABC
0 0 0 0 0
= A’(B’C + BC’) + A(B’C’ + BC)
0 0 1 1 1 = A’(B ⊕ C) + A (B ⊕ C)’
0 1 0 1 1 =A⊕B⊕C
0 1 1 0 1
BorrowOUT = A’B’C + A’BC’ + A’BC + ABC
1 0 0 1 0
= A’C + BC + A’B
1 0 1 0 0
1 1 0 0 0 A’B’ A’B AB A’B
1 1 1 1 1 C’ 1
C 1 1 1
FULL SUBTRACTOR
4-BIT ADDER-SUBTRACTOR WITH OVERFLOW DETECTION
4-BIT ADDER-SUBTRACTOR WITH OVERFLOW DETECTION
❑ Mode input, M controls the operation.
❑ When M = 0, B ⊕ 0 = B, full adder receives the value of B, input carry = 0, and output = A + B
❑ When M = 1, B ⊕ 1 = B’, circuit receives the value of B’, input carry = 1, and output = A + 2s complement of B
❑ For signed numbers, V bit detects an overflow. If V = 0, no overflow occurred and the result is correct. If V =1,
overflow occurred.
❑ A BCD Adder Circuit adds two BCD digits and produces a sum digit also in BCD.
❑ The addition of two BCD numbers can be best understood by considering the three cases:
❑ If four-bit sum is equal to or less than 9, no correction is needed. The sum is in proper BCD form.
❑ If the four-bit sum is greater than 9 or if a carry is generated from the four-bit sum, the sum is invalid.
❑ To correct the invalid sum, add 0110 to the four-bit sum. If a carry results from this addition, add it to the next
higher-order BCD digit.
BCD ADDER
C = K + Z8 Z4 + Z8 Z 2
When C = 1, 0110 is
added to the binary
sum.
BCD ADDER
BINARY MULTIPLIER
❑ Multiplication of binary numbers is performed in the same way as multiplication of decimal numbers.
❑ Each of these multiplications form a partial product and successive partial products are shifted one position to
the left.
❑ The final product is obtained from the sum of the partial products.
B1 B0
A1 A0
A0B1 A0B0
A1B1 A1B0
C3 C2 C1 C0
TWO-BIT BY TWO-BIT BINARY MULTIPLIER
FOUR-BIT BY THREE-BIT BINARY MULTIPLIER
For J multiplier bits and K multiplicand bits we need (J x K) - AND Gates, (J – 1) – K-bit adders to produce a
product of (J + K) bits.
MAGNITUDE COMPARATOR
❑ Magnitude comparator compares two numbers A and B and determines their relative magnitudes i.e. possible
outcomes are A > B, A = B or A < B.
X
4- BIT MAGNITUDE COMPARATOR