Upload
ledan
View
253
Download
0
Embed Size (px)
Citation preview
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.
Spring, 2018
http://www.cs.nctu.edu.tw/~ldvan/
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-2
Outlines
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
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-3
History
In 1854, George Boole developed an
algebraic system
Now, called Boolean algebra
In 1904, E. V. Huntington formulated
several postulates for Boolean
algebra.
Widely used in research nowadays.
In 1938, C. E. Shannon introduced a
two-valued Boolean algebra
Called switching algebra
https://en.wikipedia.org/wiki/George_Boole
http://www.bjinnovate.com/archives/515105.html
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-4
Basic Definitions of Algebra
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. Commutative law: A binary operator * on a set S is said to be commutative 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 eS 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 yS 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)
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-5
Axiomatic Definition of Boolean Algebra
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 commutative with respect to +.
x+y = y+x
(b) The structure is commutative with respect to ‧.
x‧y = y‧x
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-6
Axiomatic Definition of Boolean Algebra
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.
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-7
Two-Valued Boolean Algebra
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 y xy x y x+y x x
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
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-8
Two-Valued Boolean Algebra
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 0+1=1+0=1;
1‧1=1 1‧0=0‧1=0
=> Two identity elements
Postulate 3: The commutative laws are obvious from the
symmetry of the binary operator tables.
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-9
Two-Valued Boolean Algebra
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
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-10
Basic Theorems and Properties
Duality
The binary operators are interchanged; AND OR
The identity elements are interchanged; 1 0
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-11
• Theorem 1(a): x+x = x
– x+x = (x+x) 1 by postulate 2(b)
= (x+x) (x+x') 5(a)
= x+xx' 4(b)
= x+0 5(b)
= x 2(a)
– Theorem 1(b): x‧x = x
– x‧x = x‧ x + 0 by postulate 2(a)
= xx + xx' 5(b)
= x (x + x') 4(a)
= x‧1 5(a)
= x 2(b)
Basic Theorems and Properties
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-12
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')'
Basic Theorems and Properties
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-13
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 y xy x + xy
0 0 0 0
0 1 0 0
1 0 0 1
1 1 1 1
Basic Theorems and Properties
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-14
DeMorgan's Theorems
(x+y)' = x' y'
(x y)' = x' + y‘
Operator Precedence
– Parentheses
– NOT
– AND
– OR
x y x+y (x+y) x y xy
0 0 0 1 1 1 1
0 1 1 0 1 0 0
1 0 1 0 0 1 0
1 1 1 0 0 0 0
Basic Theorems and Properties
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-15
Boolean Functions
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
F3=F4 Why and How to Verify???
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-16
Boolean Functions The truth table of 2n entries
Two Boolean expressions may specify the same function
F3 = F4
x y z F1 F2 F3 F4
0 0 0 0 0 0 0
0 0 1 0 1 1 1
0 1 0 0 0 0 0
0 1 1 0 0 1 1
1 0 0 0 1 1 1
1 0 1 0 1 1 1
1 1 0 1 1 0 0
1 1 1 0 1 0 0
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-17
• Implementation with logic gates
• F4 is more economical
F3
F4
F2
Boolean Functions
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-18
Algebraic Manipulation
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
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-19
Complement of a Function
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'
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-20
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
Complement of a Function
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-21
Canonical and Standard Forms
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
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-22
Each maxterm is the complement of its corresponding
minterm, and vice versa
x y z term Term
0 0 0 x‘y’z‘ m0 x+y+z M0
0 0 1 x‘y’z m1 x+y+z‘ M1
0 1 0 x‘yz‘ m2 x+y‘+z M2
0 1 1 x‘yz m3 x+y‘+z‘ M3
1 0 0 xy’z‘ m4 x‘+y+z M4
1 0 1 xy’z m5 x‘+y+z‘ M5
1 1 0 xyz‘ m6 x‘+y‘+z M6
1 1 1 xyz m7 x‘+y‘+z‘ M7
Canonical and Standard Forms
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-23
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 y z f1 f2
0 0 0 0 0
0 0 1 1 0
0 1 0 0 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 0
Canonical Forms
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-24
Canonical Forms
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”
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-25
Canonical Forms
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
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-26
Canonical Forms
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
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-27
Conversion between Two Canonical Forms
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
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-28
Conversion between Two Canonical Forms
Example
F = xy + xz
F(x, y, z) = S(1, 3, 6, 7)
F(x, y, z) = P (0, 2, 4, 5)
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-29
Standard Forms
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)
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-30
Standard Forms
Multi-level implementation
Example 3: F3 = AB+C(D+E)=AB+CD+CE
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-31
Other Logic Operations
2n rows in the truth table of n binary variables
22nfunctions 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
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-33
Digital Logic Gates
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: null and identity are equal to a constant
four: inhibition, implication, transfer, complement are repeated twice
inhibition and implication are not commutative or associative.
eight: transfer, complement, AND, OR, NAND, NOR, XOR, and equivalence are used as standard gates
complement: inverter
transfer: buffer (increasing drive strength)
equivalence: XNOR
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-36
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
Digital Logic Gates
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-37
NAND and NOR are commutative but not associative
=> they are not extendable
Digital Logic Gates
z
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-38
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
Digital Logic Gates
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-39
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
Digital Logic Gates
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-40
Positive and Negative Logic
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
Lecture 2
Digital Circuit Design
Lan-Da Van DCD-02-42
Conclusions
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