chapter 2 boolean algebra and logic gates digital circuits 2- 2 boolean algebra (e.v. huntington,...

33
Chapter 2 Boolean Algebra and Logic Gates

Post on 21-Dec-2015

220 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

Chapter 2

Boolean Algebra and Logic Gates

Page 2: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-2Digital Circuits

Boolean Algebra (E.V. Huntington, 1904)

A set of elements B and two binary operators + and .

1. Closure w.r.t. the operator + (.) x, y B x+y B

2. An identity element w.r.t. + (.) 0+x = x+0 = x 1.x = x.1= x

3. Commutative w.r.t. + (.) x+y = y+x x.y = y.x

Page 3: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-3Digital Circuits

4. . is distributive over +: x.(y+z)=(x.y)+(x.z) + is distributive over.: x+(y.z)=(x+y).(x+z)

5. x B, x' B (complement of x) x+x'=1 and x.x'=0

6. at least two elements x, y B x ≠ y Note

the associative law can be derived no additive and multiplicative inverses complement

Page 4: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-4Digital Circuits

Two-valued Boolean Algebra

B = {0,1} The rules of operations

Closure The identity elements

– +: 0– .: 1

x y xy x y x+y x x‘0 0 0 0 0 0 0 10 1 0 0 1 1 1 01 0 0 1 0 11 1 1 1 1 1

Page 5: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-5Digital Circuits

The commutative laws The distributive laws

Page 6: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-6Digital Circuits

Complement x+x'=1: 0+0'=0+1=1; 1+1'=1+0=1 x.x'=0: 0.0'=0.1=0; 1.1'=1.0=0

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

Page 7: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-7Digital Circuits

Basic Theorems and Properties

Duality the binary operators are interchanged; AND <-> OR the identity elements are interchanged; 1 <-> 0

P2 x+0 =x x 1 = xp5 x+x‘ = 1 x x‘ = 0T1 x + x = x x x = xT2 x + 1 = 1 x 0 = 0T3, involution (x‘)’ = xp3 x+y = y+x xy = yxT4 x+(y+z)=(x+y)+z x(yz) =(xy)zP4 x(y+z)=xy+xz x+yz=(x+y)(x+z)T5, DeMorgan (x+y)‘ =x’y‘ (xy)‘=x’+y‘T6, absorption x+xy = x x(x+y) =x

Page 8: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-8Digital Circuits

• 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+05(b) = x

2(a)

– Theorem 1(b): x x = x– xx = x x + 0

= xx + xx'= x (x + x')

= x 1= x

Page 9: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-9Digital Circuits

Theorem 2 x + 1 = 1 (x + 1)

= (x + x')(x + 1) = x + x' 1 = x + x' = 1

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')'

Page 10: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-10Digital Circuits

Theorem 6 x + xy = x 1 + xy =

x (1 +y) = x 1 = x

x (x + y) = x by duality By means of truth table

x y xy x + xy0 0 0 00 1 0 01 0 0 1

1 1 1 1

Page 11: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-11Digital Circuits

DeMorgan's Theorems (x+y)' = x' y' (x y)' = x' + y'

x y x+y (x+y)‘ x‘ y‘ x‘y’0 0 0 1 1 1 10 1 1 0 1 0 01 0 1 0 0 1 01 1 1 0 0 0 0

Page 12: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-12Digital Circuits

• Operator Precedence– parentheses– NOT– AND– OR– examples

– x y' + z

– (x y + z)'

Page 13: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-13Digital Circuits

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

Page 14: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-14Digital Circuits

The truth table of 2n entries

Two Boolean expressions may specify the same function

F3 = F4

x y z F1 F2 F3 F40 0 0 0 0 0 00 0 1 0 1 1 10 1 0 0 0 0 00 1 1 0 0 1 11 0 0 0 1 1 11 0 1 0 1 1 11 1 0 1 1 0 01 1 1 0 1 0 0

Page 15: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-15Digital Circuits

• Implementation with logic gates

• F4 is more economical

x y z F1 F2 F3 F40 0 0 0 0 0 00 0 1 0 1 1 10 1 0 0 0 0 00 1 1 0 0 1 11 0 0 0 1 1 11 0 1 0 1 1 11 1 0 1 1 0 01 1 1 0 1 0 0

Page 16: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-16Digital Circuits

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) x(x'+y) = xx' + xy = 0+ xy = xy x+x'y = (x+x')(x+y) = 1 (x+y) = x+y (x+y)(x+y') = x+xy+xy'+yy' = x(1+y+y') = x

Page 17: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-17Digital Circuits

x'y'z + x'yz + xy' = x'z(y'+y) + xy'= x'z + xy'

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

(x+y)(x'+z)(y+z) = (x+y)(x'+z) by duality from the previous result

Page 18: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-18Digital Circuits

Complement of a Function

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)' = A'(B'C') by DeMorgan's = A'B'C' associative

generalizations (A+B+C+ ... +F)' = A'B'C' ... F' (ABC ... F)' = A'+ B'+C'+ ... +F'

Page 19: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-19Digital Circuits

(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 x'yz' + x'y'z => (x'+y+z') (x'+y'+z) (the dual)

=> (x+y'+z)(x+y+z')

Page 20: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-20Digital Circuits

Canonical and Standard Forms

Minterms and Maxterms A minterm: 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' It is also called a standard product n variables con be combined to form 2n minterms A maxterm: an OR term It is also call a standard sum 2n maxterms

Page 21: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-21Digital Circuits

each maxterm is the complement of its corresponding minterm, and vice versa

x y z term Term0 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

Page 22: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-22Digital Circuits

An Boolean function can be expressed by a truth table sum of minterms f1 = x'y'z + xy'z' + xyz = m1 + m4 +m7

f2 = x'yz+ xy'z + xyz'+xyz = m3 + m5 +m6 + m7x y z f1 f2

0 0 0 0 00 0 1 1 00 1 0 0 00 1 1 0 11 0 0 1 01 0 1 0 11 1 0 0 11 1 1 1 0

Page 23: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-23Digital Circuits

The complement of a Boolean function 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 canonical form

Page 24: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-24Digital Circuits

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 +AB'C' +AB'C+ABC'+ ABC = m1 + m4 +m5 + m6 + m7

F(A,B,C) = (1, 4, 5, 6, 7) or, built the truth table first

Page 25: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-25Digital Circuits

Product of maxterms x + yz = (x + y)(x + z)

= (x+y+zz')(x+z+yy') =(x+y+z)(x+y+z’)(x+y'+z)

F = xy + x'z= (xy + x') (xy +z)

= (x+x')(y+x')(x+z)(y+z)= (x'+y)(x+z)(y+z)

x'+y = x' + y + zz'= (x'+y+z)(x'+y+z')

F = (x+y+z)(x+y'+z)(x'+y+z)(x'+y+z')= M0M2M4M5

F(x,y,z) = (0,2,4,5)

Page 26: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-26Digital Circuits

Conversion between Canonical Forms F(A,B,C) = (1,4,5,6,7) F'(A,B,C) = (0,2,3) By DeMorgan's theorem

F(A,B,C) = (0,2,3) mj' = Mj

sum of minterms = product of maxterms interchange the symbols and and list those

numbers missing from the original form of 1's of 0's

Page 27: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-27Digital Circuits

Standard Forms Canonical forms are seldom used sum of products F1

= y' + zy+ x'yz' product of sums F2

= x(y'+z)(x'+y+z'+w) F3 = A'B'CD+ABC'D'

Page 28: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-28Digital Circuits

Two-level implementation

Multi-level implementation

Page 29: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-29Digital Circuits

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

Page 30: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-30Digital Circuits

Page 31: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-31Digital Circuits

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

Page 32: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-32Digital Circuits

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

Page 33: Chapter 2 Boolean Algebra and Logic Gates Digital Circuits 2- 2 Boolean Algebra (E.V. Huntington, 1904) A set of elements B and two binary operators

2-33Digital Circuits

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