Chapter 2
Chapter 2
Sukree Sinthupinyo
Department of Computer Science
Thammasat University
Logic Gates
Switches
● Electric Circuit
■ Most familiar example of a switch: device that controls the
● Electric Circuit
● Physical Switches: Relay
flow of current through an electric circuit
● Physical Switches: Transistor
■ A light fixture L is to be connected to the electric power
Logic Gates
supply P S and to a manual switch S2
Gate-Level Circuits ◆ Turning S2 on and off turns the light on and off
Boolean Algebra
■ A circuit breaker S1 is to be installed near the entry point of
the power supply.
◆ Turning S1 off will turn L off, independently of S2
Switches
● Electric Circuit
● Electric Circuit
● Physical Switches: Relay
● Physical Switches: Transistor
Logic Gates
Gate-Level Circuits
Boolean Algebra
Switches
● Electric Circuit
■ Electromechanical Relay contains an electromagnet that
● Electric Circuit
● Physical Switches: Relay
consists of a wire coil wrapped around a magnetizable iron
● Physical Switches: Transistor core
Logic Gates ■ Input variable x of the relay is an electric current applied to
Gate-Level Circuits
the coil
Boolean Algebra
■ Activate by an electric x = 1
Switches
● Electric Circuit
■ This particular transistor is of a type known as metal-oxide
● Electric Circuit
● Physical Switches: Relay
semiconductor-MOS
● Physical Switches: Transistor
■ Input variable x is an electric voltage {VL , VH }
Logic Gates
■ Output variable z is an electric current that takes the binary
Gate-Level Circuits
values {IL , IH }
Boolean Algebra
■ It’s more practical when dealing with MOS transistor circuits
to treat x and z as binary voltages that assume the same set
of values {VL , VH }
Logic Gates
● A General Definition
● Single-Input Gates
● Single-Input Gates
● Single-Input Gates
● And Gate
● And Gate
Logic Gates
● Or Gate
● Or Gate
● NAND and NOR Gate
● NAND Gate
● NOR Gate
● EXCLUSIVE-OR Gate
● XOR Gate
● XOR Gate
Gate-Level Circuits
Boolean Algebra
Gate-Level Circuits
◆ and is one of about six basic types
Boolean Algebra
Switches ■ Buffer
Logic Gates ◆ Output z is 1 whenever the input x is 1; z is 0 whenever x
● A General Definition
● Single-Input Gates is 0
● Single-Input Gates
● Single-Input Gates z=x
● And Gate
● And Gate
● Or Gate
■ Inverter or NOT gate
● Or Gate
◆ Output z is 0 whenever the input x is 1; z is 1 whenever x
● NAND and NOR Gate
● NAND Gate
● NOR Gate
is 0
● EXCLUSIVE-OR Gate
● XOR Gate
zN OT = x̄
● XOR Gate
Gate-Level Circuits
Boolean Algebra
Switches
Logic Gates
● A General Definition
● Single-Input Gates
x z x z
● Single-Input Gates
● Single-Input Gates
● And Gate
● And Gate
● Or Gate
● Or Gate
Buffer Inverter
● NAND and NOR Gate
● NAND Gate
● NOR Gate
● EXCLUSIVE-OR Gate
● XOR Gate
● XOR Gate
Gate-Level Circuits
Boolean Algebra
Switches ■ Buffer
Logic Gates
● A General Definition
Input Output
● Single-Input Gates
● Single-Input Gates
x z
● Single-Input Gates
● And Gate 0 0
● And Gate
● Or Gate 1 1
● Or Gate
● NAND and NOR Gate
● NAND Gate
■ Inverter or NOT gate
● NOR Gate
● EXCLUSIVE-OR Gate
Input Output
● XOR Gate
● XOR Gate x z
Gate-Level Circuits 0 1
Boolean Algebra
1 0
Boolean Algebra
x1
x2
xn
Sukree Sinthupinyo, December 12, 2006 Logic Elements - p. 13/44
Or Gate
Gate-Level Circuits
Boolean Algebra
x1
x2
xn
Sukree Sinthupinyo, December 12, 2006 Logic Elements - p. 15/44
NAND and NOR Gate
Gate-Level Circuits
Boolean Algebra
x1
x2
xn
Sukree Sinthupinyo, December 12, 2006 Logic Elements - p. 17/44
NOR Gate
x1
x2
xn
Sukree Sinthupinyo, December 12, 2006 Logic Elements - p. 18/44
EXCLUSIVE-OR Gate
Switches ■ XOR
Logic Gates
● A General Definition
zXOR (x1 , x2 , . . . , xn ) = x1 ⊕ x2 ⊕ · · · ⊕ xn
● Single-Input Gates
● Single-Input Gates
● Single-Input Gates x1
● And Gate
● And Gate
● Or Gate
x2
● Or Gate
● NAND and NOR Gate
● NAND Gate
● NOR Gate
● EXCLUSIVE-OR Gate
xn
● XOR Gate
● XOR Gate
Gate-Level Circuits
Boolean Algebra
Logic Gates
Gate-Level Circuits
● Combinational Circuits
● Gate-level design for a full
adder
● Full adder
● Gate-level design for a full
Gate-Level Circuits
adder
● Fan-in and Fan-out
● Meeting Fan-in and Fan-out
● Meeting Fan-in and Fan-out
Boolean Algebra
f2 (sum)
Gate-Level Circuits
f1 = y1 + y2 + y3
● Combinational Circuits
● Gate-level design for a full y1 = x1 x2
adder
● Full adder
● Gate-level design for a full
y2 = x2 x3
adder
● Fan-in and Fan-out y3 = x1 x3
● Meeting Fan-in and Fan-out
● Meeting Fan-in and Fan-out
f2 = x1 ⊕ x2 ⊕ x3
Boolean Algebra
Boolean Algebra
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
Switches
Logic Gates
Gate-Level Circuits
● Combinational Circuits
● Gate-level design for a full
adder
● Full adder
● Gate-level design for a full
adder
● Fan-in and Fan-out
● Meeting Fan-in and Fan-out
● Meeting Fan-in and Fan-out
Boolean Algebra
Switches
Logic Gates
Gate-Level Circuits
● Combinational Circuits
● Gate-level design for a full
adder
● Full adder
● Gate-level design for a full
adder
● Fan-in and Fan-out
● Meeting Fan-in and Fan-out
● Meeting Fan-in and Fan-out
Boolean Algebra
1
1
1
1
Logic Gates
Gate-Level Circuits
Boolean Algebra
● Basic Operations
● Boolean Expressions
● Axioms&Theorems of
Boolean Algebra
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Informal Proofs
● Formal Proofs
● Well-Formed Expression
● Fully Parenthesized WF:
FPWF
● Axioms&Theorems of
Boolean algebra
Switches
■ 0̄ = 1 and 1̄ = 0
Logic Gates
■ 0 · 0 = 0, 0 · 1 = 0, 1 · 0 = 0, 1 · 1 = 1
Gate-Level Circuits
Boolean Algebra
■ 0 + 0 = 0, 0 + 1 = 1, 1 + 0 = 1, 1 + 1 = 1
● Basic Operations
● Boolean Expressions
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Informal Proofs
● Formal Proofs
● Well-Formed Expression
● Fully Parenthesized WF:
FPWF
● Axioms&Theorems of
Boolean algebra
Switches ■ Identity
Logic Gates
Gate-Level Circuits
X +0=X
Boolean Algebra
● Basic Operations
X ·1=X
● Boolean Expressions
● Axioms&Theorems
Boolean algebra
of ■ Null
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of X +1=1
Boolean algebra
● Axioms&Theorems
Boolean algebra
of
X ·0=0
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of ■ Idempotency
Boolean algebra
● Axioms&Theorems of
Boolean algebra X +X =X
● Informal Proofs
● Formal Proofs
● Well-Formed Expression
X ·X =X
● Fully Parenthesized WF:
FPWF
● Axioms&Theorems of
Boolean algebra
Boolean Algebra
● Basic Operations
(X ′ )′ = X
● Boolean Expressions
● Axioms&Theorems
Boolean algebra
of
■ Complementariy
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of X + X̄ = 1
Boolean algebra
● Axioms&Theorems of
Boolean algebra X · X̄ = 0
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems
Boolean algebra
of ■ Commutativity
● Axioms&Theorems of
Boolean algebra
● Informal Proofs X +Y =Y +X
● Formal Proofs
● Well-Formed Expression X ·Y =Y ·X
● Fully Parenthesized WF:
FPWF
● Axioms&Theorems of
Boolean algebra
Switches ■ Associativity
Logic Gates
Gate-Level Circuits
(X + Y ) + Z = X + (Y + Z)
Boolean Algebra
● Basic Operations
(X · Y ) · Z = X · (Y · Z)
● Boolean Expressions
● Axioms&Theorems
Boolean algebra
of
■ Distributivity
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of X · (Y + Z) = (X · Y ) + (X · Z)
Boolean algebra
● Axioms&Theorems
Boolean algebra
of
X + (Y · Z) = (X + Y ) · (X + Z)
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Informal Proofs
● Formal Proofs
● Well-Formed Expression
● Fully Parenthesized WF:
FPWF
● Axioms&Theorems of
Boolean algebra
Switches ■ Uniting
Logic Gates
Gate-Level Circuits
(X · Y ) + (X · Y ′ ) = X · (Y + Y ′ )
Boolean Algebra
● Basic Operations
=X ·1
● Boolean Expressions
● Axioms&Theorems of =X
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems
Boolean algebra
of
(X + Y ) · (X + Y ′ ) = X + (Y · Y ′ )
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
=X +0
Boolean algebra
● Axioms&Theorems of =X
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Informal Proofs
● Formal Proofs
● Well-Formed Expression
● Fully Parenthesized WF:
FPWF
● Axioms&Theorems of
Boolean algebra
Switches ■ Absorption
Logic Gates
Gate-Level Circuits
X +X ·Y =X
Boolean Algebra
● Basic Operations
X · (X + Y ) = X
● Boolean Expressions
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems
Boolean algebra
of
(X + Y ′ ) · Y = X · Y
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
(X · Y ′ ) + Y = X + Y
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Informal Proofs
● Formal Proofs
● Well-Formed Expression
● Fully Parenthesized WF:
FPWF
● Axioms&Theorems of
Boolean algebra
Switches ■ Factoring
Logic Gates
Gate-Level Circuits
(X + Y ) · (X ′ + Z) = X · Z + X ′ · Y
Boolean Algebra
● Basic Operations
X · Y + X ′ · Z = (X + Z) · (X ′ + Y )
● Boolean Expressions
● Axioms&Theorems
Boolean algebra
of
■ Concensus
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of X · Y + Y · Z + X′ · Z = X · Y + X′ · Z
Boolean algebra
● Axioms&Theorems
Boolean algebra
of
(X + Y ) · (Y + Z) · (X ′ + Z) = (X + Y ) · (X ′ + Z)
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Informal Proofs
● Formal Proofs
● Well-Formed Expression
● Fully Parenthesized WF:
FPWF
● Axioms&Theorems of
Boolean algebra
Switches ■ de Morgan’s
Logic Gates
Gate-Level Circuits
(X + Y + . . . )′ = (X ′ · Y ′ . . . )
Boolean Algebra
● Basic Operations
(X · Y · . . . )′ = (X ′ + Y ′ + . . . )
● Boolean Expressions
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Informal Proofs
● Formal Proofs
● Well-Formed Expression
● Fully Parenthesized WF:
FPWF
● Axioms&Theorems of
Boolean algebra
Switches ■ A+A=A
Logic Gates
Gate-Level Circuits
A+A=A
Boolean Algebra
● Basic Operations
(A + A) · 1 = A
● Boolean Expressions
● Axioms&Theorems of (A + A) · (A + A′ ) = A
Boolean algebra
● Axioms&Theorems
Boolean algebra
of
A · A + A · A′ + A · A + A · A′ = A
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
A+0+A+0=A
Boolean algebra
● Axioms&Theorems of A+0=A
Boolean algebra
● Axioms&Theorems of
Boolean algebra A=A
● Axioms&Theorems of
Boolean algebra
● Informal Proofs
● Formal Proofs
● Well-Formed Expression
● Fully Parenthesized WF:
FPWF
● Axioms&Theorems of
Boolean algebra
Boolean Algebra
● Basic Operations
● Boolean Expressions
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Informal Proofs
● Formal Proofs
● Well-Formed Expression
● Fully Parenthesized WF:
FPWF
● Axioms&Theorems of
Boolean algebra
Switches ■ Duality
Logic Gates ◆ Dual of a Boolean expression is derived by replacing · by
Gate-Level Circuits +, + by ·, 0 by 1, and 1 by 0, and leaving variables
Boolean Algebra
● Basic Operations
unchanged
● Boolean Expressions ◆ Any theorem that can be proven is thus also proven for its
● Axioms&Theorems of
Boolean algebra dual!
● Axioms&Theorems of
Boolean algebra ◆ Meta-theorem (a theorem about theorems)
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Axioms&Theorems of
Boolean algebra
● Informal Proofs
● Formal Proofs
● Well-Formed Expression
● Fully Parenthesized WF:
FPWF
● Axioms&Theorems of
Boolean algebra