39
1 Representation of Logic Representation of Logic Circuits Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

Embed Size (px)

Citation preview

Page 1: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

1

Representation of Logic CircuitsRepresentation of Logic Circuits

EE 208 – Logic Design

Chapter 2

Sohaib Majzoub

Page 2: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

2

Binary Logic and GatesBinary Logic and Gates

• Binary variables take on one of two values.• Logical operators operate on binary values and

binary variables.• Basic logical operators are the logic functions AND,

OR and NOT.• Logic gates implement logic functions.• Boolean Algebra: a useful mathematical system for

specifying and transforming logic functions.• We study Boolean algebra as a foundation for

designing and analyzing digital systems!

Page 3: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

3

Binary VariablesBinary Variables

• Recall that the two binary values have different names:– True/False– On/Off– Yes/No– 1/0

• We use 1 and 0 to denote the two values.

Page 4: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

4

Logical OperationsLogical Operations

• The three basic logical operations are:– AND – OR– NOT

• AND is denoted by a dot (·).

• OR is denoted by a plus (+).

• NOT is denoted by an overbar ( ¯ ), or a single quote mark (') after,

Page 5: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

5

Chapter 2 - Part 1 5

Logic Diagrams and ExpressionsLogic Diagrams and Expressions

• Boolean equations, truth tables and logic diagrams describe the same function!• Truth tables are unique; expressions and logic diagrams are not. This gives

flexibility in implementing functions.

X

Y F

Z

Logic Diagram

Equation

ZY’ X F

Truth Table

11 1 1

11 1 0

11 0 1

11 0 0

00 1 1

00 1 0

10 0 1

00 0 0

X Y Z Z X F Y’

Page 6: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

6

1.

3.

5.

7.

9.

11.

13.

15.

17.

Commutative

Associative

Distributive

DeMorgan’s

2.

4.

6.

8.

X . 1 X=

X . 0 0=

X . X X=

0=X . X’

BooleanBoolean AlgebraAlgebra• An algebraic structure defined on a set of at least two elements,

B, together with three binary operators (denoted +, · and ) that satisfies the following basic identities:

10.

12.

14.

16.

X + Y Y + X=

(X + Y) Z+ X + (Y Z)+=

X(Y + Z) XY XZ+=

(X + Y)’ X’ . Y’=

XY YX=

(XY) Z X(Y Z)=

X + YZ (X + Y) (X + Z)=

(X . Y)’ X’ + Y’=

X + 0 X=

+X 1 1=

X + X X=

1=X + X’

(X’)’ = X

Page 7: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

7

Chapter 2 - Part 1 7

Boolean Operator PrecedenceBoolean Operator Precedence

The order of evaluation in a Boolean expression is:

1. Parentheses2. NOT3. AND4. OR

Consequence: Parentheses appear around OR expressions Example: F = A(B + C)(C + D’)

Page 8: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

8

Standard Representation of Logic FunctionsStandard Representation of Logic Functions

• Truth Table– List all possible combinations of input and output– Not convenient for large # of variables ( > 5)

Need more convenient alternative.

X Y Z F

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

Page 9: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

9Canonical FormsCanonical Forms

• What are Canonical Forms?

• Minterms and Maxterms

• Index Representation of Minterms and Maxterms

• Sum-of-Minterm (SOM) Representations

• Product-of-Maxterm (POM) Representations

• Representation of Complements of Functions

• Conversions between Representations

Page 10: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

10Minterms: Sum Of Products (SOP)Minterms: Sum Of Products (SOP)X Y

F1

1000

0 00 11 01 1

F2

0100

F3

0010

F4

0001

F5

0110

MintermX’Y’X’YXY’XY

F6

0111

Minterm: A logical product term that contains ALL variables of a logic expression only once, either complemented (if corresponding logic is 0) or not complemented (if corresponding logic is 1).

Canonical Sum of Products (SOP): A logical sum of all minterms of logic expression for which the output is 1.

m0

m1

m2

m3

F1 = X’Y’ = m0 = X,Y(0)

F2 = X’Y = m1 = X,Y(1)

F3 = XY’ = m2 = X,Y(2)

F4 = XY = m3 = X,Y(3)

F5 = m1 + m2 = X,Y(1,2)

F6 = m1 + m2 + m3 = X,Y(1,2,3)

Page 11: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

11Maxterms: Product Of Sums (POS)Maxterms: Product Of Sums (POS)X Y

F1

0111

0 00 11 01 1

F2

1011

F3

1101

F4

1110

F5

0110

MaxtermX+YX+Y’X’+YX’+Y’

F6

0111

Maxterm: A logical sum term that contains ALL variables of a logic expression only once, either complemented (if corresponding logic is 1) or not complemented (if corresponding logic is 0).

Canonical Products of Sums (POS): A logical product of all maxterms of logic expression for which the output is 0.

M0

M1

M2

M3

F1 = X+Y = M0 = X,Y(0)

F2 = X+Y’ = M1 = X,Y(1)

F3 = X’+Y = M2 = X,Y(2)

F4 = X’+Y’ = M3 = X,Y(3)

F5 = M0 . M3 = X,Y(0,3)

F6 = M0 = X,Y(0)

Page 12: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

12

• Yes!

F5 = m1 + m2 = X,Y(1,2) = X’Y + XY’

= M0.M3 = X,Y(0,3) = (X+Y).(X’+Y’) = XX’ + XY’ + X’Y + YY ’ = X’Y + XY’

SOP = POSSOP is NOT POS’

Are SOP and POS Equivalent?Are SOP and POS Equivalent?

X Y 0 00 11 01 1

F5

0110

Page 13: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

13

x y z index m1 + m4 + m7 = F1

0 0 0 0 0 + 0 + 0 = 0

0 0 1 1 1 + 0 + 0 = 1

0 1 0 2 0 + 0 + 0 = 0

0 1 1 3 0 + 0 + 0 = 0

1 0 0 4 0 + 1 + 0 = 1

1 0 1 5 0 + 0 + 0 = 0

1 1 0 6 0 + 0 + 0 = 0

1 1 1 7 0 + 0 + 1 = 1

Minterm Function ExampleMinterm Function Example

• Example: Find F1 = m1 + m4 + m7

• F1 = x’ y’ z + x y’ z’ + x y z

Page 14: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

14

Minterm Function ExampleMinterm Function Example

• F(A, B, C, D, E) = m2 + m9 + m17 + m23

• F(A, B, C, D, E) =

Page 15: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

15Maxterm Function ExampleMaxterm Function Example

• Example: Implement F1 in Maxterms: F1 = M0 · M2 · M3 · M5 · M6

F1 = (x+y+z).(x+y’+z).(x+y’+z’).(x’+y+z’).(x’+y’+z)

x y z i M0 M2 M3 M5 M6 = F1 0 0 0 0 0 1 1 1 = 0 0 0 1 1 1 1 1 1 1 = 1 0 1 0 2 1 0 1 1 1 = 0 0 1 1 3 1 1 0 1 1 = 0 1 0 0 4 1 1 1 1 1 = 1 1 0 1 5 1 1 1 0 1 = 0 1 1 0 6 1 1 1 1 0 = 0 1 1 1 7 1

1 1 1 1 = 1

1

Page 16: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

16

Maxterm Function ExampleMaxterm Function Example

• • F(A, B,C,D) =

14 11 8 3 M M MM)D,C,B,A(F

Page 17: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

17Canonical Sum of MintermsCanonical Sum of Minterms

• Any Boolean function can be expressed as a Sum of Minterms.– For the function table, the minterms used are the

terms corresponding to the 1's– For expressions, expand all terms first to explicitly

list all minterms. Do this by “ANDing” any term missing a variable v with a term (v+v’).

• Example: Implement f = x + x’.y’ as a sum of minterms.

First expand terms: f = x(y+y’)+x’y’Then distribute terms: f = xy +xy’ +x’y’

Express as sum of minterms: f = m3 + m2 + m0

Page 18: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

18Another SOM ExampleAnother SOM Example

• Example: F = A + B’ . C• There are three variables, A, B, and C which we

take to be the standard order.• Expanding the terms with missing variables:

F = A(B + B’)(C + C’) + (A + A’) B’ C

= ABC + ABC’ + AB’C + AB’C’ + AB’C + A’B’C

= ABC + ABC’ + AB’C + AB’C’ + A’B’C• Collect terms (removing all but one of duplicate

terms): • Express as SOM:

F = m7 + m6 + m5 + m4 + m1 = m1 + m4 + m5 + m6 + m7

Page 19: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

19Shorthand SOM FormShorthand SOM Form

• From the previous example, we started with:

F = A + B’ . C• We ended up with:

F = m1+m4+m5+m6+m7

• This can be denoted in the formal shorthand:

• Note that we explicitly show the standard variables in order and drop the “m” designators.

)7,6,5,4,1()C,B,A(F m

Page 20: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

20

Canonical Product of MaxtermsCanonical Product of Maxterms• Any Boolean Function can be expressed as a

Product of Maxterms (POM).– For the function table, the maxterms used are the terms

corresponding to the 0's.– For an expression, expand all terms first to explicitly list all

maxterms. Do this by first applying the second distributive law , “ORing” terms missing variable v with a term equal to (v.v’) and then applying the distributive law again.

• Example: Convert to product of maxterms:f(x,y,z) = x + x’.y’

Apply the distributive law: x + x’.y’ = (x+x’).(x+y’)= 1.(x+y’) = x+y’Add missing variable z: x+y’ +z.z’ =(x+y’+z).(x+y’+z’)

Express as POM: f = M2 · M3

Page 21: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

21

• Convert to Product of Maxterms:f(A,B,C) = A.C’+B.C+A’.B’

• Use x + y z = (x+y)·(x+z) with x= (A.C’ + B.C), y=A’ and z=B’ to get:

f = (A.C’+B.C+A’)(A.C’+B.C+B’)• Then use x + x’.y = x + y to get:

f = (C’+B.C+A’).(A.C’+C+B’)and a second time to get:

f = (C’+B+A’).(A+C+B’)• Rearrange to standard order:

f = (A’+B+C’).(A+B’+C) to give f = M5 · M2

Another POM ExampleAnother POM Example

Page 22: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

22

Function ComplementsFunction Complements

• The complement of a function expressed as a sum of minterms is constructed by selecting the minterms missing in the sum-of-minterms canonical forms.

• Alternatively, the complement of a function expressed by a Sum of Minterms form is simply the Product of Maxterms with the same indices.

• Example: Given

F(x,y,z) m(1,3,5,7)

F '(x,y,z) m(0,2,4,6)

F '(x,y,z) M (1,3,5,7)

Page 23: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

23ConversionConversion BetweenBetween FormsForms• To convert between sum-of-minterms and product-

of-maxterms form (or vice-versa) we follow these steps:– Find the function complement by swapping terms in the

list with terms not in the list.– Change from products to sums, or vice versa.

• Example: Given F as before:• Form the Complement: • Then use the other form with the same indices –

this forms the complement again, giving the other form of the original function:

)7,5,3,1()z,y,x(F m

F '(x,y,z) m(0,2,4,6)

)6,4,2,0()z,y,x(F M

Page 24: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

24

Chapter 2 - Part 1 24

• Standard Sum-of-Products (SOP) form: equations are written as an OR of AND terms

• Standard Product-of-Sums (POS) form: equations are written as an AND of OR terms

• Examples:– SOP: ABC+A’B’C+B– POS: (A+B).(A+B’+C’).C

• These “mixed” forms are neither SOP nor POS– (A.B+C).(A+C)– A.B.C’+A.C.(A+B)

StandardStandard FormsForms

Page 25: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

25

Combinational Circuit AnalysisCombinational Circuit Analysis

• Determine the output for certain input

• Algebraically manipulate logic expressions

• Transform algebraic expression into canonical form (SOP or POS)

Page 26: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

26Simplification of CircuitsSimplification of Circuits

• Example, Simplify the following function

F = [((W.X’)’.Y)’+(W’+X+Y’)’+(W+Z)’]’

(a)Using algebra

(b)Using Circuits

(c) More and better techniques in coming lectures

Page 27: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

27Analysis ExampleAnalysis Example

XYZ

F

Truth Table X Y Z F

0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1

Page 28: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

28Analysis ExampleAnalysis Example

XYZ

F

Truth Table X Y Z F

0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1

Page 29: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

29Analysis Example (cntd.)Analysis Example (cntd.)

XYZ

F

Find an expression for F

F =

Page 30: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

30Analysis Example (cntd.)Analysis Example (cntd.)

XYZ

F

Find an expression for F

F = (X + Y’).Z + X’ . Y . Z’

Page 31: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

31Analysis Example (cntd.)Analysis Example (cntd.)

Find canonical SOP of F (need to expand)

F = (X + Y’).Z + X’ . Y . Z’

F = X .Z + Y’.Z + X’ . Y . Z’ (SOP)

F = X .Y.Z+ X .Y’.Z+ X.Y’.Z +X’.Y’.Z + X’.Y. Z’

F = X .Y.Z+ X .Y’.Z+ X’.Y’.Z +X’.Y.Z’

(Canonical SOP)

F = X,Y,Z(1,2,5,7) (Canonical SOP)

2-level AND-OR Logic

Page 32: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

32Analysis Example (cntd.)Analysis Example (cntd.)

Canonical of SOP, F = X .Y.Z+ X .Y’.Z+ X’.Y’.Z + X’.Y. Z’

X’ YZ’

F

X’ Y’Z

X YZ

X Y’Z

X’ YZ’

F

Y’

Z

X

Z

SOP, 2-levels AND-OR LogicF = X .Z+ Y’.Z + X’.Y. Z’

Canonical of SOP is more expensive to represent a boolean function, more gates and more inputs

Page 33: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

33Analysis Example (cntd.)Analysis Example (cntd.)

Find canonical POS of F

F = (X + Y’).Z + X’ . Y . Z’

Remember DL:

a.b+c.d.e=(a+c)(a+d)(a+e)(b+c)(b+d)(b+e)?

a = (X+Y’); b = Z; c = X’, d=Z’; e = Y;

F= (X+Y’+X’).(X+Y’+Y).(X+Y’+Z’).(Z+X’).(Z+Y). (Z+Z’)

F =1.1.(X+Y’+Z’).(Z+X’).(Z+Y).1

F =(X+Y’+Z’).(Z+X’).(Z+Y) (POS, 2-level OR-AND logic) not POS canonical yet

Page 34: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

34Analysis Example (cntd.)Analysis Example (cntd.)

F =(X+Y’+Z’).(X’+Z).(Y+Z)

F =(X+Y’+Z’).(X’+Y.Y’+Z).(X.X’+Y+Z)

Again DL: a = X’+Z and b.c= Y.Y’

a + bc = (a+b)(a+c)

F =(X+Y’+Z’).(X’+Y+Z).(X’+Y’+Z).(X+Y+Z) .(X’+Y+Z)

F =(X’+Y’+Z) .(X’+Y+Z). (X+Y’+Z’). (X+Y+Z)

F =X,Y,Z(0,3,4,6)

Canonical POS, 2-level OR-AND logic

Page 35: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

35Design ExampleDesign Example

• Alarm System: the alarm will sound-off if:

- The panic button is pushed

- OR alarm is enabled AND someone broke-in

- Alarm locks are on door, window, & garage.

Output : Alarm Sound

Input: Panic Button (P), enable (E), Secure (S), where S = W.D.G (window, door, and garage)

Assume that:

S is active-low ( 0 if activated, 1 if deactivated)

P is active-high (1 if activated, 0 if deactivated)

Page 36: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

36Design ExampleDesign Example

A = P + E.S’

S = W.G.D

E D’

AEG’

E W’

P

Page 37: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

37NAND GatesNAND Gates

• Use less transistors, cheaper to implement, less power consumption etc.

• How to convert a logic circuit to NAND-NAND circuit:

- Find 2-level AND-OR (SOP) implementation

- Replace all gates by NAND gates

- convert single literal inputs to 2nd NAND level gate

Page 38: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

38NAND-NAND circuitsNAND-NAND circuits

• Example

E D’

AEG’

E W’

P

E D’

AEG’

E W’

P

E D’

AEG’

E W’

P

Page 39: 1 Representation of Logic Circuits EE 208 – Logic Design Chapter 2 Sohaib Majzoub

39NOR GatesNOR Gates

• To convert a logic circuit to NOR-NOR circuit:

- Find 2-level OR-AND (POS) implementation

- Replace all gates by NOR gates

- Invert single literal inputs to 2nd level NOR gate