Digital Logic Design

Digital Logic Design ENGG1015 1st Semester, 2011 Dr. Kenneth Wong Department of Electrical and Electronic Engineering Representing p g Logic g Oper...
Author: Charla Hensley
312 downloads 0 Views 2MB Size
Digital Logic Design ENGG1015 1st Semester, 2011

Dr. Kenneth Wong Department of Electrical and Electronic Engineering

Representing p g Logic g Operations p • Each function can be represented equivalently in 3 ways: – Truth table – Boolean logic g expression p – Schematics

Truth Table

Schematics

Boolean Expression 5

Determining g output p level from a diagram g

6

Implementing Circuits From Boolean Expressions • •

When the operation of a circuit is defined by a Boolean expression, we can draw a logic-circuit diagram directly from that expression. Example: draw the circuit for y = AC + BC + ABC – Done in two steps

7

Truth Table to Boolean Expression p • List all combinations that give 1 at output • Sum S up all terms • Sum of products (SOP) – more later

ABC A BC

x=?

ABC x = A B C + A BC + ABC

8

Laws of Boolean Algebra • Commutative Laws A+B=B+A

A•B=B•A

• Associative Laws A + (B + C) = (A + B) + C

A • (B • C) = (A • B) • C 9

• Distributive Law A • (B + C) = A • B + A • C A (B + C) = A B + A C

Rules of Boolean Algebra

10



Rule 1

OR Truth Table



Rule 2



Rule 3

AND Truth Table



Rule 4

11



Rule 5



Rule 6



Rule 7

OR Truth Table

AND Truth Table



Rule 8

12





Rule 9

Rule 10: A + AB = A – Proof: A+AB = A(1+B) = A·1 =A – Or prove by truth table

by distributive law by rule 2 by rule 4

13

• •

• •

Rule 11: A + AB = A + B This rule can only be proved by constructing the truth table (?)

Rule 12: (A + B)(A + C) = A + BC This rule can only be proved by constructing the truth table (?)

14



Examples: – Simplify y = ABD + ABD

(

)

– Simplify Si lif z = A + B ( A + B )

AB A AB B – Simplify p y x = ACD+ ABCD

y = AB(D + D)

by distributive law

= AB ⋅1

by rule 6

= AB

b rule by l 4

z = AA + AB + BA + BB

by distributive law

= 0 + AB + BA + B

by rule 8 and rule 7

= AB + BA + B

by rule 1

= B( A + A + 1) = B ⋅1 =B

by distributive law by rule 6 and rule 2 by rule 4

x = CD ( A + AB)

by distributive law

= CD ( A + B)

by rule 11

= ACD + BCD

by distributive law 15

Review Questions • Simplify

y = AC + AB C

y = AC • Simplify y

y = ABC D + ABC D

y = ABD • Simplify p y

y = AD + ABD y = AD + BD 16

DeMorgan’s g Theorems • Theorem 1

x + y = x⋅ y • Theorem 2

x⋅ y = x + y

R Remember: b “Break the bar, change the operator operator”

– D DeMorgan's M ' theorem th is i very useful f l in i digital di it l circuit i it d design i – It allows ANDs to be exchanged with ORs by using invertors – DeMorgan DeMorgan's s Theorem can be extended to any number of variables. E.g, for three variables x, y and z

x + y + z = x⋅ y⋅z x⋅ y⋅ z = x + y + z 17

Quick Quiz (1) „

Simplify ( AB + C ) • AC + BC • AC + BC • AC + BC • AC + BC

„

Simplify ( A + C ) ⋅ ( B + D) • AC + BD • AC + BD • AC + BD • AC + BD 18

Quick Quiz (2) „

Simplify AB ⋅ CD ⋅ EF • AB + CD + EF • AB + CD + EF • AB + CD + EF • ABCDEF

„

Determine the output expression for the below circuit and simplify it using DeMorgan DeMorgan’ss Theorem • ABC • ABC • A+ B +C • A+ B +C 19

Examples (Summary): a)

( AB + C ) = AB ⋅ C = ( A + B ) ⋅ C = AC + BC

b)

( A + C ) ⋅ ( B + D) = ( A + C ) + ( B + D) = A ⋅ C + B ⋅ D = AC + BD

c)

A + B ⋅ C = A ⋅ ( B ⋅ C ) = A ⋅ ( B + C ) = A( B + C )

d)

( A + BC ) ⋅ ( D + EF ) = ( A + BC ) + ( D + EF ) = ( A ⋅ BC ) + ( D ⋅ EF ) = A ⋅ (B + C ) + D ⋅ (E + F ) = AB + AC + DE + DF

e)

AB ⋅ CD C ⋅ EF = AB + CD C + EF = AB + CD C + EF

f ) Determine the output expression for the below circuit and simplify it using g DeMorgan’s g Theorem

20

Review Questions • Using DeMorgan’s Theorems to convert the expressions to one that has only single-variable inversions.

y = R ST + Q

y = (R + S +T )Q

z = ( A + B )⋅ C

z = AB + C

y = A + B + CD

y = A B (C + D )

21

Implications of DeMorgan’s Theorems x + y = x⋅ y

• i.e., The AND gate with INVERTERs on each of its inputs is equivalent to a NOR gate

Usually redrawn in this way

x⋅ y = x + y

• i.e., i e The OR gate with INVERTERs on each of its inputs is equivalent to a NAND gate

Usually redrawn in this wayy

22

Universality y of NAND g gates • Any expression can be implemented using combinations of OR gates, AND gates and INVERTERs • However, it is also possible to implement any logic expression using only NAND gates and no other type of gate • This is because NAND gates, in proper combination, can perform Boolean operations OR,, AND,, and INVERTER

23

• Example: Suppose we want to implement x=AB+CD. -- If we directly d ect y implement p e e t the t e expression, e p ess o , we need eed 2 AND N gates and a d 1 OR O gate => we need two ICs -- If we transform the circuit into one having only NAND gates, we need only one IC IC in Dual-in-line package (DIP)

Pin diagrams for the ICs containing NAND, AND, and OR gates

24

Universality of NOR gate • In a similar manner, it can be shown that NOR gates can be arranged to implement any of the Boolean operations

25

Alternate Logic Logic-Gate Gate Representations •



1.

2.

Apart from standard logic gate symbols we have seen so far, there are alternate symbols for the commonly used gates The alternate symbols y are obtained by performing the following two steps: Invert each input p and output p of the standard symbol. This is done by adding bubbles (small circles) on input and output lines that do not have bubbles and by removing bubbles that are already there. Change the operation symbol from AND to OR, or from OR to AND. (In the special case of the INVERTER, the operation symbol i nott changed.) is h d) 26

Several p points to note • The equivalences can be extended to gates with any y number of inputs. p • None of the standard symbols have bubbles on their inputs, and all the alternate symbols do. • The standard and alternate symbols for each gate represent the same physical circuit; there is no difference in the circuits represented by the two symbols. • NAND and d NOR gates t are iinverting ti gates, t and d so both the standard and the alternate symbols for each will have a bubble on either the input or the output, AND and OR gates are non-inverting gates, and so the alternate symbols for each will have bubbles on both inputs and output.

27

Why we need alternate representation? • Proper use of the alternate gate symbols in the circuit diagram can make the circuit operation much more easy to understand • E.g., the two circuits on the right are equivalent • However, However circuit (a) does not facilitate an understanding of how the circuit function • Circuit (b) is easy to understand: Z will go HIGH whenever either A=B=1 or C=D=1 (or both)

28

Canonical Form • Boolean expression can be expressed in many different ways

(A + D)(B + C) ≡ AB + AC + BD + CD • Two standard ways: – Sum of Product – Product of Sum • Canonical SOP • Canonical POS

29

Canonical SOP • Boolean expression expressed as a sum of product d t off basic b i inputs i t – Basic input may optionally negated

AB C + BD + AD P d t Product

Sum

– NOT canonical: A + B(C + D) – No parenthesis • Most natural for human 30

Canonical POS • Boolean expression expressed as a product of sum of basic inputs – Basic input my optionally negated

(A + B + C)(B + D )(A + D) Product

Sum

– NOT canonical: – Many parenthesis A + B(C + D) • Not too natural for human, but equally good for computers. 31

Example: This example illustrate the complete procedure for designing a logic circuit. circuit Suppose the logic circuit having 3 inputs inputs, A A, B B, C will have its output HIGH only when a majority of the inputs are HIGH. p the truth table Stepp 1 Set up

A

B

C

x

0

0

0

0

Step 2 Write the AND term for

0

0

1

0

0

1

0

0

0

1

1

1

1

0

0

0

1

0

1

1

1

1

0

1

1

1

1

1

each case where the output is a 1. Step 3 Write the SOP form the output

x = ABC + ABC + ABC + ABC St 4 Simplify Step Si lif th the output t t expression i

→ ABC → ABC → ABC → ABC

x = ABC + ABC + ABC + ABC + ABC + ABC = BC ( A + A) + AC ( B + B ) + AB (C + C ) = BC + AC + AB Step 5 Implement the circuit 32

Example: Conversion through the opposite direction:

y

Step S p1S Start from the circuit

A BC ←

from the circuit (in SOP form)

Step 3 Write the truth table

Boolean Expression

S h Schematics ti

Step 2 Obtain Boolean expression

y = AC + BC + A BC

Truth Table

ABC ←

A

B

C

y

0

0

0

0

0

0

1

0

0

1

0

1

0

1

1

1

1

0

0

0

1

0

1

1

1

1

0

1

1

1

1

1

→ ABC

→ ABC → ABC 33

Forms of Boolean Expressions • •





There are two general forms of logic expression: SOP, POS Sum-of-products Sum of products form (SOP) – first the product (AND) terms are formed then these are summed (OR) – eg: ABC + DEF + GHI Product-of-sum form (POS) – first the sum (OR) terms are formed then the products are taken (AND) – eg: (A+B+C)(D+E+F)(G+H+I) It is possible to convert between these two forms using Boolean algebra

34

Simplifying Logic Circuits • •



Once the expression for a logic circuit is obtained, we may try to simplify it, so that the implementation requires fewer gates p below two circuits are the same,, but the second one is much Example: more simpler

Two methods for simplifying

– Algebraic method (use Boolean algebra theorems) – Karnaugh mapping method (next lesson)

35

Minimization by Boolean Algebra •





Make use of relationships and theorems of Boolean algebra to simplify the expressions – this method relies on yyour algebraic g skill Mainly consists of two steps: – The original expression is put into SOP form by repeated application of DeMorgan’s DeMorgan s theorems and multiplication of terms – Once the original expression is in SOP form, the product terms are checked for common factors, and factoring is performed wherever possible Example: Simplify z = ABC + AB ⋅ ( AC)

z = ABC + AB ⋅ ( A + C )

[by [ y DeMorgan g thm]]

= ABC + AB ⋅ ( A + C )

[cancel double inverions]

= ABC + ABA + ABC

[multiply out]

= ABC + AB + ABC

[A ⋅ A = A]

= AC ( B + B ) + AB = AC + AB = A(C + B )

[B + B = 1] 36



Example: Simplify z = ABC + ABC + ABC – The Th expression i is i already l d iin SOP fform z = AB (C + C ) + ABC = AB (1) + ABC = AB + ABC = A( B + BC ) = A( B + C )



[by rule 11 in previous chapter]

Example: Simplify x = ( A + B )( A + B + D ) D

x = AAD + ABD + ADD + BAD + BBD + BDD [multiply out] = ABD + BAD + BD

[AA = 0 and d DD = 0]

= BD( A + A + 1)

[factoring]

= BD

[A + A = 1 and 1+1=1]

37



Example: Simplify z = AC ( ABD) + ABCD + ABC – First Fi t expand d it iinto t SOP form f z = AC ( A + B + D) + ABCD + ABC [DeMorgan thm] = ACA + ACB + ACD + ABCD + ABC

[multiply out]

= ACB + ACD + ABCD + ABC

[AA = 0]

– Then look for the largest common factor between any two or more product terms: first and last terms have BC , while the second and third terms share AD – Grouping the terms gives z = BC ( A + A) + AD(C + BC ) • • • • •

= BC + AD(C + B) [by A + A = 1, C + BC = C + B ] We might think that the above expression is the simplest since it cannot be simplified further However, in fact, the simplest form of this equation is z = ABD + BC It turns out that we missed an operation p earlier that could have led to the simpler form Question: How could we have known that we missed a step?? Ans: There is no way we can know know. This illustrate the frustration often encountered in Boolean simplification 38

In conclusion… conclusion • All logic functions can be represented as (1) truth table (2) schematics (3) Boolean expressions, interchangeably • Laws of Boolean algebra helps to simplify the Boolean expression p • DeMorgan’s theorems • NAND/NOR gates are universal gates • Non-standard representation is equivalent t D to DeMorgan’s M ’ th theorems • Canonical SOP/POS 39