Professional Documents
Culture Documents
DLD Week4 Chap3 2D
DLD Week4 Chap3 2D
DLD Week4 Chap3 2D
CS-1101
WEEK 4 - LOGIC GATES
Lecture 10,11,12
What are logic gates?
• Logic gates turn ON when a certain condition is true, and OFF when the
condition is false
• They check whether or not the information they get follows a certain rule
• They either spit out the answer true (ON) or false (OFF)
• Remember:
– True= ON = 1
– False = OFF=0
Example
0 1 1 1 0 0 1 0
1’s complement
The AND Gate
The AND gate produces a HIGH output when all inputs are
HIGH; otherwise, the output is LOW. For a 2-input gate,
the truth table is A X
B
0 0 0
0 1 0 A
X
1 0 0 B
1 1 1
12
The OR Gate
The OR gate produces a HIGH output if any input is HIGH;
if all inputs are LOW, the output is LOW. For a 2-input gate,
the truth table is A X
B
0 0 0
0 1 1 A X
1 0 1 B
1 1 1
X
The NAND gate is particularly useful because it is a
“universal” gate – all other basic gates can be constructed
from NAND gates.
How would you connect a 2-input NAND gate
to form a basic inverter?
The NAND Gate
The NOR Gate
The NOR gate produces a LOW output if any input is
HIGH; if all inputs are HIGH, the output is LOW. For a
2-input gate, the truth table is
A X
B
0 0 1 A X
0 1 0 B
1 0 0
1 1 0
A X
B
0 0 1
0 1 0 A X
1 0 0 B
1 1 1