SlideShare a Scribd company logo
1 of 36
Logic Gates
Transistors as Switches
 VBB voltage controls whether the transistor
conducts in a common base configuration.
 Logic circuits can be built
AND
 In order for current to flow, both switches
must be closed
¤ Logic notation AB = C
(Sometimes AB = C)
A B C
0 0 0
0 1 0
1 0 0
1 1 1
OR
 Current flows if either switch is closed
¤ Logic notation A + B = C
A B C
0 0 0
0 1 1
1 0 1
1 1 1
Properties of AND and OR
 Commutation
¤ A + B = B + A
¤ A  B = B  A
Same as
Same as
Properties of AND and OR
 Associative Property
¤ A + (B + C) = (A + B) + C
¤ A  (B  C) = (A  B)  C
=
Properties of AND and OR
 Distributive Property
¤ A + B  C = (A + B)  (A + C)
¤ A + B  C
A B C Q
0 0 0 0
0 0 1 0
0 1 0 0
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1
Distributive Property
 (A + B)  (A + C)
A B C Q
0 0 0 0
0 0 1 0
0 1 0 0
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1
Binary Addition
A B S C(arry)
0 0 0 0
1 0 1 0
0 1 1 0
1 1 0 1
Notice that the carry results are the same as AND
C = A  B
Inversion (NOT)
A Q
0 1
1 0
Logic: AQ =
Exclusive OR (XOR)
Either A or B, but not both
This is sometimes called the
inequality detector, because the
result will be 0 when the inputs are the
same and 1 when they are different.
The truth table is the same as for
S on Binary Addition. S = A ⊕ B
A B S
0 0 0
1 0 1
0 1 1
1 1 0
Getting the XOR
A B S
0 0 0
1 0 1
0 1 1
1 1 0
Two ways of getting S = 1
BAorBA ⋅⋅
Circuit for XOR
Accumulating our results: Binary addition is the
result of XOR plus AND
BABABA ⋅+⋅=⊕
Half Adder
Called a half adder because we haven’t allowed for any carry bit
on input. In elementary addition of numbers, we always need to
allow for a carry from one column to the next.
18
25
4
3 (plus a carry)
Full Adder
INPUTS OUTPUTS
A B CIN
COUT S
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
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
Full Adder Circuit
Chaining the Full Adder
Possible to use the same
scheme for subtraction by
noting that
A – B = A + (-B)
Binary Counting
Use 1 for ON
Use 0 for OFF
= 00101011
Binary Counter
So our example has 25
+ 23
+ 21
+ 20
= 32 + 8 + 2 + 1 = 43
Counting in Binary
1 1 11 1011 21 10101
2 10 12 1100 22 10110
3 11 13 1101 23 10111
4 100 14 1110 24 11000
5 101 15 1111 25 11001
6 110 16 10000 26 11010
7 111 17 10001 27 11011
8 1000 18 10010 28 11100
9 1001 19 10011 29 11101
10 1010 20 10100 30 11110
NAND (NOT AND)
A B Q
0 0 1
0 1 1
1 0 1
1 1 0
BAQ ⋅=
NOR (NOT OR)
A B Q
0 0 1
0 1 0
1 0 0
1 1 0
BAQ +=
Exclusive NOR
A B Q
0 0 1
0 1 0
1 0 0
1 1 1
Equality Detector
BAQ ⊕=
Summary
Summary for all 2-input gates
Inputs Output of each gate
A B AND NAND OR NOR XOR XNOR
0 0 0 1 0 1 0 1
0 1 0 1 1 0 1 0
1 0 0 1 1 0 1 0
1 1 1 0 1 0 0 1
Number Systems
 Decimal (base 10) {0 1 2 3 4 5 6 7 8 9}
¤ Place value gives a logarithmic representation
of the number
¤ Ex. 4378 means
۞ 4 X 103
= 4000
۞ 3 X 102
= 300
۞ 7 X 101
= 70
۞ 8 X 100
= 8
¤ The place also gives the exponent of the base
Example
 432,600
4 3 2 6 0 0
105
104
103
100
101
102
Powers of ten:
100
= 1 102
= 100 104
= 10000
101
= 10 103
= 1000 105
= 100000
Binary (base 2) {0 1}
Binary Decimal
0 0
1 1
10 2
11 3
100 4
101 5
110 6
111 7
1000 8
1001 9
1010 10
Example
1 1 0 1 1 0 0 1
27
26
25
20
21
22
24 23
Decimal Equivalent
 1101 1001
1 X 27
= 128
+ 1 X 26
= 64
+ 0 X 25
= 0
+ 1 X 24
= 16
+ 1 X 23
= 8
+ 0 X 22
= 0
+ 0 X 21
= 0
+ 1 X 20
= 1
217
Notice how powers of two
stand out:
20
= 1
21
= 10
22
= 100
23
= 1000
Decimal to Binary Conversion
 Ex. 575
¤ Find the largest power of two less than the number
۞ 29
= 512
¤ Subtract that power of two from the number
۞ 575 – 512 = 63
¤ Repeat steps 1 and 2 for the new result until you reach zero.
۞ 25
= 32 63 – 32 = 31
۞ 24
= 16 31 – 16 = 15
۞ 23
= 8 15 – 8 = 7
۞ 22
= 4 7 – 4 = 3
۞ 21
= 2 3 – 2 = 1
۞ 20
= 1 1 – 1 = 0
¤ Construct the number
۞ 1000111111
Another Example
 144
¤ 27
= 128 144 – 128 = 16
¤ 24
= 16 16 – 16 = 0
 Result 10010000
Hexadecimal (base 16)
 {0 1 2 3 4 5 6 7 8 9 A B C D E F}
 Assignments Dec Hex Dec Hex
0 0 8 8
1 1 9 9
2 2 10 A
3 3 11 B
4 4 12 C
5 5 13 D
6 6 14 E
7 7 15 F
Example
163
162
160
161
3 B 6 E
3 X 163
= 12288
11 X 162
= 2816
6 X 161
= 96
14 X 160
= 14
⇒ 15214
Hexadecimal is Convenient for
Binary Conversion
Binary Hex Binary Hex
0 0 1001 29
1 1 1010 A
10 2 1011 B
11 3 1100 C
100 4 1101 D
101 5 1110 E
110 6 1111 F
111 7 1 0000 10
1000 8 ⇐ Nibble
Binary to Hex Conversion
 Group binary number by fours (nibbles)
¤ 1101 1001 0110
 Convert each nibble into hex equivalent
¤ 1101 1001 0110
D 9 6
Decimal to Hex Conversion
 Ex. 284
¤ 162
= 256 284 – 256 = 28
¤ 161
= 16 28 - 16 = 12 (Hex C)
¤ Result 1 1 C
Another Example with an Extension
 1054
¤ 162
= 256
۞But we have several multiples of 256 in 1054
– 1054/256 = 4.12 take integer part
– This eliminates 4*256 = 1024
۞ 1054 – 1024 = 30
¤ 161
= 16 30 – 16 = 14 (Hex E)
¤ Result 4 1 E

More Related Content

What's hot

Sequential Circuits - Flip Flops (Part 2)
Sequential Circuits - Flip Flops (Part 2)Sequential Circuits - Flip Flops (Part 2)
Sequential Circuits - Flip Flops (Part 2)
Abhilash Nair
 

What's hot (20)

Parity Generator and Parity Checker
Parity Generator and Parity CheckerParity Generator and Parity Checker
Parity Generator and Parity Checker
 
Logic gates - AND, OR, NOT, NOR, NAND, XOR, XNOR Gates.
Logic gates - AND, OR, NOT, NOR, NAND, XOR, XNOR Gates.Logic gates - AND, OR, NOT, NOR, NAND, XOR, XNOR Gates.
Logic gates - AND, OR, NOT, NOR, NAND, XOR, XNOR Gates.
 
BOOLEAN ALGEBRA & LOGIC GATE
BOOLEAN ALGEBRA & LOGIC GATEBOOLEAN ALGEBRA & LOGIC GATE
BOOLEAN ALGEBRA & LOGIC GATE
 
Sequential circuits in Digital Electronics
Sequential circuits in Digital ElectronicsSequential circuits in Digital Electronics
Sequential circuits in Digital Electronics
 
Synchronous Counter
Synchronous Counter Synchronous Counter
Synchronous Counter
 
Registers
RegistersRegisters
Registers
 
Parallel adder
Parallel adderParallel adder
Parallel adder
 
Logic families
Logic  familiesLogic  families
Logic families
 
Sequential Logic Circuit
Sequential Logic CircuitSequential Logic Circuit
Sequential Logic Circuit
 
Latches and flip flops
Latches and flip flopsLatches and flip flops
Latches and flip flops
 
Sequential Circuits - Flip Flops (Part 2)
Sequential Circuits - Flip Flops (Part 2)Sequential Circuits - Flip Flops (Part 2)
Sequential Circuits - Flip Flops (Part 2)
 
Encoders
EncodersEncoders
Encoders
 
Logic gates
Logic gatesLogic gates
Logic gates
 
Microcontroller 8051 and its interfacing
Microcontroller 8051 and its interfacingMicrocontroller 8051 and its interfacing
Microcontroller 8051 and its interfacing
 
8086 micro processor
8086 micro processor8086 micro processor
8086 micro processor
 
Chapter 6 register
Chapter 6 registerChapter 6 register
Chapter 6 register
 
carry look ahead adder
carry look ahead addercarry look ahead adder
carry look ahead adder
 
Combinational Circuits & Sequential Circuits
Combinational Circuits & Sequential CircuitsCombinational Circuits & Sequential Circuits
Combinational Circuits & Sequential Circuits
 
Registers-shift register
Registers-shift registerRegisters-shift register
Registers-shift register
 
Flag register 8086 assignment
Flag register 8086 assignmentFlag register 8086 assignment
Flag register 8086 assignment
 

Similar to Logic gates

01.number systems
01.number systems01.number systems
01.number systems
rasha3
 

Similar to Logic gates (20)

Arithmatic &Logic Unit
Arithmatic &Logic UnitArithmatic &Logic Unit
Arithmatic &Logic Unit
 
Week 5 - Number Systems.pdf
Week 5 - Number Systems.pdfWeek 5 - Number Systems.pdf
Week 5 - Number Systems.pdf
 
Logic Gates (1).ppt
Logic Gates (1).pptLogic Gates (1).ppt
Logic Gates (1).ppt
 
Modern+digital+electronics rp+jain
Modern+digital+electronics rp+jainModern+digital+electronics rp+jain
Modern+digital+electronics rp+jain
 
Logic gates (2)
Logic gates (2)Logic gates (2)
Logic gates (2)
 
3,EEng k-map.pdf
3,EEng k-map.pdf3,EEng k-map.pdf
3,EEng k-map.pdf
 
Digital-Logic40124sequential circuits logic gatepptx
Digital-Logic40124sequential circuits logic gatepptxDigital-Logic40124sequential circuits logic gatepptx
Digital-Logic40124sequential circuits logic gatepptx
 
Digital logic
Digital logicDigital logic
Digital logic
 
UNIT-1_CSA.pdf
UNIT-1_CSA.pdfUNIT-1_CSA.pdf
UNIT-1_CSA.pdf
 
9402730.ppt
9402730.ppt9402730.ppt
9402730.ppt
 
Logic Gates.pptx
Logic Gates.pptxLogic Gates.pptx
Logic Gates.pptx
 
Lecture 18 M - Copy.pptx
Lecture 18 M - Copy.pptxLecture 18 M - Copy.pptx
Lecture 18 M - Copy.pptx
 
CMSC 56 | Lecture 10: Integer Representations & Algorithms
CMSC 56 | Lecture 10: Integer Representations & AlgorithmsCMSC 56 | Lecture 10: Integer Representations & Algorithms
CMSC 56 | Lecture 10: Integer Representations & Algorithms
 
Minimizing boolean
Minimizing booleanMinimizing boolean
Minimizing boolean
 
Minimizing boolean
Minimizing booleanMinimizing boolean
Minimizing boolean
 
1سلمي 2
1سلمي 21سلمي 2
1سلمي 2
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
01.number systems
01.number systems01.number systems
01.number systems
 
Name dld preparation
Name dld preparationName dld preparation
Name dld preparation
 
Chapter 2 Boolean Algebra (part 2)
Chapter 2 Boolean Algebra (part 2)Chapter 2 Boolean Algebra (part 2)
Chapter 2 Boolean Algebra (part 2)
 

Recently uploaded

FULL NIGHT — 9999894380 Call Girls In Mahipalpur | Delhi
FULL NIGHT — 9999894380 Call Girls In Mahipalpur | DelhiFULL NIGHT — 9999894380 Call Girls In Mahipalpur | Delhi
FULL NIGHT — 9999894380 Call Girls In Mahipalpur | Delhi
SaketCallGirlsCallUs
 
Authentic # 00971556872006 # Hot Call Girls Service in Dubai By International...
Authentic # 00971556872006 # Hot Call Girls Service in Dubai By International...Authentic # 00971556872006 # Hot Call Girls Service in Dubai By International...
Authentic # 00971556872006 # Hot Call Girls Service in Dubai By International...
home
 
Dubai Call Girls Service # +971588046679 # Call Girls Service In Dubai # (UAE)
Dubai Call Girls Service # +971588046679 # Call Girls Service In Dubai # (UAE)Dubai Call Girls Service # +971588046679 # Call Girls Service In Dubai # (UAE)
Dubai Call Girls Service # +971588046679 # Call Girls Service In Dubai # (UAE)
Business Bay Call Girls || 0529877582 || Call Girls Service in Business Bay Dubai
 
FULL NIGHT — 9999894380 Call Girls In Patel Nagar | Delhi
FULL NIGHT — 9999894380 Call Girls In Patel Nagar | DelhiFULL NIGHT — 9999894380 Call Girls In Patel Nagar | Delhi
FULL NIGHT — 9999894380 Call Girls In Patel Nagar | Delhi
SaketCallGirlsCallUs
 
DELHI NCR —@9711106444 Call Girls In Majnu Ka Tilla (MT)| Delhi
DELHI NCR —@9711106444 Call Girls In Majnu Ka Tilla (MT)| DelhiDELHI NCR —@9711106444 Call Girls In Majnu Ka Tilla (MT)| Delhi
DELHI NCR —@9711106444 Call Girls In Majnu Ka Tilla (MT)| Delhi
delhimunirka444
 
Admirable # 00971529501107 # Call Girls at dubai by Dubai Call Girl
Admirable # 00971529501107 # Call Girls at dubai by Dubai Call GirlAdmirable # 00971529501107 # Call Girls at dubai by Dubai Call Girl
Admirable # 00971529501107 # Call Girls at dubai by Dubai Call Girl
home
 
FULL NIGHT — 9999894380 Call Girls In Delhi | Delhi
FULL NIGHT — 9999894380 Call Girls In Delhi | DelhiFULL NIGHT — 9999894380 Call Girls In Delhi | Delhi
FULL NIGHT — 9999894380 Call Girls In Delhi | Delhi
SaketCallGirlsCallUs
 
FULL NIGHT — 9999894380 Call Girls In Badarpur | Delhi
FULL NIGHT — 9999894380 Call Girls In Badarpur | DelhiFULL NIGHT — 9999894380 Call Girls In Badarpur | Delhi
FULL NIGHT — 9999894380 Call Girls In Badarpur | Delhi
SaketCallGirlsCallUs
 
Call Girl Service In Dubai #$# O56521286O #$# Dubai Call Girls
Call Girl Service In Dubai #$# O56521286O #$# Dubai Call GirlsCall Girl Service In Dubai #$# O56521286O #$# Dubai Call Girls
Call Girl Service In Dubai #$# O56521286O #$# Dubai Call Girls
parisharma5056
 
Dubai Call Girl Number # 0522916705 # Call Girl Number In Dubai # (UAE)
Dubai Call Girl Number # 0522916705 # Call Girl Number In Dubai # (UAE)Dubai Call Girl Number # 0522916705 # Call Girl Number In Dubai # (UAE)
Dubai Call Girl Number # 0522916705 # Call Girl Number In Dubai # (UAE)
Business Bay Call Girls || 0529877582 || Call Girls Service in Business Bay Dubai
 
Dubai Call Girls # 00971528860074 # 24/7 Call Girls In Dubai || (UAE)
Dubai Call Girls # 00971528860074 # 24/7 Call Girls In Dubai || (UAE)Dubai Call Girls # 00971528860074 # 24/7 Call Girls In Dubai || (UAE)
Dubai Call Girls # 00971528860074 # 24/7 Call Girls In Dubai || (UAE)
Business Bay Call Girls || 0529877582 || Call Girls Service in Business Bay Dubai
 
FULL NIGHT — 9999894380 Call Girls In Najafgarh | Delhi
FULL NIGHT — 9999894380 Call Girls In Najafgarh | DelhiFULL NIGHT — 9999894380 Call Girls In Najafgarh | Delhi
FULL NIGHT — 9999894380 Call Girls In Najafgarh | Delhi
SaketCallGirlsCallUs
 
FULL NIGHT — 9999894380 Call Girls In Shivaji Enclave | Delhi
FULL NIGHT — 9999894380 Call Girls In Shivaji Enclave | DelhiFULL NIGHT — 9999894380 Call Girls In Shivaji Enclave | Delhi
FULL NIGHT — 9999894380 Call Girls In Shivaji Enclave | Delhi
SaketCallGirlsCallUs
 

Recently uploaded (20)

FULL NIGHT — 9999894380 Call Girls In Mahipalpur | Delhi
FULL NIGHT — 9999894380 Call Girls In Mahipalpur | DelhiFULL NIGHT — 9999894380 Call Girls In Mahipalpur | Delhi
FULL NIGHT — 9999894380 Call Girls In Mahipalpur | Delhi
 
Authentic # 00971556872006 # Hot Call Girls Service in Dubai By International...
Authentic # 00971556872006 # Hot Call Girls Service in Dubai By International...Authentic # 00971556872006 # Hot Call Girls Service in Dubai By International...
Authentic # 00971556872006 # Hot Call Girls Service in Dubai By International...
 
Dubai Call Girls Service # +971588046679 # Call Girls Service In Dubai # (UAE)
Dubai Call Girls Service # +971588046679 # Call Girls Service In Dubai # (UAE)Dubai Call Girls Service # +971588046679 # Call Girls Service In Dubai # (UAE)
Dubai Call Girls Service # +971588046679 # Call Girls Service In Dubai # (UAE)
 
FULL NIGHT — 9999894380 Call Girls In Patel Nagar | Delhi
FULL NIGHT — 9999894380 Call Girls In Patel Nagar | DelhiFULL NIGHT — 9999894380 Call Girls In Patel Nagar | Delhi
FULL NIGHT — 9999894380 Call Girls In Patel Nagar | Delhi
 
GENUINE EscoRtS,Call Girls IN South Delhi Locanto TM''| +91-8377087607
GENUINE EscoRtS,Call Girls IN South Delhi Locanto TM''| +91-8377087607GENUINE EscoRtS,Call Girls IN South Delhi Locanto TM''| +91-8377087607
GENUINE EscoRtS,Call Girls IN South Delhi Locanto TM''| +91-8377087607
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
DELHI NCR —@9711106444 Call Girls In Majnu Ka Tilla (MT)| Delhi
DELHI NCR —@9711106444 Call Girls In Majnu Ka Tilla (MT)| DelhiDELHI NCR —@9711106444 Call Girls In Majnu Ka Tilla (MT)| Delhi
DELHI NCR —@9711106444 Call Girls In Majnu Ka Tilla (MT)| Delhi
 
(NEHA) Call Girls Mumbai Call Now 8250077686 Mumbai Escorts 24x7
(NEHA) Call Girls Mumbai Call Now 8250077686 Mumbai Escorts 24x7(NEHA) Call Girls Mumbai Call Now 8250077686 Mumbai Escorts 24x7
(NEHA) Call Girls Mumbai Call Now 8250077686 Mumbai Escorts 24x7
 
Admirable # 00971529501107 # Call Girls at dubai by Dubai Call Girl
Admirable # 00971529501107 # Call Girls at dubai by Dubai Call GirlAdmirable # 00971529501107 # Call Girls at dubai by Dubai Call Girl
Admirable # 00971529501107 # Call Girls at dubai by Dubai Call Girl
 
FULL NIGHT — 9999894380 Call Girls In Delhi | Delhi
FULL NIGHT — 9999894380 Call Girls In Delhi | DelhiFULL NIGHT — 9999894380 Call Girls In Delhi | Delhi
FULL NIGHT — 9999894380 Call Girls In Delhi | Delhi
 
FULL NIGHT — 9999894380 Call Girls In Badarpur | Delhi
FULL NIGHT — 9999894380 Call Girls In Badarpur | DelhiFULL NIGHT — 9999894380 Call Girls In Badarpur | Delhi
FULL NIGHT — 9999894380 Call Girls In Badarpur | Delhi
 
Jeremy Casson - An Architectural and Historical Journey Around Europe
Jeremy Casson - An Architectural and Historical Journey Around EuropeJeremy Casson - An Architectural and Historical Journey Around Europe
Jeremy Casson - An Architectural and Historical Journey Around Europe
 
Call Girl Service In Dubai #$# O56521286O #$# Dubai Call Girls
Call Girl Service In Dubai #$# O56521286O #$# Dubai Call GirlsCall Girl Service In Dubai #$# O56521286O #$# Dubai Call Girls
Call Girl Service In Dubai #$# O56521286O #$# Dubai Call Girls
 
❤Personal Whatsapp Srinagar Srinagar Call Girls 8617697112 💦✅.
❤Personal Whatsapp Srinagar Srinagar Call Girls 8617697112 💦✅.❤Personal Whatsapp Srinagar Srinagar Call Girls 8617697112 💦✅.
❤Personal Whatsapp Srinagar Srinagar Call Girls 8617697112 💦✅.
 
Dubai Call Girl Number # 0522916705 # Call Girl Number In Dubai # (UAE)
Dubai Call Girl Number # 0522916705 # Call Girl Number In Dubai # (UAE)Dubai Call Girl Number # 0522916705 # Call Girl Number In Dubai # (UAE)
Dubai Call Girl Number # 0522916705 # Call Girl Number In Dubai # (UAE)
 
Jeremy Casson - How Painstaking Restoration Has Revealed the Beauty of an Imp...
Jeremy Casson - How Painstaking Restoration Has Revealed the Beauty of an Imp...Jeremy Casson - How Painstaking Restoration Has Revealed the Beauty of an Imp...
Jeremy Casson - How Painstaking Restoration Has Revealed the Beauty of an Imp...
 
(INDIRA) Call Girl Dehradun Call Now 8617697112 Dehradun Escorts 24x7
(INDIRA) Call Girl Dehradun Call Now 8617697112 Dehradun Escorts 24x7(INDIRA) Call Girl Dehradun Call Now 8617697112 Dehradun Escorts 24x7
(INDIRA) Call Girl Dehradun Call Now 8617697112 Dehradun Escorts 24x7
 
Dubai Call Girls # 00971528860074 # 24/7 Call Girls In Dubai || (UAE)
Dubai Call Girls # 00971528860074 # 24/7 Call Girls In Dubai || (UAE)Dubai Call Girls # 00971528860074 # 24/7 Call Girls In Dubai || (UAE)
Dubai Call Girls # 00971528860074 # 24/7 Call Girls In Dubai || (UAE)
 
FULL NIGHT — 9999894380 Call Girls In Najafgarh | Delhi
FULL NIGHT — 9999894380 Call Girls In Najafgarh | DelhiFULL NIGHT — 9999894380 Call Girls In Najafgarh | Delhi
FULL NIGHT — 9999894380 Call Girls In Najafgarh | Delhi
 
FULL NIGHT — 9999894380 Call Girls In Shivaji Enclave | Delhi
FULL NIGHT — 9999894380 Call Girls In Shivaji Enclave | DelhiFULL NIGHT — 9999894380 Call Girls In Shivaji Enclave | Delhi
FULL NIGHT — 9999894380 Call Girls In Shivaji Enclave | Delhi
 

Logic gates

  • 2. Transistors as Switches  VBB voltage controls whether the transistor conducts in a common base configuration.  Logic circuits can be built
  • 3. AND  In order for current to flow, both switches must be closed ¤ Logic notation AB = C (Sometimes AB = C) A B C 0 0 0 0 1 0 1 0 0 1 1 1
  • 4. OR  Current flows if either switch is closed ¤ Logic notation A + B = C A B C 0 0 0 0 1 1 1 0 1 1 1 1
  • 5. Properties of AND and OR  Commutation ¤ A + B = B + A ¤ A  B = B  A Same as Same as
  • 6. Properties of AND and OR  Associative Property ¤ A + (B + C) = (A + B) + C ¤ A  (B  C) = (A  B)  C =
  • 7. Properties of AND and OR  Distributive Property ¤ A + B  C = (A + B)  (A + C) ¤ A + B  C A B C Q 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 1
  • 8. Distributive Property  (A + B)  (A + C) A B C Q 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 1
  • 9. Binary Addition A B S C(arry) 0 0 0 0 1 0 1 0 0 1 1 0 1 1 0 1 Notice that the carry results are the same as AND C = A  B
  • 10. Inversion (NOT) A Q 0 1 1 0 Logic: AQ =
  • 11. Exclusive OR (XOR) Either A or B, but not both This is sometimes called the inequality detector, because the result will be 0 when the inputs are the same and 1 when they are different. The truth table is the same as for S on Binary Addition. S = A ⊕ B A B S 0 0 0 1 0 1 0 1 1 1 1 0
  • 12. Getting the XOR A B S 0 0 0 1 0 1 0 1 1 1 1 0 Two ways of getting S = 1 BAorBA ⋅⋅
  • 13. Circuit for XOR Accumulating our results: Binary addition is the result of XOR plus AND BABABA ⋅+⋅=⊕
  • 14. Half Adder Called a half adder because we haven’t allowed for any carry bit on input. In elementary addition of numbers, we always need to allow for a carry from one column to the next. 18 25 4 3 (plus a carry)
  • 15. Full Adder INPUTS OUTPUTS A B CIN COUT S 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 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
  • 17. Chaining the Full Adder Possible to use the same scheme for subtraction by noting that A – B = A + (-B)
  • 18. Binary Counting Use 1 for ON Use 0 for OFF = 00101011 Binary Counter So our example has 25 + 23 + 21 + 20 = 32 + 8 + 2 + 1 = 43
  • 19. Counting in Binary 1 1 11 1011 21 10101 2 10 12 1100 22 10110 3 11 13 1101 23 10111 4 100 14 1110 24 11000 5 101 15 1111 25 11001 6 110 16 10000 26 11010 7 111 17 10001 27 11011 8 1000 18 10010 28 11100 9 1001 19 10011 29 11101 10 1010 20 10100 30 11110
  • 20. NAND (NOT AND) A B Q 0 0 1 0 1 1 1 0 1 1 1 0 BAQ ⋅=
  • 21. NOR (NOT OR) A B Q 0 0 1 0 1 0 1 0 0 1 1 0 BAQ +=
  • 22. Exclusive NOR A B Q 0 0 1 0 1 0 1 0 0 1 1 1 Equality Detector BAQ ⊕=
  • 23. Summary Summary for all 2-input gates Inputs Output of each gate A B AND NAND OR NOR XOR XNOR 0 0 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 0 1 1 0 1 0 1 1 1 0 1 0 0 1
  • 24. Number Systems  Decimal (base 10) {0 1 2 3 4 5 6 7 8 9} ¤ Place value gives a logarithmic representation of the number ¤ Ex. 4378 means ۞ 4 X 103 = 4000 ۞ 3 X 102 = 300 ۞ 7 X 101 = 70 ۞ 8 X 100 = 8 ¤ The place also gives the exponent of the base
  • 25. Example  432,600 4 3 2 6 0 0 105 104 103 100 101 102 Powers of ten: 100 = 1 102 = 100 104 = 10000 101 = 10 103 = 1000 105 = 100000
  • 26. Binary (base 2) {0 1} Binary Decimal 0 0 1 1 10 2 11 3 100 4 101 5 110 6 111 7 1000 8 1001 9 1010 10
  • 27. Example 1 1 0 1 1 0 0 1 27 26 25 20 21 22 24 23
  • 28. Decimal Equivalent  1101 1001 1 X 27 = 128 + 1 X 26 = 64 + 0 X 25 = 0 + 1 X 24 = 16 + 1 X 23 = 8 + 0 X 22 = 0 + 0 X 21 = 0 + 1 X 20 = 1 217 Notice how powers of two stand out: 20 = 1 21 = 10 22 = 100 23 = 1000
  • 29. Decimal to Binary Conversion  Ex. 575 ¤ Find the largest power of two less than the number ۞ 29 = 512 ¤ Subtract that power of two from the number ۞ 575 – 512 = 63 ¤ Repeat steps 1 and 2 for the new result until you reach zero. ۞ 25 = 32 63 – 32 = 31 ۞ 24 = 16 31 – 16 = 15 ۞ 23 = 8 15 – 8 = 7 ۞ 22 = 4 7 – 4 = 3 ۞ 21 = 2 3 – 2 = 1 ۞ 20 = 1 1 – 1 = 0 ¤ Construct the number ۞ 1000111111
  • 30. Another Example  144 ¤ 27 = 128 144 – 128 = 16 ¤ 24 = 16 16 – 16 = 0  Result 10010000
  • 31. Hexadecimal (base 16)  {0 1 2 3 4 5 6 7 8 9 A B C D E F}  Assignments Dec Hex Dec Hex 0 0 8 8 1 1 9 9 2 2 10 A 3 3 11 B 4 4 12 C 5 5 13 D 6 6 14 E 7 7 15 F
  • 32. Example 163 162 160 161 3 B 6 E 3 X 163 = 12288 11 X 162 = 2816 6 X 161 = 96 14 X 160 = 14 ⇒ 15214
  • 33. Hexadecimal is Convenient for Binary Conversion Binary Hex Binary Hex 0 0 1001 29 1 1 1010 A 10 2 1011 B 11 3 1100 C 100 4 1101 D 101 5 1110 E 110 6 1111 F 111 7 1 0000 10 1000 8 ⇐ Nibble
  • 34. Binary to Hex Conversion  Group binary number by fours (nibbles) ¤ 1101 1001 0110  Convert each nibble into hex equivalent ¤ 1101 1001 0110 D 9 6
  • 35. Decimal to Hex Conversion  Ex. 284 ¤ 162 = 256 284 – 256 = 28 ¤ 161 = 16 28 - 16 = 12 (Hex C) ¤ Result 1 1 C
  • 36. Another Example with an Extension  1054 ¤ 162 = 256 ۞But we have several multiples of 256 in 1054 – 1054/256 = 4.12 take integer part – This eliminates 4*256 = 1024 ۞ 1054 – 1024 = 30 ¤ 161 = 16 30 – 16 = 14 (Hex E) ¤ Result 4 1 E