T2 Basic Logic Gates
T2 Basic Logic Gates
1
Electronic Switch – Transistors
control
input
• Transistors are the basis of binary
digital circuits “off”
pMOS
1 0
gate
(a) IC
IC
4
AND Logic
0
X Y Z = XY
x y
0 0 0
Z
y
0 1 0
1 0 0
x
1 1 1
1
Truth Table
• Definition of AND operation
Z=X•Y means Z = 1 if and only if both X = 1 and Y = 1;
I1 I1 I2 I3 O1 O2
O1
Digital 0 0 0 ? ?
Inputs I2 Outputs
Circuit 0 0 1 ? ?
O2
I3 0 1 0 ? ?
0 1 1 ? ?
Number of
combinations is 2N; 1 0 0 ? ?
N is the number of 1 0 1 ? ?
the inputs
1 1 0 ? ?
1 1 1 ? ?
6
Example of Truth Table
a b F a b c F a b c d F
0 0 0 0 0 0 0 0 0
0 1 0 0 1 0 0 0 1
1 0 0 1 0 0 0 1 0
1 1 0 1 1 0 0 1 1
1 0 0 0 1 0 0
(a)
1 0 1 0 1 0 1
1 1 0 0 1 1 0
1 1 1 0 1 1 1
1 0 0 0
(b) 1 0 0 1
1 0 1 0
1 0 1 1
1 1 0 0
1 1 0 1
1 1 1 0
1 1 1 1
(c)
7
OR Logic
0
X Y Z=X+Y
y
0 0 0
x 0 1 1
Z
1 0 1
x y
1 1 1
1 Truth Table
• Definition of OR operation
Z = X + Y means Z = 1 if either X=1 or Y=1, or both;
OR operator
2-input OR gate
8
NOT Logic
1
X Z = X’
0 1
x Z
1 0
0 Truth Table
• Definition of NOT operation
Z = X’ or Z = X means Z = 0 if X = 1; Z = 1 if X = 0; Z is the complement of X
NOT operator
NOT gate/Inverter
9
Logic Gates
• Motion-in-dark example
– a: signal from motion sensor, b: signal from light sensor
– Human/programming language: Turn on lamp (F=1) if
motion sensed (a) and no light (not b)
– Logic Equation: F = a AND NOT(b) = ab’
– Logic circuit: implementation of equation using logic gates
11
Example: Seat Belt Warning Light System
• Design circuit for warning
light
• Sensors
– s: seat belt fastened
– k: key inserted
– p: person in seat k Seat Belt Indicator
• Function description p w
b
a
Class
F b
a
F
c
Derivation c
13
From Logic Equation to Logic Circuit
• Logic Circuit:
A net of logic gates.
14
Logic Equation and Logic Circuit
F = x + y’z
output expression
of inputs
x
y’
y
Class y’z F = x + y’z
z
Derivation
15
Build Truth Table
• F = x + y’z
x 0 F = 0 + 0’• 0
y
0 y’=1 Class
y’z=0 F=0 or =0+1•0
=0+0
z 0
Derivation =0
x y z G
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 0
1 1 1 0
25
Timing Diagram: Another Representations of
I/O Relationship
• Timing diagram of one signal shows the response to
changes on a signal in voltage levels with time
X 0 1 1 0 0
26
Timing Diagrams for Gates
xy F
0 0 0
X 0 1 1 0 0
0 1 0
1 0 0
1 1 1 Y 0 0 1 1 0
x+y F Class
0 0
0 1
0
1
X•Y Derivation
0 0 1 0 0
1 0 1
X+Y 0 1 1 1 0
1 1 1
x F
0 1 X’ 1 0 0 1 1
1 0
27
More Gates
1 1
NAND NOR XOR XNOR NAND NOR
x x x
F F x y
y y
F y
x y F x y F x y F x y F x F
0 0 1 0 0 1 0 0 0 0 0 1
0 1 1 0 1 0 0 1 1 0 1 0 x y
y
1 0 1 1 0 0 1 0 1 1 0 0
1 1 0 1 1 0 1 1 0 1 1 1 0 0
• NAND: Opposite of AND (“NOT AND”) • AND in CMOS: NAND with NOT
• NOR: Opposite of OR (“NOT OR”)
• OR in CMOS: NOR with NOT
• XOR (): outputs 1 when inputs have odd
number of 1’s • So NAND/NOR more common
• XNOR: Opposite of XOR (“NOT XOR”)
28
Recall Overflow Detection Method 2
• Simpler method: Detect difference between carry-in to sign bit and carry-
out from sign bit
• overflow = c4 c3 (overflow = 1, if c4 ≠ c3)
0 1 1 1 1 0 0 0 0 0 0 0
0 1 1 1 1 1 1 1 1 0 0 0
+ 0 0 0 1 + 1 0 0 0 + 0 1 1 1
1 0 0 0 0 1 1 1 1 1 1 1
overflow overflow no overflow
(a) (b) (c)
29
Gates with Multiple Inputs
• AND and OR gates may have more than two inputs
• Three-input AND gate responds with logic 1 output if and only if all
three inputs are logic 1 (may be generalized)
• Four-input OR gate responds with logic 1 if any input is logic 1; its
output becomes 0 if and only if all inputs are logic 0 (may be
generalized)
A
A
B
B F = ABC Z = A+B+C+D
C
C C
30
Some Circuit Drawing Conventions
no yes
x
F
y
no yes
ok
not ok
31
Integrated Circuit
• Integrated Circuit (IC) – chip
– Contains logic components and/or devices for constructing digital circuits
• Integration Levels
– Small-Scale Integration (SSI)
• Fewer than 10 gates
– Medium-Scale Integration (MSI)
• 10 to 1000 gates
– Large-Scale Integration (LSI)
• Thousands of gates
– Very Large-Scale Integration (VLSI)
• Millions of gates
– Ultra Large-Scale Integration (ULSI)
• Billions of gates
– … https://www.sparkpi.co.uk/evolution-of-the-integrated-
circuit-board-infographic-2/
32
Integrated Circuit
33