chapter 2 boolean algebra and logic gates 授課教師 : 張傳育 博士 (chuan-yu chang ph.d.)...

50
Chapter 2 Boolean Algebra and Logic Gates 授授授授 : 授授授 授授 (Chuan-Yu Chang Ph.D.) E-mail: [email protected] Tel: (05)5342601 ext. 4337 Office: EB212

Upload: oswald-martin

Post on 28-Dec-2015

246 views

Category:

Documents


0 download

TRANSCRIPT

Chapter 2

Boolean Algebra and Logic Gates

授課教師 : 張傳育 博士 (Chuan-Yu Chang Ph.D.)E-mail: [email protected]: (05)5342601 ext. 4337Office: EB212

2-2Digital Circuits

Basic Definitions

A set of elements is any collection of objects, usually having a common property.

If S is a set, and x and y are certain objects, x ∈ S means that x is a member of the set S. y ∉ S means that y is not an element of the set 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.

a*b=c * is a binary operator if it specifies a rule for finding c from

the pair (a,b) and also if a, b, c ∈ S. * is not a binary operator if a, b∈ S, c ∉ S.

2-3Digital Circuits

Basic Definitions (cont.)

Closure A set S is closed with respect to a binary operator

if, for every pair of elements of S, the binary operators specifies a rule for obtaining a unique element of S.

The set of natural number N={1,2,3,4,…} is closed with respect to the binary operator + by the rules of

arithmetic addition, since, for any a, b ∈ N, there is a

unique c ∈ N such that a+b=c. The set of natural number N is not closed with respect to

the binary operator - by the rules of arithmetic

subtraction, since, 2-3=-1, 2,3 ∈ N, but (-1) ∉ N .

2-4Digital Circuits

Basic Definitions (cont.)

Associative law A binary operator * on a set S is said to be associative

whenever

Commutative law A binary operator * on a set S is said to be commutative

whenever

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

Szyxzyxzyx ,, allfor

Syxxyyx , allfor

Sxxexxe every for

2-5Digital Circuits

Basic Definitions (cont.)

Inverse A set S having the identity element e with respect to a

binary operator * is said to have an inverse whenever, for

every x ∈ S, there exists an element y ∈ S such that

In the set of integers, I, and the operator +, with e=0, the inverse of an element a is (-a), since a+(-a)=0.

Distributive law IF * and ∙ are two binary operators on a set S, * is said to

be distributive over ∙ whenever

eyx

zxyxzyx

2-6Digital Circuits

Axiomatic Definition of Boolean Algebra

Boolean algebra In 1854, George Boole developed an algebraic system.

Switching algebra In 1938, C. E. Shannon introduced a two-valued Boolean

algebra called switching algebra that represented the properties of bistable electrical switching circuits.

Huntington postulates In 1904, E. V. Huntington introduced the postulates of

Boolean algebra. Boolean algebra is an algebraic structure defined by a set of

elements, B, together with two binary operators, + and ∙ .

2-7Digital Circuits

Axiomatic Definition of Boolean Algebra (cont.)

Following Hunting postulates are satisfied:

1. Closure with respect to 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

2-8Digital Circuits

Axiomatic Definition of Boolean Algebra (cont.)

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 Comparing Boolean algebra with arithmetic algebra,

we note the following differences: Huntington postulates do not include the associative law,

however, it can be derived from other postulates. The distributive law of + over (‧ x+(y‧z)=(x+y) (‧ x+z) ), is valid

for Boolean algebra, but not for arithmetic algebra. Boolean algebra does not have additive and multiplicative

inverses Complement is not available in ordinary algebra. Boolean algebra deal with two-valued Boolean number.

Ordinary algebra deals with the real number.

2-9Digital Circuits

Two-valued Boolean Algebra

A two valued Boolean algebra is defined on a set of two elements, B = {0,1}, with rules for the operations + and ‧

The Huntington postulates are valid for the set B and the two binary operator + and ‧

Closure The identity elements

(1) +: 0 (2)‧: 1

2-10Digital Circuits

Two-valued Boolean Algebra (cont.)

The commutative laws are obvious from the symmetry of the binary operator tables.

The distributive laws x(y+z) = xy + xz can be shown to hold from the operator tables.

2-11Digital Circuits

Two-valued Boolean Algebra (cont.)

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‧ ‧ ‧ ‧

Postulate 6 is satisfied because the two-valued Boolean Algebra 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

2-12Digital Circuits

Basic Theorems and Properties

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

2-13Digital Circuits

Basic Theorems and Properties

• 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– xx = x x + 0

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

2-14Digital Circuits

Basic Theorems and Properties

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

2-15Digital Circuits

Basic Theorems and Properties

Theorem 6 x + xy = x 1 + xy =

x (1 +y)= x 1= x

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

2-16Digital Circuits

Basic Theorems and Properties

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

2-17Digital Circuits

Basic Theorems and Properties

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

– x y' + z

– (x y + z)'

2-18Digital Circuits

Boolean Functions

A Boolean function is an algebra that deals with binary variables and logic operations. 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

2-19Digital Circuits

Boolean Functions (cont.)

The truth table of 2n entries

Two Boolean expressions may specify the same function

F3 = F4

F1= x y z'F2 = x + y'zF3 = x' y' z + x' y z + x y'F4 = x y' + x' z

2-20Digital Circuits

• Implementation with logic gates

• F4 is more economical

F3

F4

F2

Boolean Functions (cont.)

F1= x y z'F2 = x + y'zF3 = x' y' z + x' y z + x y'F4 = x y' + x' z

2-21Digital 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) Examples:

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

2-22Digital Circuits

Algebraic Manipulation (cont.)

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

2-23Digital Circuits

Complement of a Function

The complement of a function F is F’ and is obtained from

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

Generalization form of DeMorgan's theorem (A+B+C+ ... +F)' = A'B'C' ... F' (ABC ... F)' = A'+ B'+C'+ ... +F‘ The complement of a function is obtained by interchanging

AND and OR operators and complementing each literal.

2-24Digital Circuits

Complement of a Function (cont.)

Example 2.2: Find the complement of the functions F1=x’yz’+x’y’z and F2=x(y’z’+yz) F1’=(x'yz' + x'y'z)' = (x'yz')' (x‘y'z)'

= (x+y'+z) (x+y+z') F2’=[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. Example 2.3: F1=x'yz' + x'y'z

=> (x'+y+z') (x'+y'+z) (the dual) => (x+y'+z)(x+y+z')=F1’ (complement each literal)

2-25Digital 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 For example,

(x+y) 2n maxterms each maxterm is the complement of its corresponding

minterm, and vice versa

2-26Digital Circuits

Canonical and Standard Forms (cont.) mj, the subscript j denotes the decimal equivalent of the

binary number of the minterm designated. Each maxterm is obtained from an OR term of the n

variables with each variable being unprimed. Each maxterm is the complement of its corresponding

minterm and vice versa.

2-27Digital Circuits

Canonical and Standard Forms (cont.)

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 + m7

2-28Digital Circuits

Canonical and Standard Forms (cont.)

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 Boolean functions expressed as a sum of minterms or

product of maxterms are said to be in canonical form. 每一項必須包含全部的變數

2-29Digital Circuits

Sum of minterms

Example 2.4 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

2-30Digital Circuits

Product of maxterms

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)

2-31Digital Circuits

Conversion between Canonical Forms

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

2-32Digital Circuits

Conversion between Canonical Forms

Example F = xy + xz F(x, y, z) = (1, 3, 6, 7) F(x, y, z) = (0, 2, 4, 5)

2-33Digital Circuits

Standard Forms

Standard Forms Canonical forms are seldom used( 因為每一項必須包含全部的變數 )

sum of products, SOPF1 = y' + zy+ x'yz'

product of sums, POSF2 = x(y'+z)(x'+y+z'+w)

F3 = A'B'CD+ABC'D'

2-34Digital Circuits

Standard Forms (cont.)

Two-level implementation

Multi-level implementation

2-35Digital Circuits

Other Logic Operations

2n rows in the truth table of n binary variables 22n 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

2-36Digital Circuits

2-37Digital 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

2-38Digital Circuits

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

2-39Digital CircuitsFigure 2.5 Digital logic gates

2-40Digital CircuitsFigure 2.5 Digital logic gates (continued)

2-41Digital Circuits

Extension to multiple inputs

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

2-42Digital Circuits

Extension to multiple inputs (cont.)

NAND and NOR are commutative but not associative => they are not extendable

2-43Digital Circuits

Extension to multiple inputs (cont.)

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

2-44Digital Circuits

Extension to multiple inputs (cont.)

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

2-45Digital Circuits

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

2-46Digital Circuits

2-47Digital Circuits

Integrated Circuits

An IC is a silicon semiconductor crystal, called a chip, containing the electronic components for constructing digital gates.

Levels of integration: SSI: < 10 gates MSI: 10 ~ 100 gates LSI: 100 ~ xk gates VLSI: > xk gates

small size (compact size) low cost low power consumption high reliability high speed

2-48Digital Circuits

Integrated Circuits (cont.)

Digital logic families: circuit technology TTL: transistor-transistor logic (dying?) ECL: emitter-coupled logic (high speed, high

power consumption) MOS: metal-oxide semiconductor (NMOS, high

density) CMOS: complementary MOS (low power) BiCMOS( 雙載子互補式金氧半導體 ): high speed,

high density

2-49Digital Circuits

Integrated Circuits (cont.)

The characteristics of digital logic families Fan-out: the number of standard loads that the

output of a typical gate can drive. Fan-in: the number of inputs available in a gate. Power dissipation: the power consumed by the

gate. Propagation delay: the average transition delay

time for the signal to propagate from input to output.

Noise margin: the minimum of external noise voltage that caused an undesirable change in the circuit output.

2-50Digital Circuits

Integrated Circuits (cont.)

CAD – Computer-Aided Design Millions of transistors Computer-based representation and aid Automatic the design process Design entry

Schematic capture HDL – Hardware Description Language

Verilog, VHDL

Simulation Physical realization

ASIC, FPGA, PLD