Lecture 14 ppt

Download Report

Transcript Lecture 14 ppt

Quick announcements
• Deadline for HW3 extended to 11/14/2005
• Grading formula in “grade so far” does not include extra
credit. Used for grade promotion.
• Grades histogram. AVG(grades so far = 33.04)
Grade So Far
12
10
8
Frequency
6
4
2
0
0
5
10
L14: Boolean Logic and Basic Gates
15
20
25
Grade
30
35
40
45
50
Fall 2005
LECTURE 14:
• Transistors to logic gates
• Boolean Logic
• Basic logic gates
• Introduction to switching logic
• Turning logic circuits into switching expressions
• Simplifying switching expressions, Karnaugh Maps (no time)
L14: Boolean Logic and Basic Gates
Fall 2005
From Transistors to Computer Chips
L14: Boolean Logic and Basic Gates
Fall 2005
Transistors - Where it all starts
• Transistors are physical structures
– Bipolar Junction Transistors
– Field Effect Transistors
• For digital logic, you can think of a transistor as a switch
that has two states: “ON” and “OFF”
• Wiring transistors together, we can create logic functions
and storage elements
L14: Boolean Logic and Basic Gates
Fall 2005
Example: MOSFET (Metal Oxide
Semiconductor Field Effect Transistor)
Source
Gate
Drain
• Two different types of MOSFET
– p channel
– n channel
L14: Boolean Logic and Basic Gates
Fall 2005
Transistor as a Switch
Drain
Drain
Gate
Gate
Source
Source
• The voltage on the gate decides if the switch
will be open (i.e., “OFF”) or closed (i.e., “ON”)
L14: Boolean Logic and Basic Gates
Fall 2005
CMOS - Complementary Metal Oxide
Semiconductors
• Today, CMOS is the most common technology used
for manufacturing digital computer chips
• Combines p-channel and n-channel MOSFETS
• High levels of integration are possible
• Low power requirements
L14: Boolean Logic and Basic Gates
Fall 2005
MOSFETs
p-Channel
n-Channel
Source
Drain
Gate
Gate
Source
Designed so that
when Gate voltage is high,
switch is “ON”
L14: Boolean Logic and Basic Gates
Drain
Designed so that
when Gate voltage is low,
switch is “ON”
Fall 2005
Transistors and Logic Gates
• Transistors can be connected together with
wires
• Connect transistors to create simple, logical
functions - these functions are called logic
gates
• In modern computer chips, the transistors and
wires are very, very small
L14: Boolean Logic and Basic Gates
Fall 2005
CMOS Inverter
Vdd = “High”
Input
Output
Input
Output
Low
High
High
Low
Ground = “Low” = 0V
L14: Boolean Logic and Basic Gates
Fall 2005
NOT Logic Gate
Input
A
Input A
Output
Output
0
1
1
0
The NOT logic gate is an inverter
Logical function: A’ or A
L14: Boolean Logic and Basic Gates
Fall 2005
CMOS NAND Logic Gate
Vdd = “High”
Output
Input A
Input
A
Input B
Ground
L14: Boolean Logic and Basic
Gates
= “Low” = 0V
0
0
1
1
Input
B
0
1
0
1
Output
1
1
1
0
Fall 2005
NAND Logic Gate
Input A
Output
Input B
Input
A
Input
B
Output
0
0
1
0
1
1
1
0
1
1
1
0
• Logical function “NAND”
• AB alternatively (AB)’
L14: Boolean Logic and Basic Gates
Fall 2005
AND Logic Gate
Input A
Output
Input B
Input
A
Input
B
Output
0
0
0
0
1
0
1
0
0
1
1
1
• Logical function “AND”
• AB
L14: Boolean Logic and Basic Gates
Fall 2005
OR Logic Gate
Input A
Output
Input B
Input
A
Input
B
Output
0
0
0
0
1
1
1
0
1
1
1
1
• Logical function “OR”
• A + B
L14: Boolean Logic and Basic Gates
Fall 2005
NOR Logic Gate
Input A
Output
Input B
Input
A
Input
B
Output
0
0
1
0
1
0
1
0
0
1
1
0
• Logical function “NOT OR”
• (A + B) alternatively (A + B)’
L14: Boolean Logic and Basic Gates
Fall 2005
XOR Logic Gate
Input A
Input B
Output
Input
A
Input
B
Output
0
0
0
0
1
1
1
0
1
1
1
0
• Logical function “Exclusive OR”
• A B + A B alternatively A’B + AB’
L14: Boolean Logic and Basic Gates
Fall 2005
Truth Tables
Truth Tables are used to define the output for
any given combination of inputs
Input
A
Input
B
Output
0
0
1
0
0
0
0
0
1
1
0
0
1
1
0
1
0
1
1
0
1
1
1
0
0
1
1
0
1
0
0
1
1
0
1
0
1
1
0
0
1
1
1
1
L14: Boolean Logic and Basic Gates
Input Input
A
B
Input
Output
C
Fall 2005
Using Truth Tables to Create
Digital Logic Functions
Input Input
x
y
Input
Output
z
0
0
0
1
0
0
1
0
0
1
0
1
0
1
1
0
1
0
1
1
1
0
1
1
1
1
0
0
1
1
1
1
L14: Boolean Logic and Basic Gates
Fall 2005
A Generalized Procedure for Creating a Digital Logic
Design from a Truth Table
• Canonical Sum of Products form
– Create an input line for each input variable, and branch
off another line with a NOT gate to form the
complement of the variable.
– You will need as many AND gates as there are “1”s in the
truth table. The inputs to each AND gate are the input
variables or their complements - as indicated by the
truth table entries.
– For example if x=0, y=1, and z=0 and OUTPUT=1, you will
need x’ , y, and z’ as inputs into one of the AND gates
– You will need one OR gate. All of the outputs of the
AND gates will go into the OR gate. The output of the
OR gate is the output function for the circuit
L14: Boolean Logic and Basic Gates
Fall 2005
A Generalized Procedure for Creating a Digital Logic
Design from a Truth Table
• Canonical Product of Sums form
– Create an input line for each input variable, and branch
off another line with a NOT gate to form the
complement of the variable.
– You will need as many OR gates as there are “0”s in the
truth table. The inputs to each OR gate are the input
variables or their complements - as indicated by the
truth table entries.
– For example if x=0, y=0, and z=1 and OUTPUT=0, you will
need x , y, and z’ as inputs into one of the OR gates
– You will need one AND gate. All of the outputs of the
OR gates will go into the AND gate. The output of the
AND gate is the output function for the circuit
L14: Boolean Logic and Basic Gates
Fall 2005
Canonical Sum of Products
Input
A
Input
B
Output
0
0
1
0
1
1
1
0
1
1
1
0
• Using sum of products is one way to get a correct
circuit design from a truth table
• Approach doesn’t always give you the most efficient
circuit design!
L14: Boolean Logic and Basic Gates
Fall 2005
Boolean Algebra
• George Boole, 19th Century mathematician
• Developed a mathematical
system (algebra) involving
logic
– later known as “Boolean Algebra”
• Primitive functions: AND, OR and NOT
• The power of BA is there’s a one-to-one correspondence between
circuits made up of AND, OR and NOT gates and equations in BA
+ means OR,• means AND, x means NOT
L14: Boolean Logic and Basic Gates
Fall 2005
Switching Algebra Identities
• Identity Law
1A=A
0+A=A
• Null Law
0A=0
1+A=1
• Idempotent Law
AA = A
A+A=A
• Inverse Law
AA = 0
A+A=1
L14: Boolean Logic and Basic Gates
Fall 2005
More Switching Algebra Identities
• Commutative Law
AB = BA
A+B=B+A
• Associative Law
(AB)C = A(BC)
(A + B) + C = A + (B + C)
• Absorption Law
A(A + B) = A
A + AB = A
• Distributive Law
A + BC = (A + B)(A + C)
L14: Boolean Logic and Basic Gates
A(B + C) = AB + AC
Fall 2005
One Other Theorem: Involution
A = A
(A’)’ = A
L14: Boolean Logic and Basic Gates
Fall 2005
DeMorgan’s Law
AB = A+B
alternatively (AB)’ = A’ + B’
A+B=A B
alternatively (A + B)’ = A’ B’
Very useful for simplifying functions!
L14: Boolean Logic and Basic Gates
Fall 2005
Turning a Switching Expression into
A Digital Logic Circuit
• The expression has the directions “and’s” turn into “and”
gates; “or’s” turn into “or” gate, complements can be “not”
gates….
Example: xy + z’ = output
x
y
output
z
L14: Boolean Logic and Basic Gates
Fall 2005
Working with Switching Algebra
Quickie Quiz 1
(Draw this circuit)
f (A,B,C) = A’ + B’ + A’ B C
ABC
A’
B’
A’ B C
F(A,B,C)
L14: Boolean Logic and Basic Gates
Fall 2005
Working with Switching Algebra
Complicated functions can be simplified using
Boolean Algebra
L14: Boolean Logic and Basic Gates
Fall 2005
Another Example
Input A
Output
Input B
• What’s the logic function?
((A + B’)’ B’)’
• Simplify using DeMorgan’s Law and identities
= (A + B’) + B = A + (B’ + B) = A + 1 = 1
L14: Boolean Logic and Basic Gates
Fall 2005
Working with Switching Algebra
QUICKIE QUIZ
(Simplify this function)
f (w,x,y,z) = x y + w’ x y z’ + x’ y
= y (x + x’ + w’ x z’)
= y ( 1)
=y
L14: Boolean Logic and Basic Gates
Fall 2005
Simplified solutions aren’t always unique
Input Input
x
y
Input
Output
z
0
0
0
1
0
0
1
0
0
1
0
1
0
1
1
0
1
0
1
1
1
0
1
1
1
1
0
0
1
1
1
1
f(x,y,z) = x’ y’ z’ + x’ y z’ + x’ y z + x y’ z’ + x y’ z + x y z
= x’ z’ + x y’ + y z
= x’ y + y’ z’ + x z
= x’ z’ + y’ z’ + y z + x z
L14: Boolean Logic and Basic Gates
Fall 2005
Karnaugh Maps
A Tool for Simplifying Logic Functions
x y
0 0
0 1
1 1
1 0
0
0
2
6
4
1
1
3
7
5
z
Karnaugh map for three variables –
a truth table turned on its side
L14: Boolean Logic and Basic Gates
Fall 2005
Karnaugh Maps
xy
z
00
1
0
1
0
•
•
01
1
1
11
0
1
10
1
1
Input Input
y
x
Input
Output
z
0
0
0
1
0
0
1
0
0
1
0
1
0
1
1
0
1
0
1
1
1
0
1
1
1
1
0
0
1
1
1
1
Karnaugh maps are tools to help you visually/graphically group the “1s” in a
truth table to develop simplified expressions
From the logic expression, you can develop a logic- gate-level design
implementing the function
L14: Boolean Logic and Basic Gates
Fall 2005
Representing Functions Using a
Karnaugh Map
x y
0 0
0 1
1 1
1 0
0
1
1
0
1
1
0
1
1
1
z
L14: Boolean Logic and Basic Gates
Fall 2005
Karnaugh Map Guidelines (1 of 3)
• Prepare the map using the truth table inputs
• Each “1” on the Karnaugh map represents a min-term for
a “sum of products” expression of the truth table’s
function
• You can simplify the logic expression by combining the
product terms (the “min terms”) that are grouped on
the Karnaugh map
• Groups of two, four, eight, (any power of two) “1” ‘s on
the map can be used to develop a simpler expression of
fewer variables
L14: Boolean Logic and Basic Gates
Fall 2005
Karnaugh Map Guidelines (2 of 3)
• Groups can “wrap around” the sides of the Karnaugh map
– Top and bottom rows
– Right-most and left-most columns
• Determine which variables can be eliminated from the min-terms
using the row and column entries of the Karnaugh map
Any variable that appears as both a “1” and a “0” in the grouping can be
eliminated from the product term
• For a complete expression, you need to have expressions for
every “1” on the Karnaugh map and combine the terms in a “sum
of products” expression
L14: Boolean Logic and Basic Gates
Fall 2005
Karnaugh Map Guidelines (3 of 3)
• You can have a “1” included in more than one simplified
expression
Redundancy is okay if you end up with the same or fewer terms in
your sum of products expression
• Combine the simplified expressions into a sum of products
form
• Translate the sum of products form into a logic gate design
L14: Boolean Logic and Basic Gates
Fall 2005
Another Example
Input Input
x
y
Input
Output
z
0
0
0
1
0
0
1
0
0
1
0
1
0
1
1
0
1
0
0
1
1
0
1
0
1
1
0
1
1
1
1
1
L14: Boolean Logic and Basic Gates
Fall 2005
Another Example with Three
Variables
x y
z
0 0
0 1
1 1
1 0
0
1
1
1
1
1
0
0
1
0
f(x,y,z) = z’ + x y z
L14: Boolean Logic and Basic Gates
Fall 2005