Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions...

28
Digital Logic Design Lecture 2: Logic functions and Boolean algebra Napat Triroj 1

Transcript of Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions...

Page 1: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Digital Logic Design

Lecture 2: Logic functions and Boolean algebra

Napat Triroj 1

Page 2: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

A binary switch

Napat Triroj 2

Stephen Brown and Zvonko Vranesic. Fundamentals of Digital Logic with Verilog Design, 3rd ed. The McGraw-Hill Companies, Inc. 2014.

L = 1 if x = 1

L = 0 if x = 0

Example: a light controlled by a switch

The logic function describes the output as a function of the input.

input variable

Page 3: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

AND and OR operations

Napat Triroj 3

Stephen Brown and Zvonko Vranesic. Fundamentals of Digital Logic with Verilog Design, 3rd ed. The McGraw-Hill Companies, Inc. 2014.

Example: a system using two switches to control the state of the light

“AND” operator or logical “product”

“OR” operator or logical “sum”

Page 4: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

AND and OR operations

Napat Triroj 4

Stephen Brown and Zvonko Vranesic. Fundamentals of Digital Logic with Verilog Design, 3rd ed. The McGraw-Hill Companies, Inc. 2014.

The logic function:

Page 5: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Complement or NOT operation

Napat Triroj 5

Stephen Brown and Zvonko Vranesic. Fundamentals of Digital Logic with Verilog Design, 3rd ed. The McGraw-Hill Companies, Inc. 2014.

Example: The light will be turned on when the switch is opened.

L(x) is a complement of x.

NOT operator

Equivalent NOT operators:

Page 6: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Truth tables

Napat Triroj 6

Stephen Brown and Zvonko Vranesic. Fundamentals of Digital Logic with Verilog Design, 3rd ed. The McGraw-Hill Companies, Inc. 2014.

Two-input variables

For n input variables, the truth table contains 2n rows.

These rows refer to possible combinations of logic values.

Three-input variables

Page 7: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Analysis of a logic network

Napat Triroj 7

Stephen Brown and Zvonko Vranesic. Fundamentals of Digital Logic with Verilog Design, 3rd ed. The McGraw-Hill Companies, Inc. 2014.

0

0

0

1 0

1 1

1

The timing diagrams depict the functional behavior of a logic circuit in a form that can be observed when the circuit is tested using instruments such as logic analyzers and oscilloscopes.

Page 8: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Functionally equivalent networks

Napat Triroj 8

Stephen Brown and Zvonko Vranesic. Fundamentals of Digital Logic with Verilog Design, 3rd ed. The McGraw-Hill Companies, Inc. 2014.

The equivalence:

g(x1, x2)

1101

Page 9: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

toggle switchVDD

GND

Example: the equivalence of a logic network

Napat Triroj 9

Stephen Brown and Zvonko Vranesic. Fundamentals of Digital Logic with Verilog Design, 3rd ed. The McGraw-Hill Companies, Inc. 2014.

The required behavior: The light (L) should be ON only if one, but not both, of the toggle switches is in the top position.

exclusive-OR

Page 10: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Example: an adder circuit

Napat Triroj 10

Stephen Brown and Zvonko Vranesic. Fundamentals of Digital Logic with Verilog Design, 3rd ed. The McGraw-Hill Companies, Inc. 2014.

The addition of two one-digit binary numbers:

Binary number

Binary Decimal

0112

Page 11: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Boolean algebra: Axioms

Napat Triroj 11

Stephen Brown and Zvonko Vranesic. Fundamentals of Digital Logic with Verilog Design, 3rd ed. The McGraw-Hill Companies, Inc. 2014.

The Boolean algebra can be used for designing and analyzing logic circuits.

Boolean algebra is based on a set of rules that are derived from asmall number of basic assumptions called axioms.

Axioms:The principle of duality:

Given a logic expression, its dual is obtained by replacing all + operators with · operators, and vice versa, and by replacing all 0s with 1s, and vice versa.

Page 12: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Boolean algebra: Single-variable theorems

Napat Triroj 12

Stephen Brown and Zvonko Vranesic. Fundamentals of Digital Logic with Verilog Design, 3rd ed. The McGraw-Hill Companies, Inc. 2014.

The theorem can be proved by substituting the values x = 0 and x = 1 into the expressions and using the axioms.

Page 13: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Boolean algebra: Two- and three-variable properties

Napat Triroj 13

Stephen Brown and Zvonko Vranesic. Fundamentals of Digital Logic with Verilog Design, 3rd ed. The McGraw-Hill Companies, Inc. 2014.

In the absence of parentheses, operations in a logic expression must be performed in the order: NOT, AND, and then OR.

Page 14: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

The Venn diagram

Napat Triroj 14

Stephen Brown and Zvonko Vranesic. Fundamentals of Digital Logic with Verilog Design, 3rd ed. The McGraw-Hill Companies, Inc. 2014.

The Venn diagram has traditionally been used in mathematics to provide a graphical illustration of various operations and relations in the algebra of sets.

In Boolean algebra there are only two values (elements) in the universe, B = {0, 1}.

The shading area is where the value of the logic expression equal to 1.

unionintersection

Page 15: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Example: verification of the distributive property

Napat Triroj 15

Stephen Brown and Zvonko Vranesic. Fundamentals of Digital Logic with Verilog Design, 3rd ed. The McGraw-Hill Companies, Inc. 2014.

Page 16: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Synthesis of logic circuits using AND, OR, and NOT gates

Napat Triroj 16

Stephen Brown and Zvonko Vranesic. Fundamentals of Digital Logic with Verilog Design, 3rd ed. The McGraw-Hill Companies, Inc. 2014.

Example: designing a logic circuit that implements the following truth table

Steps:

1. Create a product term that has a value of 1 for each valuation for which the output function f has to be 1.

2. Take a logical sum of these product terms to realize f .

sum-of-products

algebraic manipulation

Page 17: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Sum-of-products and product-of-sums forms

Napat Triroj 17

Stephen Brown and Zvonko Vranesic. Fundamentals of Digital Logic with Verilog Design, 3rd ed. The McGraw-Hill Companies, Inc. 2014.

Consider the rows for which f = 1:

SOP

Consider the rows for which f = 0:

POS

complements of minterms

Page 18: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Logic symbol interpretation

Napat Triroj 18

Neal S. Widmer, Gregory L. Moss, and Ronald J. Tocci. Digital Systems: Principles and Applications, 12th ed. Pearson Education, Inc. 2017.

“bubble”

Page 19: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

NAND and NOR logic networks

Napat Triroj 19

Stephen Brown and Zvonko Vranesic. Fundamentals of Digital Logic with Verilog Design, 3rd ed. The McGraw-Hill Companies, Inc. 2014.

Page 20: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Alternate logic symbols

Napat Triroj 20

Neal S. Widmer, Gregory L. Moss, and Ronald J. Tocci. Digital Systems: Principles and Applications, 12th ed. Pearson Education, Inc. 2017.

Page 21: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Using NAND gates to implement a sum-of-products

Napat Triroj 21

Stephen Brown and Zvonko Vranesic. Fundamentals of Digital Logic with Verilog Design, 3rd ed. The McGraw-Hill Companies, Inc. 2014.

Page 22: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Using NOR gates to implement a product-of-sums

Napat Triroj 22

Stephen Brown and Zvonko Vranesic. Fundamentals of Digital Logic with Verilog Design, 3rd ed. The McGraw-Hill Companies, Inc. 2014.

Page 23: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Selection of gate representation

Napat Triroj 23

Neal S. Widmer, Gregory L. Moss, and Ronald J. Tocci. Digital Systems: Principles and Applications, 12th ed. Pearson Education, Inc. 2017.

Output Z will go HIGH whenever either A = B = 1 or C = D = 1(or both).

Output Z will go LOW only when A or B is LOW and C or D is LOW.

Page 24: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Selection of gate representation

Napat Triroj 24

Neal S. Widmer, Gregory L. Moss, and Ronald J. Tocci. Digital Systems: Principles and Applications, 12th ed. Pearson Education, Inc. 2017.

Example: When the output of the logic circuit in the figure below goes LOW, it activates another logic circuit. Modify the circuit diagram to represent the circuitoperation more effectively.

Tip for bubble placement: Whenever possible, choose gate symbols so that bubble outputs are connected to bubble inputs, and nonbubble outputs to nonbubble inputs.

Output Z will go LOW only when A and B are LOW and C or D is LOW and E is HIGH.

Page 25: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Universality of NAND gates

Napat Triroj 25

Neal S. Widmer, Gregory L. Moss, and Ronald J. Tocci. Digital Systems: Principles and Applications, 12th ed. Pearson Education, Inc. 2017.

NAND gates can be used to implement any Boolean function.

Page 26: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Universality of NOR gates

Napat Triroj 26

Neal S. Widmer, Gregory L. Moss, and Ronald J. Tocci. Digital Systems: Principles and Applications, 12th ed. Pearson Education, Inc. 2017.

NOR gates can be used to implement any Boolean function.

Page 27: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Exclusive OR (XOR) circuits

Napat Triroj 27

Neal S. Widmer, Gregory L. Moss, and Ronald J. Tocci. Digital Systems: Principles and Applications, 12th ed. Pearson Education, Inc. 2017.http://www.electrical4u.com/exclusive-or-gate/

When odd number of inputs in the gate are 1, the output is 1, and when none or even number of inputs are 1, the output is logical 0.

“Odd function”

Page 28: Digital Logic Design - Khon Kaen Universityeestaff.kku.ac.th/~sa-nguan/EN812200/Ch2-Logic functions and Bool… · Digital Logic Design Lecture 2: Logic functions and Boolean algebra

Exclusive NOR (XNOR) circuits

Napat Triroj 28

Neal S. Widmer, Gregory L. Moss, and Ronald J. Tocci. Digital Systems: Principles and Applications, 12th ed. Pearson Education, Inc. 2017.

When there are odd numbers of inputs are in high or logical 1 condition, the output will be 0, in otherwise the output will be 1.

http://www.electrical4u.com/exclusive-or-gate/

“Even function”