Lecture 2 Boolean Algebra and Logic Gates

Digital Circuit Design
Boolean Algebra and
Logic Gates
Lan-Da Van (范倫達), Ph. D.
Department of Computer Science
National Chiao Tung University
Taiwan, R.O.C.
Fall, 2012
[email protected]
http://www.cs.nctu.edu.tw/~ldvan/
Digital Circuit Design
Outlines
Lecture 2
Basic Definitions of Algebra
Axiomatic Definitions of Boolean Algebra
Basic Theorems and Properties of Boolean Algebra
Boolean Function
Canonical and Standard Forms
Other logic Operations
Digital Logic Gates
Lan-Da Van
DCD-02-2
Digital Circuit Design
Basic Definitions of Algebra
Lecture 2
Basic definitions:






1. Closure: A set S is closed with respective to a binary
operator if, for every pair of elements of S, the binary operator
specifies a rule for obtaining a unique element of S.
2. Associative law: A binary operator * on a set S is said to be
associative whenever (x*y)*z= x*(y*z) for all x, y, z  S.
3. Communicative law: A binary operator * on a set S is said to
be communicative whenever x*y= y*x for all x, y  S.
4. Identity element: A set S is said to have an identity element
with respect to a binary operation * on S if there exists an
element eS with the property that x*e = e*x =x for every x  S.
5. Inverse: A set S having the identity element e with respect to
a binary operation * is said to have an inverse whenever x  S,
there exists an element yS such that x*y = e.
6. Distributive law: If * and ‧are two binary operators on a set
S, * is said to be distributive over ‧ whenever
x*(y‧z)=(x*y)‧(x*z)
Lan-Da Van
DCD-02-3
Digital Circuit Design
History
Lecture 2
In 1854, George Boole developed an algebraic
system

Now, called Boolean algebra
In 1938, C. E. Shannon introduced a two-valued
Boolean algebra

Called switching algebra
In 1904, E. V. Huntington formulated several
postulates for Boolean algebra.

Widely used in research nowadays.
Lan-Da Van
DCD-02-4
Axiomatic Definition of
Boolean Algebra
Digital Circuit Design
Lecture 2
Boolean Algebra defined by a set of elements B and two binary
operators + and ‧ and has the following postulates:
Postulate 1:


(a) The structure is closed with respect to the operator +.
(b) The structure is closed with respect to the operator ‧.
Postulate 2:

(a) The element 0 is an identity element with respect to +.
0+x = x+0 = x

(b) The element 1 is an identity element with respect to ‧.

1‧x = x‧1= x

Postulate 3:




(a) The structure is communicative with respect to +.
x+y = y+x
(b) The structure is communicative with respect to ‧.
x‧y = y‧x
Lan-Da Van
DCD-02-5
Axiomatic Definition of
Boolean Algebra
Digital Circuit Design
Lecture 2
Postulate 4:




(a) The operator ‧ is distributive over +:
x‧(y+z)=(x‧y)+(x‧z)
(b) The operator + is distributive over‧
x+(y‧z)=(x+y)‧(x+z)
Postulate 5:

(a) For every element x  B, there exists an element x'  B
(complement of x) such that (a) x+x'=1 and (b) x‧x'=0.
Postulate 6: There exist at least two elements x, y  B such
that x ≠ y.
Difference with ordinary algebra



The operator + is distributive over‧ is valid for Boolean algebra,
but not for ordinary algebra.
Boolean algebra does not have additive and multiplicative inverses;
therefore, there are not subtraction or division operations.
Complement is valid for Boolean algebra, but not for ordinary
algebra.
Lan-Da Van
DCD-02-6
Digital Circuit Design
Two-Valued Boolean Algebra
Lecture 2
Definition: A two-valued Boolean algebra is
defined on a set of two elements, B = {0,1},
with rules for the two binary operators + and
‧ as shown in the following operator tables.
The rules of operations
x
0
0
1
1
y
0
1
0
1
xy
0
0
0
1
x
0
0
1
1
Lan-Da Van
y
0
1
0
1
x+y
0
1
1
1
x x
0 1
1 0
DCD-02-7
Digital Circuit Design
Two-Valued Boolean Algebra
Lecture 2
Postulate 1: The structure is closed with respect to the two
operators is obvious from the tables since the result of each
operation is either 1 or 0 and {1, 0}  B.
Postulate 2: From the table, we see that


0+0=0
1‧1=1
0+1=1+0=1;
1‧0=0‧1=0
=> Two identity elements
Postulate 3: The communicative laws are obvious from the
symmetry of the binary operator tables.
Lan-Da Van
DCD-02-8
Digital Circuit Design
Two-Valued Boolean Algebra
Lecture 2
Postulate 4: The distributive law can be shown to
hold from the truth table of all possible values of x, y,
and z.
Postulate 5: Complement


x+x'=1: since 0+0'=0+1=1 and 1+1'=1+0=1
x‧x'=0: since 0‧0'=0‧1=0 and 1‧1'=1‧0=0
Postulate 6: Has two distinct elements 1 and 0, with 0
≠1
Note




A set of two elements
+ : OR operation; ‧ : AND operation
A complement operator: NOT operation
Binary logic is a two-valued Boolean algebra
Lan-Da Van
DCD-02-9
Digital Circuit Design
Basic Theorems and Properties
Lecture 2
Duality


The binary operators are interchanged; AND  OR
The identity elements are interchanged; 1  0
Lan-Da Van
DCD-02-10
Digital Circuit Design
Basic Theorems and Properties
Lecture 2
• Theorem 1(a): x+x = x
– x+x = (x+x) 1
= (x+x) (x+x')
= x+xx'
= x+0
=x
by postulate 2(b)
5(a)
4(b)
5(b)
2(a)
– Theorem 1(b): x‧x = x
– x‧x = x‧ x + 0
= xx + xx'
= x (x + x')
= x‧1
=x
by postulate 2(a)
5(b)
4(a)
5(a)
2(b)
Lan-Da Van
DCD-02-11
Digital Circuit Design
Basic Theorems and Properties
Lecture 2
Theorem 2(a): x + 1 = 1

x + 1 = 1 (x + 1)
= (x + x')(x + 1)
= x + x' 1
= x + x‘ = 1
Theorem 2(b): x ‧0 =0

By duality
Theorem 3: (x')' = x


Postulate 5 defines the complement of x, x + x' = 1 and x‧x' = 0
The complement of x' is x is also (x')'
Lan-Da Van
DCD-02-12
Digital Circuit Design
Basic Theorems and Properties
Lecture 2
Theorem 6 (a): x + xy = x

x + xy = x 1 + xy
= x (1 +y)
= x‧1
=x
Theorem 6 (b): x(x+y) = x

By duality
By means of truth table
x
0
0
1
1
y
0
1
0
1
xy
0
0
0
1
x + xy
0
0
1
1
Lan-Da Van
DCD-02-13
Digital Circuit Design
Basic Theorems and Properties
Lecture 2
DeMorgan's Theorems


(x+y)' = x' y'
(x y)' = x' + y‘
x
0
0
1
1
y
0
1
0
1
x+y
0
1
1
1
(x+y) x
1
1
0
1
0
0
0
0
y
1
0
1
0
xy
1
0
0
0
Operator Precedence
–
–
–
–
Parentheses
NOT
AND
OR
Lan-Da Van
DCD-02-14
Digital Circuit Design
Boolean Functions
Lecture 2
A Boolean function




binary variables
binary operators OR and AND
unary operator NOT
parentheses
Examples




F1= x y z'
F2 = x + y'z
F3 = x' y' z + x' y z + x y'
F4 = x y' + x' z
Lan-Da Van
DCD-02-15
Digital Circuit Design
Boolean Functions

Lecture 2
The truth table of 2n entries
x
0
0
0
0
1
1
1
1
y
0
0
1
1
0
0
1
1
z
0
1
0
1
0
1
0
1
F1
0
0
0
0
0
0
1
0
F2
0
1
0
0
1
1
1
1
F3
0
1
0
1
1
1
0
0
F4
0
1
0
1
1
1
0
0
Two Boolean expressions may specify the same function

F3 = F4
Lan-Da Van
DCD-02-16
Digital Circuit Design
Boolean Functions
Lecture 2
F2
• Implementation with
logic gates
• F4 is more economical
F3
F4
Lan-Da Van
DCD-02-17
Digital Circuit Design
Algebraic Manipulation
Lecture 2
To minimize Boolean expressions










literal: a primed or unprimed variable (an input to a gate)
term: an implementation with a gate
The minimization of the number of literals and the number of
terms => a circuit with less equipment
It is a hard problem (no specific rules to follow)
Ex1: x(x'+y) = xx' + xy = 0+ xy = xy
Ex2: x+x'y = (x+x')(x+y) = 1 (x+y) = x+y
Ex3: (x+y)(x+y') = x+xy+xy'+yy' = x(1+y+y') = x
Ex4: x'y'z + x'yz + xy' = x'z(y'+y) + xy'= x'z + xy'
Ex5: xy + x'z + yz = xy + x'z + yz(x+x')= xy + x'z + yzx + yzx'
= xy(1+z) + x'z(1+y) = xy +x'z
Ex6: (x+y)(x'+z)(y+z) = (x+y)(x'+z) by duality from the
previous result
Lan-Da Van
DCD-02-18
Digital Circuit Design
Complement of a Function
Lecture 2
Complement Procedures:



An interchange of 0's for 1's and 1's for 0's in the value of F
By DeMorgan's theorem
(A+B+C)' = (A+X)'
let B+C = X
= A'X‘
by DeMorgan's
= A'(B+C)'
by DeMorgan's
= A'(B'C')
by associative
= A'B'C'
Generalizations


(A+B+C+ ... +F)' = A'B'C' ... F'
(ABC ... F)' = A'+ B'+C'+ ... +F'
Lan-Da Van
DCD-02-19
Digital Circuit Design
Complement of a Function
Lecture 2
Complement Examples:


(x'yz' + x'y'z)' = (x'yz')' (x‘y'z)'
= (x+y'+z) (x+y+z')
[x(y'z'+yz)]' = x' + ( y'z'+yz)'
= x' + (y'z')' (yz)'
= x' + (y+z) (y'+z')
A simpler procedure



take the dual of the function and complement each literal
Step 1: x'yz' + x'y'z => (x’yz') + (x’y’z) with function dual
Step 2: (x‘yz') (x’y’z) => (x+y'+z)(x+y+z') with
complementing each literal.
Lan-Da Van
DCD-02-20
Digital Circuit Design
Canonical and Standard Forms
Lecture 2
Minterms


A minterm (also called a standard product): an AND term
consists of all literals in their normal form or in their
complement form
For example, two binary variables x and y,
 xy, xy', x'y, x'y'

n variables has 2n minterms
Maxterms


A maxterm (also called a standard sum): an OR term
For example, two binary variables x and y,
 x+y, x+y', x‘+y, x‘+y'

n variables has 2n maxterms
Lan-Da Van
DCD-02-21
Digital Circuit Design
Canonical and Standard Forms
Lecture 2

Each maxterm is the complement of its corresponding
minterm, and vice versa
x
0
0
0
0
1
1
1
1
y
0
0
1
1
0
0
1
1
z
0
1
0
1
0
1
0
1
term
x‘y’z‘
x‘y’z
x‘yz‘
x‘yz
xy’z‘
xy’z
xyz‘
xyz
m0
m1
m2
m3
m4
m5
m6
m7
Term
x+y+z
x+y+z‘
x+y‘+z
x+y‘+z‘
x‘+y+z
x‘+y+z‘
x‘+y‘+z
x‘+y‘+z‘
Lan-Da Van
M0
M1
M2
M3
M4
M5
M6
M7
DCD-02-22
Digital Circuit Design
Canonical Forms
Lecture 2
A Boolean function can be expressed by




a truth table
sum of minterms
f1 = x'y'z + xy'z' + xyz = m1 + m4 +m7 =S(1, 4, 7)
f2 = x'yz+ xy'z + xyz'+xyz = m3 + m5 +m6 + m7 =S(3, 5, 6, 7)
x
0
0
0
0
1
1
1
1
y
0
0
1
1
0
0
1
1
z
0
1
0
1
0
1
0
1
f1
0
1
0
0
1
0
0
1
f2
0
0
0
1
0
1
1
0
Lan-Da Van
DCD-02-23
Digital Circuit Design
Canonical Forms
Lecture 2
The complement of a Boolean function


Find the minterms that produce a 0
f1' = m0 + m2 +m3 + m5 + m6
= x'y'z'+x'yz'+x'yz+xy'z+xyz'

f1 = (f1')'
= (x+y+z)(x+y'+z) (x+y'+z') (x'+y+z')(x'+y'+z)
= M0 M2 M3 M5 M6

Any Boolean function can be expressed as
 A sum of minterms
 A product of maxterms
 Both are called “canonical form”
Lan-Da Van
DCD-02-24
Digital Circuit Design
Canonical Forms
Lecture 2
Sum of minterms

F = A+B'C
= A (B+B') + B'C
= AB +AB' + B'C
= AB(C+C') + AB'(C+C') + (A+A')B'C
=ABC+ABC'+AB'C+AB'C'+A'B'C


F(A,B,C)
= A'B'C +AB'C' +AB'C+ABC'+ ABC
= m1 + m4 +m5 + m6 + m7
= S(1, 4, 5, 6, 7)

Or, built the truth table first


Lan-Da Van
DCD-02-25
Digital Circuit Design
Canonical Forms
Lecture 2
Product of maxterms

F1(x,y,z) =F1 = (x+y+z)(x+y'+z)(x'+y+z)(x'+y+z')
= M0M2M4M5 = P(0,2,4,5)

F2= x + yz = (x + y)(x + z)
= (x+y+zz')(x+z+yy')
=(x+y+z)(x+y+z’)(x+y'+z)

F3 = x'+y = x' + y + zz'
= (x'+y+z)(x'+y+z')

F4 = xy + x'z
= (xy + x') (xy +z)
= (x+x')(y+x')(x+z)(y+z)
= (x'+y)(x+z)(y+z)
=(x+y+z)(x+y'+z)(x'+y+z)(x'+y+z')
=M0M2M4M5
Lan-Da Van
DCD-02-26
Conversion between Two
Canonical Forms
Digital Circuit Design
Lecture 2
Conversion between Canonical Forms







F(A,B,C) = S(1,4,5,6,7)
F'(A,B,C) = S(0,2,3)
By DeMorgan's theorem
F(A,B,C) = P(0,2,3)
mj' = Mj
Interchange the symbols S and P and list those numbers
missing from the original form
S of 1's
P of 0's
Lan-Da Van
DCD-02-27
Conversion between Two
Canonical Forms
Digital Circuit Design
Lecture 2
Example



F = xy + xz
F(x, y, z) = S(1, 3, 6, 7)
F(x, y, z) = P (0, 2, 4, 5)
Lan-Da Van
DCD-02-28
Digital Circuit Design
Standard Forms
Lecture 2
Standard Forms

Canonical forms are seldom used
sum of products

Example 1: F1 = y' + xy+ x'yz'
product of sums

Example 2: F2 = x(y'+z)(x'+y+z)
Lan-Da Van
DCD-02-29
Digital Circuit Design
Standard Forms
Lecture 2
Multi-level implementation

Example 3: F3 = AB+C(D+E)=AB+CD+CE
Lan-Da Van
DCD-02-30
Digital Circuit Design
Other Logic Operations
Lecture 2
2n rows in the truth table of n binary variables
n
2
2 functions for n binary variables
16 functions of two binary variables
All the new symbols except for the exclusive-OR symbol are not in
common use by digital designers
Lan-Da Van
DCD-02-31
Digital Circuit Design
Other Logic Operations
Lan-Da Van
Lecture 2
DCD-02-32
Digital Circuit Design
Digital Logic Gates
Lecture 2
Boolean expression: AND, OR and NOT operations
Constructing gates of other logic operations




the feasibility and economy
the possibility of extending gate's inputs
the basic properties of the binary operations
the ability of the gate to implement Boolean functions
Consider the 16 functions







two are equal to a constant
four are repeated twice
inhibition and implication are not commutative or associative
the other eight: complement, transfer, AND, OR, NAND,
NOR, XOR, and equivalence are used as standard gates
complement: inverter
transfer: buffer (increasing drive strength)
equivalence: XNOR
Lan-Da Van
DCD-02-33
Digital Circuit Design
Digital Logic Gates
Lan-Da Van
Lecture 2
DCD-02-34
Digital Circuit Design
Digital Logic Gates
Lan-Da Van
Lecture 2
DCD-02-35
Digital Circuit Design
Digital Logic Gates
Lecture 2
Extension to multiple inputs

A gate can be extended to multiple inputs
 if its binary operation is commutative and associative

AND and OR are commutative and associative
 (x+y)+z = x+(y+z) = x+y+z
 (x y)z = x(y z) = x y z
Lan-Da Van
DCD-02-36
Digital Circuit Design
Digital Logic Gates
Lecture 2
NAND and NOR are commutative but not associative
=> they are not extendable
z
Lan-Da Van
DCD-02-37
Digital Circuit Design
Digital Logic Gates




Lecture 2
Multiple NOR = a complement of OR gate
Multiple NAND = a complement of AND
The cascaded NAND operations = sum of products
The cascaded NOR operations = product of sums
Lan-Da Van
DCD-02-38
Digital Circuit Design
Digital Logic Gates



Lecture 2
The XOR and XNOR gates are commutative and associative
Multiple-input XOR gates are uncommon?
XOR is an odd function: it is equal to 1 if the inputs variables have
an odd number of 1's
Lan-Da Van
DCD-02-39
Digital Circuit Design
Positive and Negative Logic
Lecture 2
Positive and Negative Logic



two signal values <=> two logic
values
positive logic: H=1; L=0
negative logic: H=0; L=1
Consider a TTL gate



a positive logic NAND gate
a negative logic OR gate
the positive logic is used in this book
Lan-Da Van
DCD-02-40
Digital Circuit Design
Lecture 2
Lan-Da Van
DCD-02-41
Digital Circuit Design
Conclusions
Lecture 2
From this lecture, you have learned the follows:







Basic Definitions of Algebra
Axiomatic Definitions of Boolean Algebra
Basic Theorems and Properties of Boolean Algebra
Boolean Function
Canonical and Standard Forms
Other logic Operations
Digital Logic Gates
Lan-Da Van
DCD-02-42