Download - Chap 3
![Page 1: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/1.jpg)
1
Lecture No. 3
Computer Logic Design
Logic Gates
![Page 2: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/2.jpg)
2
Logic Gates• Logic Gates
– Basic building blocks of the digital circuits– Control flow of information– Represent Logical Operations (Functions)
• Fundamental Gates• AND, OR, NOT
• Characteristics• Operation of the gate (what it does)• Function/truth table• Timing diagram• Application example
![Page 3: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/3.jpg)
3
AND Gate
• AND Gate– Standard logical symbol (ANSI/IEEE Standard 91-1984)
– Where F is the output and A,B,C……,N are the inputs of the gate
– Performs logical multiplication– The output is HIGH only when all the inputs are HIGH
NCBAF ....
BAF
![Page 4: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/4.jpg)
4
AND Gate
• The logical operation of a gate can be expressed with a table that lists all input combinations with the corresponding outputs, known as truth table
• Truth table for a two input AND gate
Input Output
A B F
0 0 0
0 1 0
1 0 0
1 1 1
![Page 5: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/5.jpg)
5
AND Gate• Timing Diagram - a graph that accurately displays the relationship of two or
more waveforms with respect to each other on a time basis
– Graphical representation of AND gate operation
t0 t4 t5 t6t1 t2 t3
A
B
F
![Page 6: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/6.jpg)
6
AND Gate
• Application example of AND gate– Device (Stop-watch) enable/disable switch
– When the input B is set to HIGH (enabled), the clock signal is applied to the counter
U/D
Reset
B1
B8
Carry out
ENB
Counter
A
B
Clock Pulses
EnableDisable
![Page 7: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/7.jpg)
7
OR Gate
• Standard logical symbol
• Performs Boolean Addition• The output is HIGH when one or more inputs are
HIGH
BAF
NCBAF ..
![Page 8: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/8.jpg)
8
OR Gate
• Truth table for a two input OR gate
Input Output
A B F
0 0 0
0 1 1
1 0 1
1 1 1
![Page 9: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/9.jpg)
9
OR Gate
• Timing diagram of the OR-Gate
t0 t4 t5 t6t1 t2 t3
A
B
F
![Page 10: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/10.jpg)
10
OR Gate
• OR gate application example– Car door alarm system
– When all the doors are closed, 0000 is applied to the input of the OR gate
– When one or more doors are open, the output of OR gate is 1, which activates the alarm
Alarm
Front left door
Rear left door
Front right door
Rear right door
![Page 11: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/11.jpg)
11
NOT Gate
• The standard logical symbol
• Performs the inversion or complementation• Changes one logic level to the opposite logic level• The bubble shows the negation
AF
![Page 12: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/12.jpg)
12
NOT Gate
• Truth table for a NOT Gate
Input Output
A F
0 1
1 0
![Page 13: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/13.jpg)
13
NOT Gate
• Timing diagram of NOT-Gate
t0 t4 t5 t6t1 t2 t3
A
F
![Page 14: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/14.jpg)
14
NOT Gate
• NOT gate application example– 1’s complement
1 1 1 1
1 1 1 1
0 0
0 0
0
0 0
0
![Page 15: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/15.jpg)
15
NAND Gate
• Contraction of NOT-AND
• Standard logic symbol
• Output is LOW only when all inputs are HIGH
• Bubble indicates ACTIVE LOW output
• Output level is opposite to that of the AND gate
BAF
NCBAF ....
BAF
NCBAF ....
E
![Page 16: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/16.jpg)
16
NAND Gate
• The truth table for a two input NAND gate
InputMiddle Output Output
A B E F
0 0 0 1
0 1 0 1
1 0 0 1
1 1 1 0
![Page 17: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/17.jpg)
17
NAND Gate
• Timing diagram of NAND gate
t0 t4 t5 t6t1 t2 t3
A
B
F
![Page 18: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/18.jpg)
18
NAND Gate
• NAND gate application example– Device Failure Alarm System
– When all the fans are working, the input to the NAND gate is 111 and the output is 0
– If any one of the fan stops working, the output of the NAND gate becomes 1, which activates the alarm
ALARM
![Page 19: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/19.jpg)
19
NAND Gate as Negative-OR
• The truth table for a two input NAND gate looks awfully similar to an OR gate with the inputs inverted.
Input NAND Output
A B F
0 0 1
0 1 1
1 0 1
1 1 0
Input OR Output
A B F
1 1 1
1 0 1
0 1 1
0 0 0
![Page 20: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/20.jpg)
20
NAND Gate as Negative-OR
Bubble signifies ACTIVE LOW INPUT
![Page 21: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/21.jpg)
21
NAND Gate as a Universal Gate
• NAND gate can be used to perform all the fundamental gate operations (NOT, AND, OR)– Universal NAND gate
![Page 22: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/22.jpg)
22
NAND as NOT Gate
Input Output
A B F
0 0 1
0 1 1
1 0 1
1 1 0
Join all the input pins of the NAND gate together
![Page 23: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/23.jpg)
23
NAND as AND Gate
• Using NAND gate to perform the AND gate operation
• Remember NAND is NOT-AND. What if we inverse this one more level? NOT-(NOT-AND) = AND
• Accomplished by applying a NOT operation (implemented through NAND gate) to the output of the NAND gate
1 2
![Page 24: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/24.jpg)
24
NAND as OR Gate
• Using NAND gate to perform the OR gate operation
– Can we form NOR gate as well?
![Page 25: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/25.jpg)
25
NOR Gate
• Contraction of NOT-OR• The standard logic symbol
• Produces a LOW output when one or more of its input is HIGH
• Bubble indicates ACTIVE LOW output• The output logic is opposite to that of the OR gate
BAF
NCBAF ....
![Page 26: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/26.jpg)
26
NOR Gate
• Truth table for a two input NOR gate
Input Output
A B F
0 0 1
0 1 0
1 0 0
1 1 0
![Page 27: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/27.jpg)
27
NOR Gate
• Timing diagram of a NOR gate
t0 t4 t5 t6t1 t2 t3
![Page 28: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/28.jpg)
28
NOR Gate
• Application as Washing Machine Controller
– If the machine lid is open or the water in the tub is below certain level or the machine is overloaded (weight of water and clothes in the tub is above certain limit), the output of corresponding sensor is set to 1, producing a 0 at the NOR gate output that switches the machine off
Switch
![Page 29: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/29.jpg)
29
NOR Gate as Negative-AND
• The truth table for a two input NOR gate looks awfully similar to an AND gate with the inputs inverted.
Input NOR Output
A B F
0 0 1
0 1 0
1 0 0
1 1 0
Input AND Output
A B F
1 1 1
1 0 0
0 1 0
0 0 0
![Page 30: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/30.jpg)
30
NOR Gate as Negative-AND
Bubble signifies ACTIVE LOW INPUT
![Page 31: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/31.jpg)
31
NOR Gate as a Universal Gate
• NOR gate can be used to perform all the fundamental gate operations (NOT, AND, OR)– Universal NOR gate
![Page 32: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/32.jpg)
32
NOR as NOT Gate
Input Output
A B F
0 0 1
0 1 0
1 0 0
1 1 0
Join all the input pins of the NOR gate together
![Page 33: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/33.jpg)
33
NOR as OR Gate
• Using NOR gate to perform the OR gate operation• Remember NOR is NOT-OR. What if we inverse
this one more level? NOT-(NOT-OR) = OR
• Accomplished by applying a NOT operation (implemented through NOR gate) to the output of the NOR gate
![Page 34: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/34.jpg)
34
NOR as AND Gate
• Using NOR gate to perform the AND gate operation
– Can we form NAND gate as well?
![Page 35: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/35.jpg)
35
Review• The output of a logic gate is used to activate an
alarm whenever at least one of its inputs is LOW. Name the gate?
• Name the following gate?
• Name the following gate?
t0 t4 t5 t6t1 t2 t3
![Page 36: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/36.jpg)
36
XOR Gate• Exclusive OR (XOR for short)
– Standard logic symbol
– This gate has only two inputs
– Logical expression
– The output is HIGH only when the two the inputs are at opposite logic level
BAF
![Page 37: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/37.jpg)
37
XOR Gate
• The truth table for XOR Gate
Input Output
A B F
0 0 0
0 1 1
1 0 1
1 1 0
![Page 38: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/38.jpg)
38
XOR Gate
• Timing diagram of XOR gate
t0 t4 t5 t6t1 t2 t3
![Page 39: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/39.jpg)
39
XOR Gate
• Application example of XOR gate– Detecting odd parity
– Applying 0011 at the input A, B, C and D respectively generates 0 at the output of XOR gate 1, XOR gate 2 and XOR gate 3, indicating that number of 1s are not odd
– Applying 1011at the input generates a 1 at the output of XOR gate 3 indicating odd number of 1s
1
2
3
A
B
C
D
![Page 40: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/40.jpg)
40
XNOR Gate
• Exclusive-NOR (XNOR for short)– Standard logic symbol
This gate has only two inputs– Logical expression
– The output is LOW only when the two inputs are at opposite logic level
BAF
![Page 41: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/41.jpg)
41
XNOR Gate
• Truth table for XNOR gate
Input Output
A B F
0 0 1
0 1 0
1 0 0
1 1 1
![Page 42: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/42.jpg)
42
XNOR Gate
• Timing diagram of XNOR gate
t0 t4 t5 t6t1 t2 t3
![Page 43: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/43.jpg)
43
XNOR Gate
• Application example of XNOR gate– Detecting even parity
– Applying 1011 at the input A, B, C and D respectively generates 1 at the output of XOR gate 1, a 0 at the output of XOR gate 2 and a 0 at the output of XNOR gate 3, indicating that the number of 1s in the input sequence are not even
– Applying 0011 generates 1 at the XNOR gate output, indicating even number of 1s
1
2
3
A
B
C
D
![Page 44: Chap 3](https://reader035.vdocuments.net/reader035/viewer/2022062513/555b665ad8b42a66338b5016/html5/thumbnails/44.jpg)
44
Summary of logic gates• Fundamental logic gates
– AND– OR– NOT
• Universal gates– NAND– NOR
• Other gates– XOR– XNOR
• Standard logic symbol• Logical/Boolean expression• Truth table• Application example