LOGIC DESIGN
Dr.Eng. Mahmoud Abu Alfutuh
Chapter 3
Boolean Algebra and Logic Gates
Dr.Eng. Mahmoud Abu_Alfutuh
2
Chapter 3 - Boolean Algebra and Logic Gates
Boolean Algebra
– Laws and Rules of Boolean Algebra
– Simplification Using Boolean Algebra
– Standard Forms of Boolean Expressions
Logic gates
– Universal NAND gates.
– Universal NOR gates.
3
Boolean Algebra
Boolean Algebra: a useful mathematical
system for specifying and transforming
logic functions.
We study Boolean algebra as a foundation
for designing and analyzing digital systems
4
Logical Operations
The three basic logical operations are:
– AND
– OR
– NOT
AND is denoted by a dot (·). ( )
OR is denoted by a plus (+). ( )
NOT is denoted by an over bar ( ¯ ) ( ¬ )
a single quote mark (') after, or (~) before the
variable.
5
Notation Examples
Examples:
Y=A.B is read “Y is equal to A AND B.”
Z=X+Y is read “z is equal to X OR Y.”
X=A is read “X is equal to NOT A.”
▪ Note: The statement:
1 + 1 = 2 (read “one plus one equals two”)
is not the same as
1 + 1 = 1 (read “1 OR 1 equals 1”).
Operator Definitions
▪ Operations are defined on the values
"0" and "1" for each operator:
AND OR NOT
0·0=0 0+0=0 0=1
0·1=0 0+1=1 1=0
1·0=0 1+0=1
1·1=1 1+1=1
Boolean Functions
A Boolean function is an expression formed with
binary variables, the operators AND , OR, NOT,
parentheses and equal sign.
The value of a function may be 0 or 1.
For example, a Boolean function is expressed as:
F = A.B + C
variables operators ( . , + )
8
Truth Tables
A truth table is the tabular form
A B C F
of the values of a Boolean
0 0 0 0
function according to the all
possible values of its variables. 0 0 1 1
0 1 0 0
The Boolean function F = AB + C
can be represented by truth table 0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1
9
Logic Circuits
A Boolean function from an algebraic expression
can be realized to a logic circuits composed of
logic gates.
Logic Circuit of Boolean function F = A.B + C
10
Boolean Functions
x y z F
Boolean Expression
0 0 0 0
Example: 0 0 1 1
Truth Table 0 1 0 0
All possible combinations 0 1 1 0
of input variables 1 0 0 1
Logic Circuit 1 0 1 1
1 1 0 1
1 1 1 1
Boolean equations, truth tables and logic circuits
describe the same function! 11 / 28
Logic Equivalence for a Logic Circuit
Derivation of logical expression from a circuit
– Trace from the input to output
» Write down intermediate logical expressions
along the path
Example: What is the Boolean expression of F4?
A'.B'
A'
A'.B'+C (A'.B'+C)'
B'
F4
C
F4 = (A'.B'+C)' = (A+B).C'
12
Basic Identities of Boolean Algebra
(1) x + 0 = x
(2) x · 0 = 0
(3) x + 1 = 1
(4) x · 1 = x
(5) x + x = x
(6) x · x = x
(7) x + x’ = 1
(8) x · x’ = 0
Basic Identities of Boolean Algebra
(Commutative )تبادلي:
(9) x + y = y + x
(10) xy = yx
(Associative )تجميع:
(11) x + ( y + z ) = ( x + y ) + z
(12) x (yz) = (xy) z
(Distributive )توزيع:
(13) x ( y + z ) = xy + xz
(14) x + yz = ( x + y )( x + z)
Basic Identities of Boolean Algebra
(DeMorgan’s Theorem)
(15) ( x + y )' = x’. y'
(16) ( x.y )' = x' + y'
(Involution )التفاف
(17) (x')' = x
Simplification of Boolean expressions
using Boolean Algebra
Examples:
F= a + ab
= a(1+b) = a
F= a(a + b)
= a.a + ab
= a+ab
= a(1+b) = a.
F= a + a'b
= (a + a')(a + b)
= 1(a + b) = a+b
F= a(a' + b)
= a. a' +ab = 0+ab = ab
The other type of question
Show that;
1- ab + ab' = a
ab + ab' = a(b+b')
= a.1= a
2- (a + b)(a + b') = a
(a + b)(a + b') = a.a +a.b' +a.b+b.b'
= a + a.b' +a.b + 0
= a + a.(b' +b) + 0
= a + a.1 + 0
= a +a=a
Simplification Using Boolean Algebra
Ex) Using Boolean algebra, simplify this expression
AB+A(B+C)+B(B+C)
Sol) AB+A(B+C)+B(B+C)= AB+AB+AC+BB+BC
=B(1+A+A+C)+AC = B+AC
18
Simplification Using Boolean Algebra
Ex -) Simplify the following Boolean expression
(AB +AC)’+A’B’C
Sol)
(AB)’(AC)’+A’B’C=(A’+B’)(A’+C’)+A’B’C
=A’+A’B’ +A’C’+B’C’+A’B’C
=A’(1+B’+C’+B’C)+B’C’
=A’+B’C’
19
Next … Canonical and Standard Forms
Minterms and Maxterms
Sum-of-Minterm (SOM) Canonical Form
Product-of-Maxterm (POM) Canonical Form
Representation of Complements of Functions
Conversions between Representations
20
Standard Forms
An arbitrary logic function can be expressed in
the following forms:
– Sum of the Products (SOP)
– Product of the Sums (POS)
Product Term. the AND function is referred to as
a product term. For example, ABC′ is a product
term.
Sum Term. An OR function is referred to as a
sum term. For example, A + B + C′ is a sum term.
21
Standard forms
Sum of Products (SOP). The logical sum of two or more logical
product terms is referred to as a sum of products expression.
– For example, Y = A′B + BC + AC′ is sum of products
expressions.
Product of Sums (POS). The logical product of two or more
logical sum terms is called a product of sums expression.
– For example, Y = (A + B + C)(A + B′ + C)(A + B + C′) is
product of sums expressions.
Standard form. The standard form of the Boolean function is
when it is expressed in sum of the products or product of the
sums fashion.
22
Standard Canonical Form
SUM OF PRODUCTS (SOP)
23
Minterms
A product term containing all n variables of the
function in either true or complemented form is
called the Minterm.
For a two-variable function, four different
combinations are possible, such as, A′B′, A′B,
AB′, and AB.
For n variables, there are 2n minterms.
24
Minterms for 2 variables
Two variable minterms.
x y Index Minterm
0 0 0 m0 = x y
0 1 1 m1 = x y
1 0 2 m2 = x y
1 1 3 m3 = x y
The minterm mi should evaluate to 1 for each
combination of x and y.
25
Minterms for 3 variables
A B C Minterm
– Product (AND function) 0 0 0 0 m0 ABC
– Contains all variables 1 0 0 1 m1 ABC
– Evaluates to ‘1’ for a 2 0 1 0 m2 ABC
specific combination
3 0 1 1 m3 ABC
Example
4 1 0 0 m4 ABC
A=0 A B C
5 1 0 1 m5 ABC
B=0 (0) • (0) • (0)
6 1 1 0 m6 ABC
C=0
1 • 1 • 1=1 7 1 1 1 m7 ABC
26 / 28
Canonical Sum of Product Expression
When a Boolean function is expressed as the
logical sum of all the minterms from the rows of a
truth table, for which the value of the function is
1, it is referred to as the canonical sum of product
expression.
27
Conversion of a logic function to Canonical SOP
Form
– For missing variables (x), apply (x+x')=1 to the AND terms of the
expression
– List all the min-terms in forms of the complete set of variables in
ascending order
Ex.) Obtain the canonical sum of product form of the following
function. F (A, B) = A + B
Sol) domain={A,B},
F (A, B) = A + B = A.1 + B.1
= A (B + B′) + B (A + A′)
= AB + AB′ + AB + A′B
= AB + AB′ + A′B (as AB + AB = AB)
28
Conversion of a logic function to Canonical SOP
Form
Ex. Obtain the canonical sum of product form of the
following function. F (A, B, C) = A + BC
Sol) domain={A,B,C},
F (A, B, C) = A + BC
= A (B + B′) (C + C′) + BC (A + A′)
= (AB + AB′) (C + C′) + ABC + A′BC
= ABC + AB′C + ABC′ + AB′C′ + ABC + A′BC
= ABC + AB′C + ABC′ + AB′C′ + A′BC
(as ABC + ABC = ABC)
= (7,5,6,4,3) = (3,4,5,6,7)
29
Converting to Sum-of-Minterms Form
by means of a truth table
A function that is not in the Sum-of-Minterms form
can be converted to that form by means of a truth table
Consider F = y + x z
x y z F Minterm F = ∑(0, 1, 2, 4, 5) =
0 0 0 1 m0 = x y z
0 0 1 1 m1 = x y z m0 + m1 + m2 + m4 + m5 =
0 1 0 1 m2 = x y z
0 1 1 0 xyz+xyz+xyz+
1 0 0 1 m4 = x y z
xyz+xyz
1 0 1 1 m5 = x y z
1 1 0 0
1 1 1 0
30
Deriving a Sum of Products (SOP)
Expression from a Truth Table
Sum-Of-Minterm (SOM) canonical form:
Sum of minterms of entries that evaluate to ‘1’
x y z F Minterm
0 0 0 0
0 0 1 1 m1 = x y z
0 1 0 0 Focus on the
0 1 1 0 ‘1’ entries
1 0 0 0
1 0 1 0
1 1 0 1 m6 = x y z
1 1 1 1 m7 = x y z
F = m1 + m6 + m7 = ∑ (1, 6, 7) = x y z + x y z + x y z
31
Sum-Of-Minterm Examples
F(a, b, c, d) = ∑(2, 3, 6, 10, 11)
F(a, b, c, d) = m2 + m3 + m6 + m10 + m11
a b c d+ a b c d+ a b c d+ a b c d+ a b c d
G(a, b, c, d) = ∑(0, 1, 12, 15)
G(a, b, c, d) = m0 + m1 + m12 + m15
a b c d+ a b c d+ a b c d+ a b c d
32
Standard Canonical Form
PRODUCT OF SUMS (POS)
33
Maxterms
A sum term containing all n variables of the
function in either true or complemented form is
called the Maxterm.
Four different combinations are possible for a two-
variable function, such as, A′ + B′, A′ + B, A + B′,
and A + B.
There are 2n maxterms for n variables.
34
Maxterms for 2 variables
Two variable maxterms.
x y Index Maxterm
0 0 0 M0 = x + y
0 1 1 M1 = x + y
1 0 2 M2 = x + y
1 1 3 M3 = x + y
The maxterm Mi should evaluate to 0 for each
combination of x and y.
The maxterm is the complement of the minterm
35
Maxterms for 3 variables
Maxterm A B C Maxterm
– Sum (OR function) 0 0 0 0 M0 A + B + C
– Contains all variables 1 0 0 1 M1 A + B + C
– Evaluates to ‘0’ for a 2 0 1 0 M2 A + B + C
specific combination
3 0 1 1 M3 A + B + C
Example 4 1 0 0 M4 A + B + C
A=1 A B C 5 1 0 1 M5 A + B + C
B=1 (1) + (1) + (1) 6 1 1 0 M6 A + B + C
C=1 7 1 1 1 M7 A + B + C
0 + 0 + 0=0
36 / 28
Maxterms
Canonical Product of Sum Expression. When a
Boolean function is expressed as the logical
product of all the maxterms from the rows of a
truth table, for which the value of the function is 0,
it is referred to as the canonical product of sum
expression.
37
Conversion of a logic function to Canonical POS
Form
– For all the missing variables, apply (xx')=0 to the OR terms of the
expression
– List all the max-terms in forms of the complete set of variables in
ascending order
Ex.) Obtain the canonical product of sum form of the following
function. F (A, B) = A(A + B′)
Sol) domain={A,B},
F (A, B) = A(A + B′)
= (A + 0) (A + B’)
= (A + BB′) ( A + B′)
Using: X+YZ=(X+Y)(X+Z)
= (A + B ) (A+ B′) ( A + B′) = (A + B ) (A+ B′)
38
= ∏(0,1)
Conversion of a logic function to Canonical POS
Form
Ex) Convert the following expression into Canonical POS
form: F(A,B) =AB'
Sol) domain={A,B},
F(A, B) = A B' = (A+0) ( B'+0)
= (A +B B′) (B' +A A′)
Using: X+YZ=(X+Y)(X+Z)
= (A+B)(A + B′ )(B’+ A)(B’ + A′)
= (A+B)(A + B′ )(A’+ B’)
as (A+B’) (A+B’) = A+B’
39
Conversion of a logic function to Canonical POS
Form
Ex.) Obtain the canonical product of sum form of the following
function. F (A, B, C) = (A + B′) (B + C)
Sol) domain={A,B,C},
F (A, B, C) = (A + B′) (B + C)
= (A + B′ + 0) (B + C + 0)
= (A + B′ + CC′) (B + C + AA′)
= (A + B′ + C) (A+ B′ + C′) (B + C + A) (B + C + A′)
= (A + B′ + C) (A+ B′ + C′) (A + B + C) (A′+B + C)
= ∏(2, 3, 0, 4) = ∏(0,2, 3, 4)
40
Converting to Product-of-Maxterms Form
A function that is not in the Product-of-Minterms form
can be converted to that form by means of a truth table
Consider again: F = y + x z
x y z F Maxterm F = ∏(3, 6, 7) =
0 0 0 1
0 0 1 1 M3 · M6 · M7 =
0 1 0 1
0 1 1 0 M3 = (x+y+z) (x+y+z) (x+y+z) (x+y+z)
1 0 0 1
1 0 1 1
1 1 0 0 M6 = (x+y+z)
1 1 1 0 M7 = (x+y+z)
41
Deriving a Product of Sums (POS)
Expression from a Truth Table
Product-Of-Maxterm (POM) canonical form:
Product of maxterms of entries that evaluate to ‘0’
x y z F Maxterm
0 0 0 1
0 0 1 1
0 1 0 0 M2 = (x + y + z) Focus on the
0 1 1 1 ‘0’ entries
1 0 0 0 M4 = (x + y + z)
1 0 1 1
1 1 0 0 M6 = (x + y + z)
1 1 1 1
F = M2·M4·M6 = ∏ (2, 4, 6) = (x+y+z) (x+y+z) (x+y+z
42
)
Product-Of-Maxterm Examples
F(a, b, c, d) = ∏(1, 3, 6, 11)
F(a, b, c, d) = M1 · M3 · M6 · M11
=
(a+b+c+d)(a+b+c+d) (a+b+c+d) (a+b+c+d)
G(a, b, c, d) = ∏(0, 4, 12, 15)
G(a, b, c, d) = M0 · M4 · M12 · M15
(a+b+c+d)(a+b+c+d) (a+b+c+d) (a+b+c+d)
43
Boolean Expressions and Truth Tables
Ex) Determine standard SOP and POS from the truth table
Sol) (a) Standard SOP
Inputs Output
F=A’BC+AB’C’+ABC’+ABC A B C F
(b) Standard POS 0 0 0 0
0 0 1 0
F=(A+B+C)(A+B+C’)(A+B’+C)
0 1 0 0
(A’+B+C’) 0 1 1 1
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 1
44
Boolean Expressions and Truth Tables
Ex) Determine standard SOP and POS from the truth table
Sol) (a) Standard SOP
Inputs Output
F=A’B’+AB A B F
(b) Standard POS 0 0 1
0 1 0
F=(A+B’)(A’+B)
1 0 0
1 1 1
F=(A+B’)(A’+B) = AA’+AB +A’B’+BB’
=0+AB +A’B’ +0 = A’B’ + AB
45
Boolean Expressions and Truth Tables
Ex) Determine standard SOP and POS from the truth table
Sol) (a) Standard SOP
Inputs Output
F=A’B’+AB = m0 + m3 A B F
0 0 1
0 1 0
F’=A’B+AB’ = m1 + m2
1 0 0
1 1 1
(b) Standard POS
F=(A+B’)(A’+B) = M1.M2
46
Observations
We can implement any function by "ORing" the minterms
corresponding to the ‘1’ entries in the function table. A
minterm evaluates to ‘1’ for its corresponding entry.
We can implement any function by "ANDing" the maxterms
corresponding to ‘0’ entries in the function table. A maxterm
evaluates to ‘0’ for its corresponding entry.
The same Boolean function can be expressed in two
canonical ways: Sum-of-Minterms (SOM) and Product-of-
Maxterms (POM).
If a Boolean function has fewer ‘1’ entries then the SOM
canonical form will contain fewer literals than POM.
However, if it has fewer ‘0’ entries then the POM form will
have fewer literals than SOM. 47
CONVERTING SOP TO POS
48
Converting Standard SOP to Standard POS
Step 1. Evaluate each product term in the SOP expression.
Determine the binary numbers that represent the
product terms
Step 2. Determine all of the binary numbers not included in
the evaluation in Step 1
Step 3. Write in equivalent sum term for each binary number
Step 2 and expression in POS form
Ex) Convert the following SOP to POS
Sol) SOP: F=A’B’+AB = m0 + m3 =(0, 3)
POS: F=(M1)(M2) = (1, 2) =(A+B’)(A’+B)
49
Converting Standard SOP to Standard POS
Ex) Convert the following SOP to POS
Sol) (a) Standard SOP
F=A’B’+AB = m0 + m3 Inputs Output
A B F
0 0 1
0 1 0
1 0 0
(b) Standard POS 1 1 1
F=(A+B’)(A’+B) = M1.M2
50
Converting Standard SOP to Standard POS
Step 1. Evaluate each product term in the SOP expression.
Determine the binary numbers that represent the
product terms
Step 2. Determine all of the binary numbers not included in
the evaluation in Step 1
Step 3. Write in equivalent sum term for each binary number
Step 2 and expression in POS form
Ex) Convert the following SOP to POS
Sol) SOP= A’B’C’+A’BC’+A’BC+AB’C+ABC
=m0+m2+m3+m5+m7 =(0, 2, 3, 5, 7)
POS=(M1)(M4)(M6) = (1, 4, 6)
=(A+B+C’)(A’+B+C)(A’+B’+C)
51
Conversions Between Canonical Forms
x y z F Minterm Maxterm
0 0 0 0 M0 = (x + y + z)
0 0 1 1 m1 = x y z
0 1 0 1 m2 = x y z
0 1 1 1 m3 = x y z
1 0 0 0 M4 = (x + y + z)
1 0 1 1 m5 = x y z
1 1 0 0 M6 = (x + y + z)
1 1 1 1 m7 = x y z
F = m1+m2+m3+m5+m7 = ∑(1, 2, 3, 5, 7) =
xyz+xyz+xyz+xyz+xyz
F = M0 · M4 · M6 = ∏(0, 4, 6) = (x+y+z)(x+y+z)(x+y+z)
52
Function Complements
The complement of a function expressed as a sum of
minterms is constructed by selecting the minterms
missing in the sum-of-minterms canonical form
Example: Given F(x, y, z) = ∑ (1, 3, 5, 7)
F(x, y, z) = ∑ (0, 2, 4, 6)=m0+m2+m4+m6
Alternatively, the complement of a function
expressed by a Sum of Minterms form is simply the
Product of Maxterms with the same indices
F(x, y, z) = (m0+m2+m4+m6) = m0.m2.m4.m6
F(x, y, z) =M0.M2.M4.M6 = ∏ (0, 2, 4, 6)
F(x, y, z) = ∏ (1, 3, 5, 7) 53
Summary of Minterms and Maxterms
There are 2n minterms and maxterms for Boolean
functions with n variables.
Minterms and maxterms are indexed from 0 to 2n – 1
Any Boolean function can be expressed as a logical
sum of minterms and as a logical product of
maxterms
The complement of a function contains those
minterms not included in the original function
The complement of a sum-of-minterms is a product-
of-maxterms with the same indices 54
Standard SOP and POS from the truth table
Ex) Determine standard SOP and POS from the truth table
Sol)
Inputs Output
(a) Standard SOP A B C F
F=A’BC+AB’C’+ABC’+ABC 0 0 0 0
0 0 1 0
0 1 0 0
(b) Standard POS 0 1 1 1
F=(A+B+C)(A+B+C’)(A+B’+C) 1 0 0 1
1 0 1 0
(A’+B+C’) 1 1 0 1
1 1 1 1
55
Minterm and Maxterm Relationship
DeMorgan's Theorem:
x · y = x + y and x + y = x ⋅ y
Two-variable example:
M2 = x + y = and m2 = x · y
Thus M2 is the complement of m2 and vice-versa.
Since DeMorgan's Theorem holds for n variables,
the above holds for terms of n variables
giving: Mi = mi and mi = Mi
Thus Mi is the complement of mi.
56
Examples
57
Boolean Expressions and Truth Tables
• Converting SOP Expressions to Truth Table Format
Ex ) A’B’C+AB’C’+ABC =(1,4,7)
Inputs Output Product
A B C X Term
0 0 0 0
0 0 1 1 A’B’C
0 1 0 0
0 1 1 0
1 0 0 1 AB’C’
1 0 1 0
1 1 0 0
1 1 1 1 ABC
58
Boolean Expressions and Truth Tables
Converting POS Expressions to Truth Table Format
Ex ) (A+B+C)(A+B’+C)(A+B’+C’)(A’+B+C’)(A’+B’+C) =
(000)(010)(011)(101)(110) = (0,2,3,5,6)
Inputs Output
Sum Term
A B C X
0 0 0 0 A+B+C
0 0 1 1
0 1 0 0 A+B’+C
0 1 1 0 A+B’+C’
1 0 0 1
1 0 1 0 A’+B+C’
1 1 0 0 A’+B’+C
1 1 1 1
59
Boolean Expressions and Truth Tables
Ex) Determine standard SOP and POS from the truth table
Sol) (a) Standard SOP
Inputs Output
F=A’BC+AB’C’+ABC’+ABC A B C X
(b) Standard POS 0 0 0 0
0 0 1 0
F=(A+B+C)(A+B+C’)(A+B’+C)
0 1 0 0
(A’+B+C’) 0 1 1 1
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 1
60
DeMorgan's example
Ex) Apply DeMorgan’s theorems to
(a) ((A+B+C)D)’ (b) (ABC+DEF)’ (c) (AB’+C’D+EF)’
Sol)
(a) ((A+B+C)D)’= (A+B+C)’+D’
=A’B’C’+D’
(b) (ABC+DEF)’=(ABC)’(DEF)’
=(A’+B’+C’)(D’+E’+F’)
(c) (AB’+C’D+EF)’=(AB’)’(C’D)’(EF)’
= ( A’+B)(C+D’)(E’+F’)
61
More Examples
Show that;
(a) ab + ab'c = ab + ac
(b) (a + b)(a + b' + c) = a + bc
(a) ab + ab'c = a(b + b'c)
= a((b+b').(b+c))=a(b+c)=ab+ac
(b) (a + b)(a + b' + c)
= (a.a + a.b' + a.c + ab +b.b' +bc)
= (a + a.b‘+ a.c + ab +0 +bc)
= (a(1 + b‘+ c + b ) +bc) = a + bc
Simplification Using Boolean Algebra
Ex -) Simplify the following Boolean expression
(AB’(C+BD)+A’B’)C
Sol)
(AB’C+AB’BD+A’B’)C=AB’CC+A’B’C=(A+A’)B’C=B’C
Ex -) Simplify the following Boolean expression
A’BC+AB’C’+A’B’C’+AB’C+ABC
Sol)
(A+A’)BC+(A+A’)B’C’+AB’C=BC+B’C’+AB’C
=BC+B’(C’+AC)=BC+B’(C’+A)=BC+B’C’+AB’
63
Purpose of the Index
Minterms and Maxterms are designated with an index
The index number corresponds to a binary pattern
The index for the minterm or maxterm, expressed as a
binary number, is used to determine whether the variable
is shown in the true or complemented form
For Minterms:
– ‘1’ means the variable is “Not Complemented” and
– ‘0’ means the variable is “Complemented”.
For Maxterms:
– ‘0’ means the variable is “Not Complemented” and
– ‘1’ means the variable is “Complemented”.
64
Standard Order
All variables should be present in a minterm or
maxterm and should be listed in the same order
(usually alphabetically)
Example: For variables a, b, c:
– Maxterms (a + b + c), (a + b + c) are in standard order
– However, (b + a + c) is NOT in standard order
(a + c) does NOT contain all variables
– Minterms (a b c) and (a b c) are in standard order
– However, (b a c) is not in standard order
(a c) does not contain all variables
65
Thank you
Next topic