50
1 Logic Gates Digital Computer Logic Kashif Bashir WWW: http://www.kashifpaf.greatnow.com

1 Logic Gates Digital Computer Logic Kashif Bashir WWW: Email: [email protected]

Embed Size (px)

Citation preview

Page 1: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

1

Logic Gates

Digital Computer Logic

Kashif Bashir WWW: http://www.kashifpaf.greatnow.com

Email: [email protected]

Page 2: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

2

Module Outline Binary Logic and Basic Gates Boolean Algebra Standard Forms Simplification of Boolean Functions NAND and NOR Gates XOR Gate Integrated Circuits CMOS Gates

Page 3: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

3

Binary Logic Deals with variables that take on only two

discrete values and operations of mathematical logic that are applied to these variables

The two values are known by different names:HIGH and LOWTRUE and FALSE0 and 1

Variables may be denoted by any name but single letter character names such as A, B, C, X, Y, Z, etc. are common and easy to use

Page 4: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

4

Logical Operations AND

Represented by a dot · or sometimes or Binary operator, i.e. operates on two variables at a time

OR Represented by a + or sometimes or Binary operator, i.e. operates on two variables at a time

NOT Represented by a bar over the variable, e.g. A or A’ Unary operator, i.e. operates on a single variable Also referred to as COMPELMENT operator

Page 5: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

5

Binary Logic and Basic Gates

Digital Circuits and Systems are complex However, the basic building blocks of all

digital circuits and systems are logic gates Logic gates are therefore called the basic

primitives of digital systems Logic gates in reality are implemented using

electronic components such as transistors However, we are not concerned with their

internal electronic properties but rather their external logic behavior

Page 6: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

6

Electronic vs. Logical

+V

_X

X

X_X

Electronic Implementation Logical Behavior

Page 7: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

7

Standard Symbols

X_X

X

YX + Y

X

YX · YAND

OR

NOT

Page 8: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

8

Truth Table A table of combinations of the binary variables

showing the the relationship between between the values the variables take on and the values of the result of the operation

X Y

AND

Z = X · Y

0 00 11 01 1

0001

X Y

OR

Z = X + Y

0 00 11 01 1

0111

X

NOT

Z = X

01

10

Page 9: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

9

Gates with More Than Two Inputs

A

CF = A · B · C

3-Input AND gate

B

A

F = A+B+C+D+E+FBCDEF

6-Input OR gate

Page 10: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

10

Truth Table

X Y Z

AND

F = X · Y · Z

0 0 0 0

0 0 1 0

0 1 0 0

0 1 1 0

1 0 0 0

1 0 1 0

1 1 0 0

1 1 1 1

Page 11: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

11

Boolean Algebra Defines rules of operations on Binary Logic and Logic

Functions Sometimes similar to Binary Arithmetic but some

times different – because binary logic variables can only take on two possible values 0 and 1

A Boolean function consists of a binary variable denoting the function, an equals sign, and an algebraic expression formed by using binary variables. For example

F = X + Y’Z

Page 12: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

12

Truth Tables for Boolean Functions

Truth Table can be constructed for every boolean function

A boolean function of n-variables will have 2n rows in its truth table

These 2n inputs are formed by counting from 0 to 2n - 1

For example G(W,X,Y,Z) will have 16 rows in the truth table and F(A,B) will have 4 rows

Page 13: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

13

Truth Table for F = X + Y’Z

X Y Z

Truth Table for F = X + Y’ · Z

F

0 0 0 0

0 0 1 1

0 1 0 0

0 1 1 0

1 0 0 1

1 0 1 1

1 1 0 1

1 1 1 1

X

Y

Z

F

Logic Circuit Diagram for F = X + Y’Z

Page 14: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

14

Timing Diagram

0 0 0 1AND

0 1 1 1OR

0 0 1 1X

0 1 0 1Y

NOT(X) 1 1 0 0

Horizontal axis represents time

Vertical axis shows the value of the signal

High voltage level represents 1 and low voltage level represents 0

Timing diagrams are very important in digital systems design and verification

Page 15: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

15

Basic Identities of Boolean Algebra

1. X + 0 = X2. X · 1 = X3. X + 1 = 14. X · 0 = 05. X + X = X6. X · X = X7. X + X’ = 18. X · X’ = 09. (X’)’ = X

Page 16: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

16

Basic Identities of Boolean Algebra

1. X + Y = Y + X

2. XY = YX

3. X + (Y + Z) = (X + Y) + Z

4. X (YZ) = (XY)Z

5. X(Y+Z) = XY+ XZ

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

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

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

Commutative

Associative

Distributive

DeMorgan’s

Page 17: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

17

Algebraic Manipulation Using basic identities a boolean function can be

simplified For example

F = X’YZ + X’YZ’ + XZ= X’Y(Z + Z’) + XZ= X’Y·1 + XZ= X’Y + XZ

Page 18: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

18

Algebraic Manipulation Examples

1. X + XY = X (1+Y) = X2. XY + XY’ = X (Y + Y’) = X3. X + X’Y = (X + X’) (X + Y) = X + Y4. X (X + Y) = X + XY = X (1 + Y) = X5. (X + Y)(X + Y’) = X + XY’ + XY + YY’

= X (1 + Y’) + XY = X·1 + XY = X + XY = X (1 + Y) = X

6. X(X’ + Y) = XX’ +XY = XY

Page 19: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

19

Duality Principle Dual of an expression is obtained by changing

AND to OR and OR to AND throughout and 1’s to 0’s and 0’s to 1’s, if they appear in the expression

X + Y’ XY’ XY+X’Y’ (X + Y)(X’ + Y’) Boolean equation remains valid if we take the

dual of the expression on both sides of an equals sign

Page 20: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

20

Consensus Theorem XY + X’Z + YZ = XY + X’Z Proof

XY + X’Z + YZ = XY + X’Z + YZ(X + X’)= XY = X’Z + XYZ + X’YZ= XY + XYZ + X’Z + X’YZ= XY (1 +Z) + X’Z(1 + Y)= XY + X’Z

Dual of Consensus Theorem is: (X + Y)(X’ + Z)(Y + Z) = (X + Y)(X’ + Z)

Page 21: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

21

Complement of a Function Obtained by interchange of 1’s top 0’s and 0’s to 1’s

for the values of F in the truth table Can be derived algebraically by applying DeMorgan’s

theorem Complement of an expression is obtained by

interchanging AND and OR and complementing each variable and constant

Example:

F = X’YZ’ + X’Y’Z

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

Page 22: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

22

Standard Forms Variety of possible ways of writing a boolean function

algebraically Hard to see unambiguously that it is the same function

we are talking about Standard forms have been developed Standard forms also generate more desirable logic

circuits Product terms and Sum terms

Product: XY’Z Sum: X + Y’ + Z

Page 23: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

23

Truth Table and Algebraic Expression

A truth table defines a boolean function

An algebraic expression for the function is derived by finding the logical sum of all the product terms for which the function assumes a binary value 1

For example: F = X’Y’Z + XY’Z’ +

XYZ’ + XYZ

X Y Z

Truth Table for F = X + Y’ · Z

F

0 0 0 0

0 0 1 1

0 1 0 0

0 1 1 0

1 0 0 1

1 0 1 1

1 1 0 1

1 1 1 1

Page 24: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

24

Minterms A product term in which all the variables appear

exactly once, either complemented or uncomplemented, is called a minterm

There are 2n minterms for n Boolean variables Any Boolean function can be expressed as logical sum

of minterms The complement of a function contain those minterm

not included in the original function A function that includes all the 2n minterms is equal to

logic 1 The symbol for a minterm is mj where j denotes the

decimal equivalent of the binary combination for which the minterm has value 1

Page 25: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

25

Maxterms A sum term containing all the variables once in

complemented or uncomplemented form is called a maxterm

There are 2n maxterms for n Boolean variables Any Boolean function can be expressed as

logical product of maxterms The symbol for a maxterm is Mj where j

denotes the decimal equivalent of the binary combination for which the maxterm has value 0

Page 26: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

26

X Y Z

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

E

0

1

0

0

0

1

0

1

F

1

10

0

1

0

1

1

Example

E(X, Y, Z) = m(1,5,7)F(X, Y, Z) = m(0,1,4,6,7)

E’(X, Y, Z) = m(0,2,3,4,6)F’(X, Y, Z) = m(2,3,5)

E + F = m(0,1,4,5,6,7)E · F = m(1,7)

Page 27: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

27

Sum of Products Implementation

Also called sum of minterms Look again at the previous example F = X’Y’Z + XY’Z’ + XYZ’ + XYZ It can be represented as m0 + m2 + m5 + m7

Or alternatively: F(X, Y, Z) = m(0,2,5,7) F’ = m(1,3,4,6)

Page 28: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

28

Product of Sums Implementation

Also called product of maxterms A Boolean function can be expressed as

product of maxterms F = M(1,3,4,6) Related to the sum of products or minterm

representation of the F’

Page 29: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

29

Two Level Implementations The standard forms result in two level

implementation of a Boolean function Sum of products representation results in an

AND/OR implementation Product of sums results in an OR/AND

implementation

Page 30: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

30

Karnaugh Maps Boolean expressions may be simplified by using

algebraic operations But there is not set method to predict the steps to take That means not amenable to automated techniques Karnaugh Maps to the rescue Generates simplified expressions that are in SOP or

POS form Produce two-level implementation with a minimum

number of gates and a minimum number of inputs to the gates

Sometimes two or more expressions that satisfy the simplification criteria

Page 31: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

31

Two-Variable Map Four minterms so

four squares As an example two

K-maps are shown:1. F(X, Y) = XY

2. F(X, Y) = X’Y + XY’

m0 m1

m2 m3

X’Y’ X’Y

XY’ XY

Y

X0 1

0

1

0 0

0 1

Y

X0 1

0

1

0 1

1 1

Y

X0 1

0

1

Page 32: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

32

Three-Variable Map

X’Y’Z’X’Y’Z

XY’Z’ XY’Z

YZ

X00 01

0

1

X’YZ X’YZ’

XYZ XYZ’

11 10

m0 m1

m4 m5

m3 m2

m7 m6

Page 33: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

33

Example 1

Page 34: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

34

Four-Variable Map Example - 1

Page 35: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

35

Four-Variable Map Example - 2

Page 36: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

36

Five Variable K-Maps

Page 37: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

37

Five Variable K-Maps Example

Page 38: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

38

Don’t Care Conditions

Page 39: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

39

NAND Not AND = NAND

X

Y

X · Y

(X · Y)’

X

Y

(X · Y)’

X Y

NAND

(X · Y)’

0 00 11 01 1

1110

Page 40: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

40

NOR Gates Not OR = NOR

X Y

NOR

(X + Y)’

0 00 11 01 1

1000

X

Y

(X + Y)’

X

Y

X + Y (X + Y)’

Page 41: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

41

XOR XOR =

Exclusive OR

Page 42: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

42

Use of XOR in Parity Generation and Checking

Page 43: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

43

A Complete Set of Gates AND, OR, NOT NAND NOR XOR?

Page 44: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

44

Integrated Circuits An Integrated Circuit or IC or chip is a small

silicon crystal containing the electronic components

Page 45: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

45

Integrated Circuits

Page 46: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

46

Levels of Integration SSI MSI LSI VLSI

Page 47: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

47

Digital Logic Families What? Why? RTL DTL TTL ECL MOS CMOS BiCMOS

Page 48: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

48

Important Characteristics Fan-in Fan-out Noise Margin Power Dissipation Propagation Delay

Page 49: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

49

Propagation Delay for an Inverter

t PHL t PLH

IN

OUT

X_X

Page 50: 1 Logic Gates Digital Computer Logic Kashif Bashir WWW:  Email: kashif@pafkiet.edu.pk

50

CMOS Circuits CMOS =

Complementary Metal Oxide Semiconductor

A type of transistor Two types N-channel (NMOS) P-channel (PMOS)