Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

77
Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School

Transcript of Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Page 1: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Logic Gates & Boolean Algebra

Chin-Sung Lin

Eleanor Roosevelt High School

Page 2: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Logic Gates & Boolean Algebra

• System Concept

• Systems & Subsystems

• Analog Systems vs. Digital Systems

• Combinational vs. Sequential Circuits

• Truth Tables & Basic Logic Gates

• Logic Simulation

• Digital Logic Circuits

• Equivalent Logic Circuits

• Digital Building Blocks

Page 3: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

System Concept

Page 4: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

What Are They In Common?

VS.

Computer Onion

Page 5: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

System Concept

System(System Function)

Input Output

Page 6: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

System Concept

System(System Function)

Input Output

Input

Output

System Function

Page 7: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

System Concept

• A convenient way to view and understand both the nature and man-made worlds.

• Hide details and complexity from the viewers by encapsulating this detail information into a “system”.

• Only the inputs/outputs (I/O) of the system, and the function of the system (called system function) are important.

System(System Function)

Input Output

Page 8: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Systems & Subsystems

Page 9: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

System(System Function)

Systems & Subsystems

• Systems can be further divided down to subsystems.

• Subsystems are connected together through inputs and outputs to form the larger system.

Input OutputSubsystem

Subsystem

Sub-system

Input

Input

Output

Page 10: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Subsystem

Subsystem

Sub-system

Input

Input

Output

Systems & Subsystems

• Subsystem themselves can also be further divided down to “Sub-subsystems”.

• This process can be continued until we reach the most basic elements of the digital logic world— basic logic gates.

• A system has a layered hierarchical structure like an onion.

Input OutputInput

Input

Output

Page 11: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Systems & Subsystems

Page 12: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Analog System vs. Digital Systems

Page 13: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Analog System vs. Digital Systems

• Two types of systems: Analog system and digital system.

AnalogSystem

Input Output

DigitalSystem

Input Output

Page 14: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Analog System vs. Digital Systems

• The values of input/output/internal signals of an analog system can vary over a continuous range of values.

AnalogSystem

Input Output

Page 15: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Analog System vs. Digital Systems

• The values of input/output/internal signals of a digital system can only be 1’s and 0’s.

DigitalSystem

Input Output0 10 01 0 101 1

Page 16: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Analog System vs. Digital Systems

• Lots of real-world signals are analog in nature.

• Analog-to-Digital (A/D) converter has been used to process (digitization/quantization) the incoming analog signals and change them to digital (binary) signals.

• The digital signals can now be processed by the digital system (e.g., microprocessor).

DigitalSystem

Digital I/P

0 10 01

A/DConverter

Analog I/P

Page 17: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Analog System vs. Digital Systems

• The output digital signals from the digital system are digital (binary) in nature.

• Digital-to-Analog (D/A) converter has been used to process the outgoing digital signals and change them to analog (continuous) signals.

• Most of the computers are the mix of analog and digital systems.

DigitalSystem

Digital I/P Digital O/P

0 10 01 0 101 1

D/AConverter

A/DConverter

Analog I/P Analog O/P

Page 18: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

DigitalSystem

Digital I/P Digital O/P

0 10 01 0 101 1

D/AConverter

A/DConverter

Analog I/P Analog O/P

Analog System vs. Digital Systems

Page 19: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

DigitalSystem

Digital I/P Digital O/P

0 10 01 0 101 1

D/AConverter

A/DConverter

Analog I/P Analog O/P

Digital Systems

• In this unit, we are going to focus ONLY on the digital system.

Page 20: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Combinational vs. Sequential Systems

Page 21: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Combinational vs. Sequential Systems

CombinationalSystemInput Output0 10 01 0 101 1

SequentialSystemInput Output0 10 01 0 101 1

• Two types of digital systems/circuits— combinational and sequential.

Page 22: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Combinational vs. Sequential Systems

• The outputs of a combinational digital system/circuits are solely decided by its inputs.

CombinationalSystemInput Output0 10 01 0 101 1

CombinationalSystemInput Output0 10 01 0 101 1

CombinationalSystemInput Output1 01 10 0 011 0

Page 23: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Combinational vs. Sequential Systems

• The outputs of a sequential digital system/circuits depend not only on its inputs, but also on the “current state” of the system.

SequentialSystemInput Output0 10 01 0 101 1

SequentialSystemInput Output0 10 01 1 010 0

SequentialSystemInput Output1 01 10 0 011 0

Page 24: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

SequentialSystem

SequentialSystem

SequentialSystem

Combinational vs. Sequential Systems

• The outputs of a sequential digital system/circuits depend not only on its inputs, but also on the “current state” of the system.

• Sequential system/circuits have some sort of “memory” in it, so it can “memorize” the “current state” of the system and behave accordingly.

Input Output0 10 01 0 101 1

Input Output1 01 10 0 011 0

Input Output0 10 01 1 010 0

State: 101

State: 110

State: 001

Page 25: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Combinational vs. Sequential Systems

CombinationalSystemInput Output0 10 01 0 101 1

SequentialSystemInput Output0 10 01 0 101 1

Page 26: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

SequentialSystemInput Output0 10 01 0 101 1

Combinational Systems

• In this unit, we are going to focus ONLY on the combinational digital system.

CombinationalSystemInput Output0 10 01 0 101 1

Page 27: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Truth Tables & Basic Logic Gates

Page 28: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Truth Tables

• A truth table shows how a logic circuit's output responds to various combinations of the inputs.

• A truth table describe the system function of a logic system.

• Use “1” and “0” to represent “T” and “F” respectively.

1 1

1

1

1

0 0 0

0

00

0

p

qpq

• Use a logic gate symbol to represent the function.

Page 29: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Truth Tables & Basic Logic Gates

X = AB

• There are eight basic logic gates. However, only AND, OR and NOT are the most fundamental ones.

Page 30: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Negations (NOT)

• The negation of a statement always has the opposite truth value of the original statement and is usually formed by adding the word not to the given statement.

• Statement Right angle is 90o

• Negation Right angle is not 90o

TRUE

FALSE

• Statement Triangle has 4 sides

• Negation Triangle does not have 4 sides

FALSE

TRUE

Page 31: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Truth Table – Negation (NOT)

• The relationship between a statement p and its negation ~p can be summarized in a truth table.

• A statement p and its negation ~p have opposite truth values.

p ~p

T F

F T

Page 32: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Conjunctions (AND)

• A compound statement formed by combining two simple statements using the word and.

• Statement: p, q • Conjunction: p and q • Symbols: p ^ q

Page 33: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Truth Table – Conjunctions (AND)

• A conjunction is true when both statements are true.• When one or both statements are false, the conjunction is false.

p q p ^ q

T T T

T F F

F T F

F F F

Page 34: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Disjunctions (OR)

• A compound statement formed by combining two simple statements using the word or.

• Statement: p, q • Disjunction p or q • Symbols: p V q

Page 35: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Truth Table – Disjunctions (OR)

• A disjunction is true when one or both statements are true.

• When both statements are false, the disjunction is false.

p q p V q

T T T

T F T

F T T

F F F

Page 36: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Truth Tables & Basic Logic Gates

• Use 1 and 0 to represent True and False respectively.

• The truth table summarizes all the possible values of input signals and their corresponding output signal values.

p ~p

T F

F T

X Y

1 0

0 1

Page 37: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Truth Tables & Basic Logic Gates

• The truth table is an effective way to describe the system function of a digital system.

Input X Output Y

X Y

1 0

0 1

0/1 1/0

System Function

Page 38: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Truth Tables & Basic Logic Gates

• A logic gate is a device performing a logical operation on one or more logical inputs, and produces a single logical output.

0/1 1/0

Logic Gate

X

Page 39: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Boolean Algebra & Boolean Functions

• Boolean algebra is a branch of algebra in which the values of the variables are the truth values true (1) and false (0).

• The main operations of Boolean algebra are the conjunction (and, ), the disjunction (or, +), and the negation (not, ).

0/1 1/0

Logic Gate

X

Page 40: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Boolean Algebra & Boolean Functions

• A Boolean function describes how to determine a Boolean value output based on some logical calculation from Boolean inputs.

Y = X Y = A + BY = A B

(NOT) (OR)(AND)

Page 41: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Truth Tables & Basic Logic Gates

XX Y

0 1

1 0

NOT(Inverter)

Boolean Function Truth Table Logic Gate

Y = X

Page 42: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Truth Tables & Basic Logic Gates

AND

Truth Table Logic Gate

A B Y

0 0 0

0 1 0

1 0 0

1 1 1

Y = A B

Boolean Function

Page 43: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Truth Tables & Basic Logic Gates

Truth Table Logic Gate

A B Y

0 0 0

0 1 1

1 0 1

1 1 1OR

Y = A + B

Boolean Function

Page 44: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Truth Tables & Basic Logic Gates

X Y

0 0

1 1

Buffer

Boolean Function Truth Table Logic Gate

Y = XX

Page 45: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Truth Tables & Basic Logic Gates

NAND

Truth Table Logic Gate

A B Y

0 0 1

0 1 1

1 0 1

1 1 0

Y = A B

Boolean Function

Page 46: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Truth Tables & Basic Logic Gates

Truth Table Logic Gate

A B Y

0 0 1

0 1 0

1 0 0

1 1 0NOR

Y = A + B

Boolean Function

Page 47: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Truth Tables & Basic Logic Gates

XOR

Truth Table Logic Gate

A B Y

0 0 0

0 1 1

1 0 1

1 1 0

Y = A ⊕ B

Boolean Function

Page 48: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Truth Tables & Basic Logic Gates

Truth Table Logic Gate

A B Y

0 0 1

0 1 0

1 0 0

1 1 1XNOR

Y = A B

Boolean Function

Y = A ⊕ B

Page 49: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Truth Tables & Basic Logic Gates

X = AB

Page 50: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Logic Simulation

Page 51: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Logic Simulation

• Logic simulation is the use of simulation software to predict the behavior of digital circuits.

Page 52: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Digital Logic Circuits

Page 53: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Digital Logic Circuits

• Logic gates can be connected and cascaded to form logic

circuits.

• Every logic circuits can be treated as a system, and can be

described by a system function— truth table.

• We can derive the truth table of the circuit by evaluating the

logic circuit stage by stage.

Y

Page 54: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Digital Logic Circuits

A B C D E F Y

0 0

0 1

1 0

1 1

C

D

E

F

Y

Page 55: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Digital Logic Circuits

A B C D E F Y

0 0 1

0 1 1

1 0 0

1 1 0

C

D

E

F

Y

Page 56: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Digital Logic Circuits

A B C D E F Y

0 0 1 1

0 1 1 0

1 0 0 1

1 1 0 0

C

D

E

F

Y

Page 57: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Digital Logic Circuits

A B C D E F Y

0 0 1 1 0

0 1 1 0 1

1 0 0 1 0

1 1 0 0 0

C

D

E

F

Y

Page 58: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Digital Logic Circuits

A B C D E F Y

0 0 1 1 0 0

0 1 1 0 1 0

1 0 0 1 0 1

1 1 0 0 0 0

C

D

E

F

Y

Page 59: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Digital Logic Circuits

A B C D E F Y

0 0 1 1 0 0 0

0 1 1 0 1 0 1

1 0 0 1 0 1 1

1 1 0 0 0 0 0

C

D

E

F

Y

Page 60: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Digital Logic Circuits

A B C D E F Y

0 0 1 1 0 0 0

0 1 1 0 1 0 1

1 0 0 1 0 1 1

1 1 0 0 0 0 0

C

D

E

F

Y = A B+

Page 61: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Equivalent Logic Circuits

Page 62: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Equivalent Logic Circuits

• Logic circuits of different gates and forms can have an identical truth table. These circuits are called equivalent logic circuits.

• This implies that a digital system with certain system function (truth table) can have many different implementations.

Page 63: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Laws of Boolean Algebra

One variableNOT: • x = xAND: • x · x = x• x · x = 0OR: • x + x = x• x + x = 1XOR: • x x = 0⊕• x x = 1⊕

Page 64: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Laws of Boolean Algebra

Commutativity• AND: x · y = y · x• OR: x + y = y + x• XOR: x y = y x⊕ ⊕

Associativity• AND: (x · y) · z = x · (y · z)• OR: (x + y) + z = x + (y + z)• XOR: (x y) z = x (y z)⊕ ⊕ ⊕ ⊕

Page 65: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Laws of Boolean Algebra

Distributivity• x · (y + z) = (x · y) + (x · z)• x + (y · z) = (x + y) · (x + z)• x · (y z) = (x · y) (x · z)⊕ ⊕

De Morgan’s laws• NAND: x · y = x + y• NOR: x + y = x · y

Page 66: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Logic Simplification

• We can apply the laws of Boolean algebra to reduce the expression to its simplest form (simplest defined as requiring the fewest gates to implement)

Page 67: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Equivalent Logic Circuits

Different implementations are chosen to meet different design considerations• Less number of gates (area)• less kind of gates (gate type), and • less stages of the circuits (speed).

Page 68: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Equivalent Logic Circuits

• For example, what are the following logic circuits?

Page 69: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Equivalent Logic Circuits

• For example, all of the following four logic circuits have the same truth table, and implement the XOR gate functionality.

Page 70: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Digital Building Blocks

Page 71: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Digital Building Blocks

• All these logic circuits can be encapsulated into a block (XOR gate) and treated as a system.

Page 72: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Digital Building Blocks

• This XOR gate can be further used as a building block to build larger and more complicated logic circuit such as a “full adder”.

Page 73: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Digital Building Blocks

• A full adder can again be treated as a building block to build a larger logic circuit called Arithmetic-Logic Unit (ALU).

Page 74: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Digital Building Blocks

• ALU can again be treated as a building block to build a Central Processing Unit (CPU).

Page 75: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Digital Building Blocks

• This process can go on and on to build an Intel® Intel® Core™ i7 Processor with these digital logic building blocks.

Intel Core i7 Processor

Page 76: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Digital Building Blocks

• The processor is so complicated at this level that it can contain hundreds of millions of basic logic gates.

Page 77: Logic Gates & Boolean Algebra Chin-Sung Lin Eleanor Roosevelt High School.

Q & A