Lecture 7 Overview - University of Delaware

Download Report

Transcript Lecture 7 Overview - University of Delaware

Announcements
• Assignment 6 due tomorrow
• No Assignment 7 yet
Announcements
•
•
•
•
•
•
Joe & Ali: Game show Buzzer
Trisha & Matt: EMG & pedal
Jamy, Lei, Mark: LED cube: parts?
Jingliang: Piezoelectric charger
Eric: Water printer(?)
Philip &Gaurav: model train (parts?)
Lecture 16 Overview
•
•
•
•
Logic gates
Boolean Algebra
DeMorgan's Theorem
Karnaugh maps
Simple gate summary
A AND B  A  B
INPUT
OUTPUT
A
B
A AND B
0
0
0
1
0
0
1
INPUT
OUTPUT
A
B
A NAND B
0
0
1
0
1
0
1
1
0
0
1
1
1
1
1
1
0
INPUT
A OR B  A  B
A NAND B  A  B
OUTPUT
A
B
A OR B
0
0
0
1
0
1
0
1
1
1
1
1
A NOR B  A  B
NOT A  A or A '
INPUT
OUTPUT
A
B
A NOR B
0
0
1
1
0
0
0
1
0
1
1
0
The XOR gate
C=A XOR B
C=AB
C
A
B
C
(in)
(in)
(out)
0
0
0
0
1
1
1
0
1
1
1
0
A
B
C
(in)
(in)
(out)
0
0
1
0
1
0
1
0
0
1
1
1
The XNOR gate
C=A NOR B
C=AB
C
How to build a digital gate
• We can build an inverter
with one switch:
INPUT=0
• A NAND gate takes two
switches in series:
INPUT A
INPUT B
INPUT=1
CMOS gates
• Gates are very easy to build using MOSFET transistors (recall;
transistors can be considered as a voltage controlled switch)
• p-type conduct when the input=0
• n-type conduct when the input=1
CMOS NAND gate
• NAND gates are built using 4 MOSFETs
• p-type conduct when the input=0
• n-type conduct when the input=1
INPUT
OUTPUT
A
B
A NAND B
0
0
1
1
0
1
0
1
1
1
1
0
CMOS NAND gate
• The NAND gate is by far the most important
• It is cheapest to construct
• It can be used to produce all other logic operations
CMOS NAND gate
• The NAND gate is by far the most important
• It is cheapest to construct
• It can be used to produce all other logic operations
XOR
In general, how do we figure out how to
build a complex logic circuit?
Method I: Boolean Algebra
AND:
OR:
A 0  0
A0A
A 1  A
A 1 1
A A  A
AA A
A A  0
A A 1
Associative Law:
(A·B)·C  A·(B·C)  A·B·C
(A  B)  C  A  (B  C)  A  B  C
Distributive Law:
A·(B  C)  (A·B)  (A·C)
A  (B·C)  (A  B) · (A  C)
DeMorgan's Theorem:
(A·B)  A  B (NAND)
(A  B)  A · B (NOR)
NOT:
A A
Commutative Law:
A·B  B·A
ABBA
Precedence:
AB  A·B
A·B  C  (A·B)  C
A  B·C  A  (B·C)
Complete Rules of Boolean Algebra
AND:
OR:
A 0  0
A0A
A 1  A
A 1 1
A A  A
AA A
A A  0
A A 1
Associative Law:
(A·B)·C  A·(B·C)  A·B·C
(A  B)  C  A  (B  C)  A  B  C
Distributive Law:
A·(B  C)  (A·B)  (A·C)
A  (B·C)  (A  B) · (A  C)
DeMorgan's Theorem:
(A·B)  A  B (NAND)
(A  B)  A · B (NOR)
NOT:
A A
Commutative Law:
A·B  B·A
ABBA
Precedence:
AB  A·B
A·B  C  (A·B)  C
A  B·C  A  (B·C)
DeMorgan's Theorem Proof
"The contradictory opposite of a disjunctive proposition is a conjunctive proposition composed of the
contradictories of the parts of the disjunctive proposition (William of Ockham, Summa Logicae)."
OR
"break the line, change the sign"
Duality between AND and OR means that any logic function can be implemented
by using just OR and NOT gates , or by just AND and NOT gates
Using the Rules of Boolean Algebra
Example: Simplify the following function:
14 gates
Use X  X  1
expand this
Use X  YZ  (X  Y)  (X  Z)
and X  X  1
=1
3 gates
Method II: Karnaugh Maps
• There are often many solutions available to implement a given logic
expression
• How do we find the most efficient (least number of gates)?
• Use a Karnaugh map. Set up the Karnaugh map like this:
Two inputs; A and B
Three inputs; A, B and C
4 cells
Three inputs; A,B and C
8 cells
8 cells
• Each map consists of 2n cells, where n is the number of inputs (logic
variables)
• Row and column assignments arranged such that adjacent terms change
by only one bit
• so: use 00,01,11,10 instead of 00,01,10,11
• Makes it easier to identify subcubes
Karnaugh Maps: Setting up the Maps
Four inputs; A,B,C and D
16 cells
Karnaugh Maps: Setting up the Maps
• Here's an example:
Truth Table:
This is how we want
the circuit to behave.
Karnaugh Map
• The Karnaugh map "wraps around itself" i.e. the top and bottom, right and left edges
are touching.
• Adjacent cells contain terms which vary by
only one input variable.
•A subcube is defined as a set of 2m adjacent
cells with the same value. m is an integer, so
the subcube can be 1,2,4,8... cells
Karnaugh Maps: Example 1
• "Box the ones"
This subcube is represented by A'·B
This subcube is represented by A·C'
• So, the output is true if (A'ANDB)
• "sum of products": A'·B + A·C'
• This requires 5 gates:
• note clean schematic layout
OR (AANDC')
are true
• The method only works if ALL of the 1's are considered
• The minimal expression uses the smallest number of maximal subcubes
Karnaugh Maps: Example 2:
A
B
C
D
O
0
0
0
0
1
0
0
0
1
1
0
0
1
0
1
0
0
1
1
0
0
1
0
0
0
0
1
0
1
1
0
1
1
0
0
0
1
1
1
0
1
0
0
0
1
1
0
0
1
1
1
0
1
0
0
1
0
1
1
1
1
1
0
0
0
1
1
0
1
1
1
1
1
0
0
1
1
1
1
1
CD
AB
00
01
11
10
00
1
1
0
1
01
0
1
0
0
11
0
1
1
0
10
1
1
1
0
• Draw the table
• Find any isolated cells
• Find any 2-cell subcubes which are
not adjacent to other 2-cell subcubes.
Remember wrapping
Karnaugh Maps: Example 2:
A
B
C
D
O
0
0
0
0
1
0
0
0
1
1
0
0
1
0
1
0
0
1
1
0
0
1
0
0
0
0
1
0
1
1
0
1
1
0
0
0
1
1
1
0
1
0
0
0
1
1
0
0
1
1
1
0
1
0
0
1
0
1
1
1
1
1
0
0
0
1
1
0
1
1
1
1
1
0
0
1
1
1
1
1
CD
AB
00
01
11
10
00
1
1
0
1
01
0
1
0
0
11
0
1
1
0
10
1
1
1
0
• Draw the table
• Find any isolated cells
• Find 2-cell subcubes.
• Find 4-cell subcubes which are not
adjacent to other four cell subcubes
•Find 8-cell subcubes etc etc.
• Minimal expression is formed by the
smallest number of maximal subcubes
Karnaugh Maps: Example 2:
A
B
C
D
O
0
0
0
0
1
0
0
0
1
1
0
0
1
0
1
0
0
1
1
0
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1
0
1
0
0
0
1
1
0
0
1
1
1
0
1
0
0
1
0
1
1
1
1
1
0
0
0
1
1
0
1
1
1
1
1
0
0
1
1
1
1
1
CD
AB
00
01
11
10
00
1
1
0
1
01
0
1
0
0
11
0
1
1
0
10
1
1
1
0
• So sum-of products realization is:
O=A'·B'·D'+B'·C'+C'·D+AD
• Requires 9 gates
Karnaugh Maps: Example 2:
A
B
C
D
O
0
0
0
0
1
0
0
0
1
1
0
0
1
0
1
0
0
1
1
0
0
1
0
0
0
0
1
0
1
1
0
1
1
0
0
0
1
1
1
0
1
0
0
0
1
1
0
0
1
1
1
0
1
0
0
1
0
1
1
1
1
1
0
0
0
1
1
0
1
1
1
1
1
0
0
1
1
1
1
1
• So sum-of products realization is:
O=A'·B'·D'+B'·C'+C'·D+AD
• Requires 9 gates
A'·B'·D'
B'·C'
C'·D
AD