Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 53

Digital Logic

Lecture 6

Boolean Algebra and Logic Gates


– Part II

The Hashemite University


Computer Engineering Department
Outline
 History of Boolean Algebra.
 Basic definitions.
 Boolean algebra postulates.
 Boolean algebra properties.
 Boolean algebra theorems.
 Equivalency proof.
 Boolean functions simplification.
 Complement of Boolean functions.
 Canonical and standard Boolean functions
representation.
 Extension to multiple inputs.

The Hashemite University 2


History of Boolean Algebra I
 What is an Algebra? (e.g algebra of integers)
 Set of elements (e.g. 0,1,2,…)
 Set of operations (e.g.+,-,*,…)
 Postulates/axioms (e.g. 0+x=x,…)
 Boolean Algebra is taken from George Boole
who used Boolean Algebra to study human
logical reasoning-calculus proposition
 Logic: TRUE or FALSE
 Operation: x or y, x and y, not x.
The Hashemite University 3
History of Boolean Algebra II
 Shannon introduced switch algebra (or
two-value Boolean Algebra) for two
switch stable representation
 Two-Value Boolean Algebra:
 Elements Set (B): {0,1}
 Operation Set:{.,+,’ } (AND, OR, NOT)

The Hashemite University 4


Basic Definitions I
 A set of elements is any collection of objects having a
common property.
 If S is a set and x and y are certain objects, then x  S
denotes that x is a member of the set S, and y S
denotes that y is not an element of S.
 A binary operator defined on a set S of elements is a rule
that assigns to each pair of elements from S a unique
element from S.
 The number of Boolean functions that are defined over n
variables (or inputs) = 22n. Why?
 Recall, there are 2n for input combinations

 For each input pair, the function can take a value of 1

or 0.
The Hashemite University 5
Basic Definitions II
 There are general postulates that define an
algebraic structure such as normal
arithmetic algebra defined over the real
numbers set. We will study these postulates
with respect to Boolean algebra.
 Note that there are many differences
between Boolean algebra and ordinary
arithmetic algebra operations and so in the
applied postulates as we will see later.

The Hashemite University 6


Boolean Algebra Postulates I
 Formulated by Huntington in 1904.
 Boolean algebra contains element set B, with two
binary operations {+} and {.} and operation { ‘}
 Set B must contain at least elements x and y.
 Boolean Algebra Postulates:
1. Closure: For every x, y in B
a) x+y is in B
b) x.y is in B
2. Identity: (0 and 1)
a) 0+x=x+0=x for every x in B
b) 1.x=x.1=x for every x in B

The Hashemite University 7


Boolean Algebra Postulates II
3. Commutative Law: For every x, y in B
a) x+y = y+x
b) x.y = y.x
4. Distributive Law: For every x, y, z in B
a) x.(y+z)=(x.y)+(x.z)
b) x+(y.z)=(x+y).(x+z)

The Hashemite University 8


Boolean Algebra Postulates III
5. Complement: For every x in B, element x’ in B
exist for
a) x+x’=1
b) x.x’=0

• Set B={0,1} and logical operation OR,AND, and


NOT must obey all Boolean Algebra postulates.
• Boolean Function mapped several input {0,1} into
{0,1} Boolean expression is Boolean statement (or
equation) which contains Boolean operator and
variables.

The Hashemite University 9


Differences Between Boolean Algebra
and Ordinary Arithmetic Algebra
 Huntington postulates don’t include the associative law.
However, this law holds for Boolean Algebra and easily
can be proved which is one of the Boolean Algebra
theorems.
 Associative: (x+y)+z = x+ (y+z)
 The distributive law of + over  is valid for Boolean
Algebra only.
 Boolean Algebra doesn’t have additive or multiplicative
inverses,  no subtraction or division. Why? (identity
element of ‘.’ (AND) is 1 and identity element of ‘+’ (OR)
is 0. However, x.x’ = 0 (not 1) and x + x’ = 1 (not 0).
 The operator complement is not available in ordinary
algebra.
 Ordinary algebra deals with real numbers, Boolean
Algebra deals with only two elements (0 and 1).
The Hashemite University 10
Boolean Algebra Properties
 The most important property of Boolean algebra is the
duality principle.
 Duality Principle states that every algebraic expression
deducible from the postulates of Boolean algebra remains
valid if the operators and identity elements are
interchanged.
 Postulates a and b:
Postulate 2, Identity x+0=x x1=x
Postulate 3, Commutative x+y=y+x xy = yx
Postulate 4, Distributive x (y + z) = xy + xz x + yz = (x + y)(x + z)
Postulate 5, Complement x + x’ = 1 x  x’ = 0
The Hashemite University 11
Boolean Algebra Theorems
Theorem Part (a) Part (b)
Theorem 1, Idempotency x+x=x xx=x
Theorem 2, NULL Element x+1=1 x0=0
Theorem 3, Involution ( x’ )’ = x
Theorem 4, Associative x + (y + z) = (x + y) + z x  (y  z) = (x  y)  z
Theorem 5, DeMorgan (x + y)’ = x’y’ (xy)’ = x’ + y’
Theorem 6, Absorption x + xy = x x (x + y) = x

Very Important: (Idempotency extension)


(X.Y.Z) + (X.Y.Z) = X.Y.Z
(X+Y+Z) . (X+Y+Z) = X+Y+Z
The Hashemite University 12
Proofs of Boolean Algebra
Theorems I
 Now before start using the Boolean
Algebra theorems beside the postulates
in logic circuits design we must first
proof the correctness of these
theorems.

The Hashemite University 13


Proofs of Boolean Algebra
Theorems II
 Theorem 1 (a): x + x = x
Proof:
x+x = (x+x).1 (identity)
= (x+x).(x+x’) (complement)
= x+x.x’ (distributive)
= x+0 (complement)
=x (identity)
 Theorem 1 (b): x . x = x is hold by duality.

The Hashemite University 14


Proofs of Boolean Algebra
Theorems III
 Theorem 2 (a): x + 1 = 1
Proof:
x+1 = (x+1).1 (identity)
= (x+1).(x+x’) (complement)
= x+x’.1 (distributive)
= x+x’ (identity)
=1 (complement)
 Theorem 2 (b): x . 0 = 0 is hold by duality.
The Hashemite University 15
Proofs of Boolean Algebra
Theorems IV
 Theorem 3: (x’)’ = x
Proof:
Postulate 5 define the existence of
complement. Since the number + its
complement = 1 this means that the
complement of x’ is x which is the same by
applying the complement operator (x’)’.
But remember that the complement is
unique  x = (x’)’

The Hashemite University 16


Proofs of Boolean Algebra
Theorems V
 Theorem 6 (a): x+x.y = x
Proof:
x+x.y = x.1+x.y (identity)
= x.(1+y) (distributive)
= x.(y+1) (commutative)
= x.1 (theorem 2a)
=x (identity)
 Theorem 6 (b): x (x+y) = x is hold by duality.

The Hashemite University 17


Proofs of Boolean Algebra
Theorems VI
 The proofs of both the associative and
DeMorgan’s theorems is hard to be
done in Boolean Algebra Laws. So,
prove them using truth table technique.

The Hashemite University 18


DeMorgan’s Law
 Extension to more than two variables:
(A + B + C + D + ...)’ = A’.B’.C’.D’. ...
(A.B.C.D. ...)’ = A’ + B’ + C’ + D’ + ...
 This can be proved by successive

substitutions.
 So, simply change each ANDOR and

each ORAND and complement every


literal.
The Hashemite University 19
Boolean Algebra Laws
 Consist of Boolean Algebra theorems and
postulates.
 Mainly used to:
 Prove the equivalency of Boolean functions.
 Simplify Boolean functions before
implementation.

The Hashemite University 20


Equivalency Proving
 For a Boolean function F there is only one truth table
that represents its operation. However, there are
infinite Boolean expressions that are equivalent to
this function (i.e. give the same output and have the
same truth table of F).
 Two methods to prove that two (or more) Boolean
functions or expressions are equivalent:
 Using truth tables (if truth table of F is the same as truth
table of G  F and G are equivalent or simply F = G).
 Using Boolean algebra postulates and theorems: start
working in one of the expressions (or both) till you make
them equal.

The Hashemite University 21


Equivalency Proof – Example I
 Prove A. (A + B) = A , Use the laws of
Boolean algebra
A· (A + B)
=A.A+A·B Distributive law
=A+A.B Theorem 1
= A. 1+ A . B Identity
= A .(1+B) Distributive law
=A .1 Identity
=A Identity

The Hashemite University 22


Equivalency Proof – Example II
 Prove (x + y) · (x' + z) = x · z + x' · y
Use the laws of Boolean algebra
(x + y) · (x' + z)
= (x + y) · x' + (x + y) · z Distributive Law
= x · x' + y · x' + x· z + y· z Distributive
Law
= 0 + y· x' + x· z + y· z Complement Law
= y· x' + x· z + 1 · y· z Identity
= y· x' + x· z + (x + x') · y· z Complement Law
= x'· y + x· z + x· y· z + x'· y· z Distributive Law
= (x’· y + x'· y· z) + (x· z + x ·y · z) Commutative
Law
= (x'· y) + (x'· y) · z + (x· z) + (x· z )·y Commutative Law
= A+A · z + ( B+ B ·y) Substitute A for x'· y; B for x· z
= A(1 + z) +B (1 + y) Distributive Law
= A+B Theorem 2
The Hashemite University 23
= x’ ·y + x· z
Equivalency Proof – Example
III
 Prove (x+y)·(x'+z) = x·z + x'·y – use truth table

x y z x' x+y x'+z x·z x'·y (x+y)· (x'+z) x·z + x'·y


0 0 0 1 0 1 0 0 0 0
0 0 1 1 0 1 0 0 0 0
0 1 0 1 1 1 0 1 1 1
0 1 1 1 1 1 0 1 1 1
1 0 0 0 1 0 0 0 0 0
1 0 1 0 1 1 0 0 1 1
1 1 0 0 1 0 0 0 0 0
1 1 1 0 1 1 1 0 1 1
The Hashemite University 24
Boolean Functions Simplification I
 Our objective is to formulate Boolean function that accomplish a
specific task and implement them in hardware.
 A better hardware implementation is the one that has:
 Lower number of gates (lower cost).
 Easier to implement, verify and debug.
 Needs less effort and time to be implemented.
 All of these requirements are tightly coupled with the number of
needed gates to implement the function.
 A function with lower number of literals or terms needs lower
number of gates.
 Literal is a single variable in complemented or non
complemented form. E.g. F = x.y + x.z + x’ has 5 literals.
 Term is a collection of literals that are inputs to a logical gate.
So, a term needs one logical gate to be implemented. E.g. F =
x.y + x.z + x’ has 3 terms.

The Hashemite University 25


Boolean Functions Simplification II
 Based on the equivalency principle, it is possible to
find a Boolean function G that is equivalent to F but
it is simpler (i.e. contains lower number of literals or
terms).
 This is called Boolean functions simplification.
 Simplification techniques:
 Using Boolean algebra laws (human error prone and needs
smartness). No specific method is available that guarantees
finding the simplest function.
 Karnaugh maps: easier, direct, and can simplify function
with up to 5 variables (described in Chapter 3).
 For complex Boolean function CAD tools (optimization tools)
can be used which are mainly based on the usage of
Boolean algebra laws.

The Hashemite University 26


Simplification – Some Techniques I
1. Combining terms XY  XY '  X
Example: abc' d ' abcd '  abd ' [ X  abd ' , Y  c]

2. Adding redundant terms using (Adding xx’, multiplying (x+x’), x + x = x, adding xy to x, etc…)
Example: ab' c  abc  a ' bc  ab' c  abc  abc  a ' bc  ac  bc
Example: (a  bc)(d  e' )  a ' (b' c' )(d  e' )  d  e'
[ X  d  e' , Y  a  bc, Y '  a ' (b' c' )]

3. Eliminating terms X  XY  X
Example: a ' b  a ' bc  a ' b [ X  a ' b]
a ' bc'bcd  a ' bd  a ' bc'bcd [ X  c, Y  bd , Z  a' b]
The Hashemite University 27
Simplification – Some Techniques II

4. Eliminating literals X  X 'Y  X  Y


Example: A' B  A' B ' C ' D' ABCD'  A' ( B  B ' C ' D' )  ABCD'
 A' ( B  C ' D' )  ABCD'
 B ( A' ACD' )  A' C ' D'
 B ( A'CD' )  A' C ' D'
 A' B  BCD' A' C ' D'

The Hashemite University 28


Simplification – Example I
 Simplify the expression of XZ + Z(X'+
XY) using the laws of Boolean algebra
= XZ+ZX‘+ZXY
= XZ+ZX’+(XZ)Y Commutative law
= XZ (1 + Y) +ZX’
= ZX+ZX’ Commutative law
= Z(X+X’) Factoring
= Z

The Hashemite University 29


Simplification – Example II
 Simplify (a'b + a'b' + b')'
(a'b + a'b' + b')'
= ( a‘ (b + b') + b')' Distributive law
= (a' + b')' Complement
= (a' ) ' (b' )' DeMorgan's
law
=ab Definition of NOT

The Hashemite University 30


Simplification – Example III
 Simplify xy + x’z + yz
xy + x’z + yz = xy + x’z + (x + x’)yz
= (xy + xyz) + (x’z +
x’yz)
= xy(1+z) + x’z(1+y)
= xy.1 + x’z.1
= xy + x’z
The Hashemite University 31
Complement of Boolean
Functions
 F’ is the complement of function F which is
equal to 0 when F equals to 1 and vice versa.
 The addition of F and F’ (addition of the
output for a specific input combination)
makes the resulting truth table equals 1 for
all outputs.
 Three methods to find the complement of a
function:
 Using DeMorgan’s theorem.
 Taking the dual of F then invert each literal.
 Using the truth table of F as will be shown later.
The Hashemite University 32
Complement Using DeMorgan
-- Example
 Given F = x +y(z+y’) find F’
F = x +y(z+y’) since y+y’ = 1
= x + yz
F’ = (x +yz )’
= x’.(yz)’
= x’.(y’ + z’)
= x’y’ + x’z’
The Hashemite University 33
Complement Using Duality
and Inversion -- Example
 Given F = x +y(z+y’) find F’
The dual of F = x.(y+z.y’)
Then invert each literal, interchange AND and OR
operators:
F’ = x’.(y’ + z’y)
Using the distributive law:
F’ = x’y’ + x’yz’
= x’y’ + x’y’z’ + x’yz’
= x’y’ + x’z’

The Hashemite University 34


Boolean Functions Canonical
Forms Representation I
 It is a way to represent the equation
(inputs and outputs) of a function.
 Canonical form means that the function
is represented as a sum of minterms or
as a product of maxterms.
 But what are minterms and maxterms?

The Hashemite University 35


Boolean Functions Canonical
Forms Representation II
 Minterm is the product (ANDing) of all available
inputs that appear as either complemented or
uncomplemented in one term (i.e. need one gate to
implement this term which is an AND gate). Minterm
is also called a standard product. E.g.: for F(x, y, z)
the following are possible minterms: x’yz’, xyz, x’y’z’,
etc.
 Maxterms is the sum (ORing) of all available inputs
that appear as either complemented or
uncomplemented in one term (i.e. need one gate to
implement this term which is an OR gate). Maxterm
is also called a standard sum. E.g.: for F(x, y, z) the
following are possible maxterms: (x’+y+z’), (x+y+z),
(x’+y’+z’), etc.
The Hashemite University 36
Boolean Functions Canonical
Forms Representation III
 How to obtain the maxterms and minterms?
 From the truth table. For all possible combinations of
the inputs you can get either the minterm or the
maxterm that expresses them. So, for n-variables you
have 2n minterms and 2n maxterms.
 To from a minterm combine all inputs with an AND gate.
The inputs that are equal to 0 give them a prime
(inverter).
 To from a maxterm combine all inputs with an OR gate.
The inputs that are equal to 1 give them a prime
(inverter).
 For example in the truth table found in the next slide,
for the first entry (0,0,0) the minterm is x’y’z’ whereas
the maxterm is (x + y+ z).
The Hashemite University 37
Boolean Functions Canonical
Forms Representation IV
 A minterm is given the following symbol: mj where
j is the decimal value of the binary value
represented by the inputs of the minterm.
 A maxterm is given the following symbol: Mj
where j is the decimal value of the binary value
represented by the inputs of the maxterm.
 Pay attention to the following: the evaluation of
the minterm by substituting the values of the
inputs that expresses it = 1, the evaluation of the
maxterm by substituting the values of the inputs
that expresses it = 0.

The Hashemite University 38


Minterms and Maxterms for a
3 variables
Minterms Maxterms
xyz Term Designation Term Designation
000 x’y’z’ mo x+y+z Mo
001 x’y’z m1 x+y+z’ M1
010 x’yz’ m2 x+y’+z M2
011 x’yz m3 x+y’+z’ M3
100 xy’z’ m4 x’+y+z M4
101 xy’z m5 x’+y+z’ M5
110 xyz’ m6 x’+y’+z M6
111 xyz m7 x’+y’+z’ M7
The Hashemite University 39
Sum of Minterms Boolean
Function Representation
 From the truth table of the function,
combine all minterms with and OR xyz F
gates that have 1 in the function 000 0
output. 001 1
 Example: the function F represented by
010 1
the following truth table have 1’s in the
011 0
location of minterms 1, 2, and 5. So:
100 0
F = m1 +m2 +m5 = x’y’z + x’yz’ + xy’z
101 1
= ∑(1, 2, 5)
 Its logic circuit is a two level AND-OR
110 0
circuit (similar to the sum of product). 111 0

The Hashemite University 40


Sum of Minterms Conversion
 To convert the representation of a
function to sum of minterms canonical
form do the following:
 Expand the given function into sum of
products using the distributive law.
 Inspect each term, if it misses a variable
then AND it with (x + x’) where x is the
missing variable.

The Hashemite University 41


Example
 Express F = xy + z as a sum of minterms.
F = xy(z+z’) + z(x+x’)(y+y’)
= xyz + xyz’ + (zx+zx’)(y+y’)
= xyz + xyz’ + xz(y+y’) + x’z(y+y’)
= xyz + xyz’ + xyz + xy’z + x’yz + x’y’z
= xyz + xyz’ + xy’z + x’yz + x’y’z
= m7 + m 6 + m 5 + m 3 + m 1

The Hashemite University 42


Product of Maxterms Boolean
Function Representation
• From the truth table of the function, xyz F
combine all maxterms with and AND 000 0
gates that have 0 in the function output. 001 1
• Example: the function F represented by
010 1
the following truth table have 0’s in the
location of maxterms 0, 3, 4, 6 and 7. So: 011 0

F = M0 . M 3 . M 4 . M 6 . M 7
100 0
= (x+y+z)(x+y’+z’)(x’+y+z)(x’+y’+z)(x’+y’+z’) 101 1
= ∏(0, 3, 4, 6, 7) 110 0
 Its logic circuit is a two level OR-AND 111 0
circuit.
The Hashemite University 43
Product of Maxterms Conversion
 To convert the representation of a
function to product of maxterms
canonical form do the following:
 Expand the given function into product of
sums using the distributive law.
 Inspect each term, if it misses a variable
then OR it with (x.x’) where x is the
missing variable and apply the distributive
law again.

The Hashemite University 44


Example
 Express F = xy + z as a product of maxterms.
F = z+xy
= (z+x)(z+y)
= (z+x + y.y’)(z+y + x.x’)
= (x+y+z)(x+y’+z)(x+y+z)(x’+y+z)
= (x+y+z)(x+y’+z)(x’+y+z)
= M0.M2.M4

The Hashemite University 45


Finding the Complement of a
Function Using Truth Table
 The complement of a function expressed as
sum of minterms equals the minterms that
are missing from the function (have output of
0 in the truth table).
 The complement of a function expressed as
product of maxterms equals the maxterms
that are missing from the function (have
output of 1 in the truth table).

The Hashemite University 46


Example
 As a sum of minterms: xyz F
F = m1 +m2 +m5 000 0
001 1
F’ = m0 + m3 + m4 + m6 +
010 1
m7 011 0
 As a product of 100 0
maxterms: 101 1
F = M0 . M3 . M4 . M6 . M7 110 0
111 0
F’ = M1.M2.M5
The Hashemite University 47
Conversion Between Canonical
Forms I
 Sum of minterms  product of
maxterms:
 Find F’ (listing all missing minterms in F)
then again find (F’)’ using DeMorgan Law
and you will obtain F in product of
maxterms format.
 Or simply list the maxterms with the same
subscripts of the missing minterms in F.
 Note that (mj)’ = Mj by DeMorgan Law
The Hashemite University 48
Conversion Between Canonical
Forms II
 Product of maxterms  sum of
minterms:
 Find F’ (listing all missing maxterms in F)
then again find (F’)’ using DeMorgan Law
and you will obtain F in sum of minterms
format.
 Or simply list the minterms with the same
subscripts of the missing maxterms in F.
 Note that (Mj)’ = mj by DeMorgan Law
The Hashemite University 49
Boolean Functions Standard
Form Representation
 Recall that any term in the canonical form contains
all inputs of the function. However, if these terms
contain some of the inputs (or all) the function is in
the standard form.
 Two types of standard form:
 Sum of products (SOP): implemented as AND-OR circuit.
 Product of sums (POS): implemented as OR-AND circuit.
 E.g.: F = x + yz is SOP standard form and G =
x(y+z) is POS standard form.
 Nonstandard from is neither POS nor SOP, it contains
a mix of them. E.g.: F = xy + x(y+z) is nonstandard.
 Nonstandard from may need more than two level
circuit to model them.
The Hashemite University 50
Extension to Multiple Inputs I
 All the logical gates that we have taken
(except the unary ones) can be extended to
have multiple inputs.
 The only condition for that is the binary
operation represented by the gate must be
associative and commutative. E.g. OR and
AND gates.
 NAND and NOR gates are not associative.
However, to make them extendable we define
them as an inverted AND and as an inverted
OR respectively. E.g.: three input NAND gate
have the expression of (x.y.z)’
The Hashemite University 51
Extension to Multiple Inputs II
 XOR and XNOR are both commutative and
associative  can be extended to multiple inputs.
 Uncommon from hardware point of view.
 Multi-input XOR gate (more than 2 inputs) is called
an odd-function since it produces 1 if and only if the
number of 1’s (inputs that are 1) is odd. Otherwise, it
will gives an output of 0.
 Multi-input XNOR gate (more than 2 inputs) is called
an even-function since it produces 1 if and only if the
number of 1’s (inputs that are 1) is even. Otherwise,
it will gives an output of 0.

The Hashemite University 52


Additional Notes
 This lecture covers the following
material from the textbook:
 Chapter 2: Sections 2.1 – 2.6

The Hashemite University 53

You might also like