Digital Logic

Definition: Chapter 3 digit, n. any of the Arabic figures of 0 through 9. digital, adj. involving using digits to Boolean Algebra and Combinational represent discretely all variables occurring Networks in a given problem. logic, n. a particular method of reasoning or argumentation.

J. C. Huang, 2003 Digital Logic Design 1

Analog Systems Digital vs. Analog

Definition: Digital solution to a problem is analog, adj. that solve a given problem by advantageous in that it allows us to build using physical analogies, such as electric more reliable components and implement voltages or shaft rotations (which are more sophisticated functions. quantitatively continuous), of the numerical variables occurring in the problem.

J. C. Huang, 2003 Digital Logic Design 2 J. C. Huang, 2003 Digital Logic Design 3

Two main types of logic circuit: General form of a combinational circuit:

• Combinational (without memory) - chapters 2-6 x1 • Sequential (with memory) - chapters 7 and 8 f1(x1, x2, … xm)

x2 f2(x1, x2, … xm)

xm fn(x1, x2, … xm)

J. C. Huang, 2003 Digital Logic Design 4 J. C. Huang, 2003 Digital Logic Design 5

1 For example, the behavior Truth table of the combinational circuit x to the right can be described f(x, y) • The behavior of a combinational circuit can by the truth table shown y below: always be specified by using a truth table.

x y f(x, y) A truth table exhaustively 0 0 f(0, 0) lists all possible input-output 0 1 f(0, 1) pairs. 1 0 f(1, 0) 1 1 f(1, 1)

J. C. Huang, 2003 Digital Logic Design 6 J. C. Huang, 2003 Digital Logic Design 7

Example of a truth table Three Basic Logic Devices x y f(x, y)

0 0 0 x x x NOT y OR z AND z 0 1 1 y y

1 0 1 yy OR x NOT x 01AND 0 1 1 1 0 0 1 00 1 00 0 xx 1 0 11 1 10 1

J. C. Huang, 2003 Digital Logic Design 8 J. C. Huang, 2003 Digital Logic Design 9

Logic symbols for the basic gates x y f(x, y) x 0 0 1 f(x, y) 0 1 1 x x x•y x+y y 1 0 0 y y 1 1 1

AND gate OR gate The intended function of this combinational circuit can be directly described by the truth table on the right, which can be represented by the below: xx’ f(x, y) = x’y’ + x’y + xy NOT gate which can be realized by the logic circuit shown in the next slide.

J. C. Huang, 2003 Digital Logic Design 10 J. C. Huang, 2003 Digital Logic Design 11

2 x xy y Algebra (Mathematical System) x’y f An algebra (or a mathematical system) consists of

S = x’y’ 1 2 k 1 2 m 1 2 n

Realization of f(x, y) = x’y’ + x’y + xy where oi's are operations defined on S, ri's are relations defined among elements of S, and ci's are constants, some elements of S having some special significance. x Furthermore, it satisfies a set of axioms or postulates y f that governs its behavior. Minimal realization of f(x, y)

J. C. Huang, 2003 Digital Logic Design 12 J. C. Huang, 2003 Digital Logic Design 13

Boolean Algebras Boolean Algebras (continued)

A Boolean algebra is a mathematical system: 2a. Existence of identity: there exists an element in B, denoted by 0, such that x+0=x for any x ∈ B. • B = 2b. Existence of identity: there exists an element in B, denoted by 1, such that x•1=x for any x ∈ B. that satisfies the following postulates: 3a. Commutativity: for any x, y ∈ B, x+y = y+x. ∈ ∈ 1a. Closure: for any x, y B, x+y B. 3b. Commutativity: for any x, y ∈ B, x•y = y•x. 1b. Closure: for any x, y ∈ B, x•y ∈ B.

J. C. Huang, 2003 Digital Logic Design 14 J. C. Huang, 2003 Digital Logic Design 15

Boolean Algebras (continued) Boolean Algebras (continued)

4a. Distributive law: for any x, y, z ∈ B, 6. There exists at least two elements in B x•(y+z) = (x•y)+(x•z). These are known as the Huntington postulates. 4b. Distributive law: for any x, y, z ∈ B, x+(y•z) = (x+y)•(x+z). 5. For any element x ∈ B there exists an element x' ∈ B such that (a) x+x'=1 and (b) x•x'=0.

J. C. Huang, 2003 Digital Logic Design 16 J. C. Huang, 2003 Digital Logic Design 17

3 Huntington postulates Theorems

1. (a) x+y ∈ B (b) x•y ∈ B Thm 1: The element x’ in a Boolean algebra is 2. (a) x+0 = 0+x = x (b) x•1 = 1•x = x uniquely determined by x. 3. (a) x+y = y+x (b) x•y = y•x Thm 2: • 4. (a) x+(y•z) = (x+y)•(x+z) (a) x + 1 = 1 (b) x 0 = 0 (b) x•(y+z) = x•y+x•z Thm 3: (involution) 5. (a) x+x' = 1 (b) x•x' = 0 (a) 0’ = 1 (b) 1’ = 0 6. |B| ≥ 2

J. C. Huang, 2003 Digital Logic Design 18 J. C. Huang, 2003 Digital Logic Design 19

Theorems (continued) Theorems (continued)

Thm 4: (both operations are idempotent) Thm 7: (a) x + x = x (b) x • x = x (a) x + x’y = x + y (b) x(x’ + y) = xy Thm 5: (involution) Thm 8: (associativity) (x')' = x (a) (x + y) + z = x + (y + z) Thm 6: (absorption) (b) (x • y) • z = x • (y • z) • (a) x + xy = x (b) x (x+y) = x Thm 9: (De Morgan's Law) (a) (x+y)'=x'•y' (b) (x•y)'=x'+y'

J. C. Huang, 2003 Digital Logic Design 20 J. C. Huang, 2003 Digital Logic Design 21

Theorems (continued) Dual

Thm 10: Given an expression in Boolean algebra, its B = 〈 {0, 1}, +, •, = 〉, where the two dual is obtained by replacing every "+" operations are defined as shown below is a operator with "•" operator, and vice versa, Boolean algrbra. and by replacing every 0 with 1, and vice x+y y x•y y versa. +01 • 01

001 000 x x 111 101

J. C. Huang, 2003 Digital Logic Design 22 J. C. Huang, 2003 Digital Logic Design 23

4 Principle of duality Perfect induction

The dual of any true statement in Boolean • Perfect induction is proof by exhaustion in algebra is also a true statement. which all possibilities are considered.

J. C. Huang, 2003 Digital Logic Design 24 J. C. Huang, 2003 Digital Logic Design 25

The concept of a function Truth table and function

• It is a one-to-one or many-to-one mapping. • A truth table, therefore, describes a • The preceding truth table describes a function. mapping of a set of pairs of 0’s and 1’s into • A truth table can be represented by using a a set consisting of 0 and 1, viz., Boolean expression, i.e., an expression → → <0, 0> 0 <0, 1> 1 written in terms of the language of Boolean <1, 0> → 1 <1, 1> → 0 algebra. • That mapping is a function because it is many-to-one.

J. C. Huang, 2003 Digital Logic Design 26 J. C. Huang, 2003 Digital Logic Design 27

Truth table and Boolean function Literals and product/sum terms

• An output of a combinational circuit, which •A literal is defined as each occurrence of can be exhaustively listed on a column in either a complemented or uncomplemented the truth table, can also be described by a variable in a Boolean expression. Boolean expression. •A product term is a literal or a product (i.e., • The Boolean expression can be constructed AND together, or conjunction) of literals. as explained below. •A sum term is a literal or a sum (i.e., OR together, or disjunction) of literals.

J. C. Huang, 2003 Digital Logic Design 28 J. C. Huang, 2003 Digital Logic Design 29

5 Minterms of 2 variables Minterms minterm that is x y m-notation • A minterm is a product term in which all evaluated to 1 variables occur exactly once, either 0 0 x’y’ m0 complemented or uncomplemented. • A minterm has the property that it is 0 1 x’y m1 evaluated to 1 on one and only one row of 1 0 xy’ m the truth table. 2

1 1 xy m3

J. C. Huang, 2003 Digital Logic Design 30 J. C. Huang, 2003 Digital Logic Design 31

Minterms of 3 variables minterm that is → x y z m-notation Truth table Boolean expression evaluated to 1 0 0 0 x’y’z’ m 0 • The function described by a truth table can 0 0 1 x’y’z m1 also be described by a sum (i.e., OR 0 1 0 x’yz’ m2 together, or disjunction) of minterms. 0 1 1 x’yz m 3 • The minterms involved are those, and only 1 0 0 xy’z’ m4 those, associated with the rows on which 1 0 1 xy’z m5 the minterm is evaluated to 1. 1 1 0 xyz’ m6

1 1 1 xyz m7

J. C. Huang, 2003 Digital Logic Design 32 J. C. Huang, 2003 Digital Logic Design 33

Thus the following function can be described as f(x, y, z) = x’yz’ + xy’z + xyz f(x, y) = x’y’ + xy’ x y z f(x, y z) 0 0 0 0 x y f(x, y) 0 0 1 0 0 0 1 0 1 0 1 0 1 1 0 0 1 0 1 0 0 0 1 0 1 1 1 0 1 1 1 0 0 1 1 0 1 1 1 1

J. C. Huang, 2003 Digital Logic Design 34 J. C. Huang, 2003 Digital Logic Design 35

6 Properties of minterms Row indices of a truth table

• For a function of n variables, there are 2n • It is convenient to refer to a row in a truth possible minterms. table by its index, which is equal to the • The sum of all possible minterms is equal to binary equivalent of the values assigned to 1. the variables on that row. • The product of any two minterms is equal to • Thus, for a truth table of a function of n 0 unless they are identical. variables, its rows are indexed by integers 0 through 2n from top to bottom.

J. C. Huang, 2003 Digital Logic Design 36 J. C. Huang, 2003 Digital Logic Design 37

m-Notation Maxterms

• A minterm can be denoted by mi for short, • A maxterm is a sum term in which all where i is the index of the row on which variables occur exactly once, either that minterm is evaluated to 1. complemented or uncomplemented. • Thus f(x, y, z) = x’y’z’ + x’yz + xyz’ + xyz • A maxterm has the property that it is can be alternatively expressed as evaluated to 0 on one and only one row of the truth table. f(x, y, z) = m0 + m3 + m6 + m7 = Σm(0, 3, 6, 7)

J. C. Huang, 2003 Digital Logic Design 38 J. C. Huang, 2003 Digital Logic Design 39

Maxterms of 3 variables Maxterms of 2 variables maxterm that is x y z M-notation maxterm that is evaluated to 0 x y M-notation evaluated to 0 0 0 0 x + y +z M0 0 0 1 x + y + z’ M 0 0 x + y M0 1 0 1 0 x + y’ + z M2 0 1 x + y’ M1 0 1 1 x + y’ + z’ M3

1 0 0 x’ + y + z M4 1 0 x’ + y M2 1 0 1 x’ + y + z’ M5 1 1 x’ + y’ M 3 1 1 0 x’ + y’ + z M6

1 1 1 x’ + y’ + z’ M7

J. C. Huang, 2003 Digital Logic Design 40 J. C. Huang, 2003 Digital Logic Design 41

7 Thus the following function can be described as f(x, y) = (x + y’)(x’ + y’) Truth table → Boolean expression

• The function described by a truth table can x y f(x, y) also be described by a product (i.e., AND 0 0 1 together, or conjunction) of maxterms. • The maxterms involved are those, and only 0 1 0 those, associated with the rows on which 1 0 1 the maxterm is evaluated to 0. 1 1 0

J. C. Huang, 2003 Digital Logic Design 42 J. C. Huang, 2003 Digital Logic Design 43

f(x, y, z) = (x + y + z)(x + y + z’)(x + y’ + z’)(x’ + y + z)(x’ + y’ + z) x y z f(x, y z) Properties of maxterms 0 0 0 0 0 0 1 0 • For a function of n variables, there are 2n 0 1 0 1 possible maxterms. 0 1 1 0 • The product of all possible maxterms is 1 0 0 0 equal to 0. 1 0 1 1 • The sum of any two maxterms is equal to 1 1 1 0 0 unless they are identical. 1 1 1 1

J. C. Huang, 2003 Digital Logic Design 44 J. C. Huang, 2003 Digital Logic Design 45

M-Notation Normal forms

• A maxterm can be denoted by Mi for short, • A Boolean function expressed in sum-of- where i is the index of the row on which products form, also known as disjunctive that maxterm is evaluated to 0. normal form • Thus f(x, y, z) = (x+y+z)(x’+y+z)(x’+y’+z) • A Boolean function expressed in product- can be alternatively expressed as of-sums form, also known as conjunctive normal form f(x, y, z) = M0M4M6 = ΠM(0, 4, 6)

J. C. Huang, 2003 Digital Logic Design 46 J. C. Huang, 2003 Digital Logic Design 47

8 Canonical forms Complementing a canonical formula

• Two types of expressions are directly • The complement of a canonical formula is obtainable from a truth table: another canonical formula of the same type minterm canonical formula consisting of all missing terms. (standard sum-of-products) maxterm canonical formula (standard product-of-sums)

J. C. Huang, 2003 Digital Logic Design 48 J. C. Huang, 2003 Digital Logic Design 49

Transformation of canonical formula Double-rail logic

• A minterm canonical formula can be •In double-rail logic, it is assumed that all transformed into an equivalent maxterm variables and their complements are always canonical formula by available as inputs. 1. complementing it by using the property of • Otherwise, it is known as single-rail logic, a canonical formula, and then and NOT gates have to be used to obtain the complements. 2. complementing it again by applying the De Morgan’s Law. • Unless otherwise indicated, the use of double-rail logic is assumed.

J. C. Huang, 2003 Digital Logic Design 50 J. C. Huang, 2003 Digital Logic Design 51

Number of levels These two circuits implement the same function.

• The largest number of gates a signal must pass through from input to output is called the number of level of logic.

f(w, x, y, z) = w’x + x’(y + z) = w’x + x’y + x’z

J. C. Huang, 2003 Digital Logic Design 52 J. C. Huang, 2003 Digital Logic Design 53

9 2-level logic implementation of an odd-parity bit generator. The logic diagram of a BCD odd-parity bit generator.

J. C. Huang, 2003 Digital Logic Design 54 J. C. Huang, 2003 Digital Logic Design 55

All 16 functions of 2 variables Universal set of operations

fi(x, y) = • A set of operations is said to be universal if i=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 any function can be described by using that set of operations alone. y)' y)' y)' y)' y (XNOR) y (XNOR) y (XOR) y (XOR) y (IMPL.) y y (NAND) y (NAND) y (NOR) ⊂ ⊃ y (AND) y (AND) ↑ ⊃ ⊂ ⊕ ↓ ~ • x 1 x' x y' x y x x+y (OR) x x x (x •Examples: x y 0 x (x 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 {AND, OR, NOT} 0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 {AND, NOT} {OR, NOT} {NAND} {NOR}

J. C. Huang, 2003 Digital Logic Design 56 J. C. Huang, 2003 Digital Logic Design 57

NAND and NOR functions NAND and OR realization

• By using current technology, the simplest • A two-level NAND logic works exactly the logic gates are NAND and NOR gates. same as a two-level AND-OR logic. • The system with operations of NAND and • A two-level NOR logic works exactly the NOR does not constitute a Boolean algebra. same as a two-level OR-AND logic. • A procedure to do NAND or NOR • These two operations are not associative. realization: Write the function in sum of products (or product of sums), and then use a two-level logic.

J. C. Huang, 2003 Digital Logic Design 58 J. C. Huang, 2003 Digital Logic Design 59

10 x1 x1 x 1 x2 x2 x 1 x 1 x 2 x 2 x3 x3 x 2 x4 x4 x5 x5 (a) x 1 x 2 = x 1 + x 2

x 1 x1 x 1 x 1 x2 x 2 x 2 x 2 x3 x4 (b) x 1 + x 2 = x 1 x 2 x5

DeMorgan’s theorem in terms of logic gates Using NAND gates to implement a sum-of-products

J. C. Huang, 2003 Digital Logic Design 60 J. C. Huang, 2003 Digital Logic Design 61

Nand-gate symbol in general x 1 x 1 x 2 x 2

x 3 x 3 x 4 x 4 x 5 x 5

x 1 x 2

x 3 x 4 x 5

Using NOR gates to implement a product-of-sums

J. C. Huang, 2003 Digital Logic Design 62 J. C. Huang, 2003 Digital Logic Design 63

Nor-gate symbol in general The universal property of nand-gates

J. C. Huang, 2003 Digital Logic Design 64 J. C. Huang, 2003 Digital Logic Design 65

11 The universal property of nor-gates Steps involved in realizing f(w,x,y,z) = w'z + wz'(x+y')

J. C. Huang, 2003 Digital Logic Design 66 J. C. Huang, 2003 Digital Logic Design 67

Steps involved in realizing f(x,y,z) = x(y'+z) Two equivalent not-gate symbols

J. C. Huang, 2003 Digital Logic Design 68 J. C. Huang, 2003 Digital Logic Design 69

Steps involved in the realization of f(w,x,y,z) = w'z + wz'(x+y') Steps involved in realizing f(w,x,y,z) = w'z + wz'(x+y')

J. C. Huang, 2003 Digital Logic Design 70 J. C. Huang, 2003 Digital Logic Design 71

12 Steps involved in realizing f(w,x,y,z) = w'z + wz'(x+y) Exclusive-OR function

• It is commutative and associative •x ⊕ 0 = x and x ⊕ 1 = x’ •x ⊕ x = 0 and x ⊕ x’ = 1 • It is also defined as “odd function” (meaning equal to one when the odd number of arguments are set to 1) for three or more variables.

J. C. Huang, 2003 Digital Logic Design 72 J. C. Huang, 2003 Digital Logic Design 73

Exclusive-OR

= x’y + xy’

J. C. Huang, 2003 Digital Logic Design 74 J. C. Huang, 2003 Digital Logic Design 75

Exclusive NOR Gate Properties

• Voltage representation of 0 and 1 • Positive and negative logic • Noise margins

= x’y’ + xy • Fan-out = x ≡ y • Propagation delays • Power dissipation

J. C. Huang, 2003 Digital Logic Design 76 J. C. Huang, 2003 Digital Logic Design 77

13 The working of a gate is commonly described by a table like the one shown below. What gate is described by this table? It depends on the type of logic used. If positive logic is used, Power dissipation i.e., 0 ← L and 1 ← H then it is an AND gate. If negative logic is used, i.e., 0 ← H and 1 ← H, then it is an OR gate. • Low power dissipation and high switch speed are desired. The law of physics, input however, requires high power to achieve output x y fast switch. L L L • A common measure of gate performance is L H L the product of the propagation delay and the H L L power dissipation of the gate. H H H

J. C. Huang, 2003 Digital Logic Design 78 J. C. Huang, 2003 Digital Logic Design 79

14