View
222
Download
2
Category
Preview:
Citation preview
11
Logic GatesLogic Gates
22
Review of Boolean algebraReview of Boolean algebra
Just like Boolean logicJust like Boolean logic
Variables can only be 1 or 0Variables can only be 1 or 0 Instead of true / falseInstead of true / false
33
Review of Boolean algebraReview of Boolean algebra
Not is a horizontal bar above the numberNot is a horizontal bar above the number 0 = 10 = 1 1 = 01 = 0
Or is a plusOr is a plus 0+0 = 00+0 = 0 0+1 = 10+1 = 1 1+0 = 11+0 = 1 1+1 = 11+1 = 1
And is multiplicationAnd is multiplication 0*0 = 00*0 = 0 0*1 = 00*1 = 0 1*0 = 01*0 = 0 1*1 = 11*1 = 1
__
__
44
Review of Boolean algebraReview of Boolean algebra
Example: translate (Example: translate (xx++yy++zz)()(xyzxyz) to a Boolean ) to a Boolean logic expressionlogic expression ((xxyyzz))((xxyyzz))
We can define a Boolean function:We can define a Boolean function: F(x,y) = (F(x,y) = (xxyy))((xxyy))
And then write a “truth table” for it:And then write a “truth table” for it:
__ __ __
xx yy F(x,y)F(x,y)
11 11 00
11 00 00
00 11 00
00 00 00
5
Quick surveyQuick survey
I understand the basics of Boolean I understand the basics of Boolean algebraalgebra
a)a) Absolutely!Absolutely!
b)b) More or lessMore or less
c)c) Not reallyNot really
d)d) Boolean what?Boolean what?
66
Today’s demotivatorsToday’s demotivators
77
Basic logic gatesBasic logic gates
NotNot
AndAnd
OrOr
NandNand
NorNor
XorXor
xx
xy
xy xy
xyz
zx+yx
yxy
x+y+z
z
xy
xy
x+yxy
xÅyxy
88
Rosen, §10.3 question 1Rosen, §10.3 question 1
Find the output of the following circuitFind the output of the following circuit
Answer: (Answer: (x+yx+y)y)y Or (Or (xxyy))yy
xy
x+y
y
(x+y)y
____
xy
y
99
x
y
Rosen, §10.3 question 2Rosen, §10.3 question 2
Find the output of the following circuitFind the output of the following circuit
Answer: xyAnswer: xy Or Or ((xxyy) ≡ ) ≡ xxyy
x
y
x y x y
_ __ _ ______
10
Quick surveyQuick survey
I understand how to figure out I understand how to figure out what a logic gate doeswhat a logic gate does
a)a) Absolutely!Absolutely!
b)b) More or lessMore or less
c)c) Not reallyNot really
d)d) Not at allNot at all
1111
Rosen, §10.3 question 6Rosen, §10.3 question 6
Write the circuits for the following Write the circuits for the following Boolean algebraic expressionsBoolean algebraic expressions
a)a) xx++yy
xyxyxy
____
x x+y
1212
xyxyxy
Rosen, §10.3 question 6Rosen, §10.3 question 6
Write the circuits for the following Write the circuits for the following Boolean algebraic expressionsBoolean algebraic expressions
b)b) ((xx++yy))xx______________
xy
x+yx+y (x+y)x
1313
Writing xor using and/or/notWriting xor using and/or/not
p p ÅÅ qq ( (pp qq) ) ¬( ¬(pp qq))
x x ÅÅ y y (x + y)( (x + y)(xyxy))
xx yy xxÅÅyy
11 11 00
11 00 11
00 11 11
00 00 00
xy
x+y
xy xy
(x+y)(xy)
________
14
Quick surveyQuick survey
I understand how to write a logic I understand how to write a logic circuit for simple Boolean formulacircuit for simple Boolean formula
a)a) Absolutely!Absolutely!
b)b) More or lessMore or less
c)c) Not reallyNot really
d)d) Not at allNot at all
1515
Converting decimal numbers to Converting decimal numbers to binarybinary
53 53 = 32 + 16 + 4 + 1= 32 + 16 + 4 + 1= 2= 255 + 2 + 244 + 2 + 222 + 2 + 200
= 1*2= 1*255 + 1*2 + 1*244 + 0*2 + 0*233 + 1*2 + 1*222 + 0*2 + 0*211 + 1*2 + 1*200
= 110101 in binary= 110101 in binary= 00110101 as a full byte in binary= 00110101 as a full byte in binary
211= 128 + 64 + 16 + 2 + 1211= 128 + 64 + 16 + 2 + 1= 2= 277 + 2 + 266 + 2 + 244 + 2 + 211 + 2 + 200
= 1*2= 1*277 + 1*2 + 1*266 + 0*2 + 0*255 + 1*2 + 1*244 + 0*2 + 0*233 + 0*2 + 0*222 + + 1*21*211 + 1*2 + 1*200
= 11010011 in binary= 11010011 in binary
1616
Converting binary numbers to Converting binary numbers to decimaldecimal
What is 10011010 in decimal?What is 10011010 in decimal?1001101010011010 = 1*2 = 1*277 + 0*2 + 0*266 + 0*2 + 0*255 + 1*2 + 1*244 + 1*2 + 1*233 + +
0*20*222 + 1*2 + 1*211 + 0*2 + 0*200
= 2= 277 + 2 + 244 + 2 + 233 + 2 + 211
= 128 + 16 + 8 + 2= 128 + 16 + 8 + 2 = 154= 154
What is 00101001 in decimal?What is 00101001 in decimal? 00101001 = 0*200101001 = 0*277 + 0*2 + 0*266 + 1*2 + 1*255 + 0*2 + 0*244 + 1*2 + 1*233 + +
0*20*222 + 0*2 + 0*211 + 1*2 + 1*200
= 2= 255 + 2 + 233 + 2 + 200
= 32 + 8 + 1= 32 + 8 + 1 = 41= 41
1717
A bit of binary humorA bit of binary humor
Available for $15 at Available for $15 at http://www.thinkgeek.cohttp://www.thinkgeek.com/ m/ tshirts/frustrations/5aa9tshirts/frustrations/5aa9//
18
Quick surveyQuick survey
I understand the basics of I understand the basics of converting numbers between converting numbers between decimal and binarydecimal and binary
a)a) Absolutely!Absolutely!
b)b) More or lessMore or less
c)c) Not reallyNot really
d)d) Not at allNot at all
1919
How to add binary numbersHow to add binary numbers
Consider adding two 1-bit binary numbers Consider adding two 1-bit binary numbers xx and and yy 0+0 = 00+0 = 0 0+1 = 10+1 = 1 1+0 = 11+0 = 1 1+1 = 101+1 = 10
Carry is Carry is xx AND AND yy
Sum is Sum is xx XOR XOR yy
The circuit to compute this is called a half-adderThe circuit to compute this is called a half-adder
xx yy CarryCarry SumSum
00 00 00 00
00 11 00 11
11 00 00 11
11 11 11 00
2020
The half-adderThe half-adder
Sum = Sum = xx XOR XOR yy
Carry = Carry = xx AND AND yy
xy Sum
Carry
xy Sum
Carry
2121
Using half addersUsing half adders
We can then use a half-adder to compute We can then use a half-adder to compute the sum of two Boolean numbersthe sum of two Boolean numbers
1 1 0 01 1 0 0
+ 1 1 1 0+ 1 1 1 0001100??
000011
22
Quick surveyQuick survey
I understand half addersI understand half adders
a)a) Absolutely!Absolutely!
b)b) More or lessMore or less
c)c) Not reallyNot really
d)d) Not at allNot at all
2323
How to fix thisHow to fix this
We need to create an adder that can take a We need to create an adder that can take a carry bit as an additional inputcarry bit as an additional input Inputs: Inputs: xx, , yy, carry in, carry in Outputs: sum, carry outOutputs: sum, carry out
This is called a full adderThis is called a full adder Will add Will add xx and and yy with a half-adder with a half-adder Will add the sum of that to the Will add the sum of that to the
carry incarry in
What about the carry out?What about the carry out? It’s 1 if either (or both):It’s 1 if either (or both): xx++yy = 10 = 10 xx++yy = 01 and carry in = 1 = 01 and carry in = 1
xx yy cc carrycarry sumsum
11 11 11 11 11
11 11 00 11 00
11 00 11 11 00
11 00 00 00 11
00 11 11 11 00
00 11 00 00 11
00 00 11 00 11
00 00 00 00 00
2424
The full adderThe full adder
The “HA” boxes are half-addersThe “HA” boxes are half-adders
HAX
Y
S
C
HAX
Y
S
C
xy
c
c
s
HAX
Y
S
C
HAX
Y
S
C
xy
c
2525
The full adderThe full adder
The full circuitry of the full adderThe full circuitry of the full adder
xy
s
c
c
2626
Adding bigger binary numbersAdding bigger binary numbers
Just chain full adders togetherJust chain full adders together
HAX
Y
S
C
FAC
Y
X
S
C
FAC
Y
X
S
C
FAC
Y
X
S
C
x1y1
x2y2
x3y3
x0y0
s0
s1
s2
s3c
2727
Adding bigger binary numbersAdding bigger binary numbers
A half adder has 4 logic gatesA half adder has 4 logic gatesA full adder has two half adders plus a OR gateA full adder has two half adders plus a OR gate Total of 9 logic gatesTotal of 9 logic gates
To add To add nn bit binary numbers, you need 1 HA and bit binary numbers, you need 1 HA and nn-1 FAs-1 FAsTo add 32 bit binary numbers, you need 1 HA To add 32 bit binary numbers, you need 1 HA and 31 FAsand 31 FAs Total of 4+9*31 = 283 logic gatesTotal of 4+9*31 = 283 logic gates
To add 64 bit binary numbers, you need 1 HA To add 64 bit binary numbers, you need 1 HA and 63 FAsand 63 FAs Total of 4+9*63 = 571 logic gatesTotal of 4+9*63 = 571 logic gates
28
Quick surveyQuick survey
I understand (more or less) about I understand (more or less) about adding binary numbers using logic adding binary numbers using logic gatesgates
a)a) Absolutely!Absolutely!
b)b) More or lessMore or less
c)c) Not reallyNot really
d)d) Not at allNot at all
2929
More about logic gatesMore about logic gates
To implement a logic gate in hardware, To implement a logic gate in hardware, you use a transistoryou use a transistor
Transistors are all enclosed in an “IC”, or Transistors are all enclosed in an “IC”, or integrated circuitintegrated circuit
The current Intel Pentium IV processors The current Intel Pentium IV processors have 55 million transistors!have 55 million transistors!
3030
Pentium math error 1Pentium math error 1 Intel’s Pentiums Intel’s Pentiums
(60Mhz – 100 Mhz) (60Mhz – 100 Mhz) had a floating point had a floating point errorerror
Graph of z = y/xGraph of z = y/x
Intel reluctantlyIntel reluctantlyagreed to replace agreed to replace them in 1994them in 1994
Graph from http://kuhttp.cc.ukans.edu/cwis/units/IPPBR/pentium_fdiv/pentgrph.htmlGraph from http://kuhttp.cc.ukans.edu/cwis/units/IPPBR/pentium_fdiv/pentgrph.html
3131
Pentium math error 2Pentium math error 2 Top 10 reasons to buy a Pentium:Top 10 reasons to buy a Pentium:
1010Your old PC is too accurate Your old PC is too accurate
8.9999163362 8.9999163362 Provides a good alibi when the IRS calls Provides a good alibi when the IRS calls
7.9999414610 7.9999414610 Attracted by Intel's new "You don't need to know what's Attracted by Intel's new "You don't need to know what's
inside" campaign inside" campaign
6.9999831538 6.9999831538 It redefines computing--and mathematics!It redefines computing--and mathematics!
5.9999835137 5.9999835137 You've always wondered what it would be like to be a You've always wondered what it would be like to be a
plaintiff plaintiff
4.9999999021 4.9999999021 Current paperweight not big enough Current paperweight not big enough
3.9998245917 3.9998245917 Takes concept of "floating point" to a new level Takes concept of "floating point" to a new level
2.9991523619 2.9991523619 You always round off to the nearest hundred anyway You always round off to the nearest hundred anyway
1.9999103517 1.9999103517 Got a great deal from the Jet Propulsion Laboratory Got a great deal from the Jet Propulsion Laboratory
0.9999999998 0.9999999998 It'll probably work!! It'll probably work!!
3232
Flip-flopsFlip-flops
Consider the following circuit:Consider the following circuit:
What does it do?What does it do?
3333
MemoryMemory
A flip-flop holds a single bit of memoryA flip-flop holds a single bit of memory The bit “flip-flops” between the two NAND The bit “flip-flops” between the two NAND
gatesgates
In reality, flip-flops are a bit more In reality, flip-flops are a bit more complicatedcomplicated
Have 5 (or so) logic gates (transistors) per flip-Have 5 (or so) logic gates (transistors) per flip-flopflop
Consider a 1 Gb memory chipConsider a 1 Gb memory chip 1 Gb = 8,589,934,592 bits of memory1 Gb = 8,589,934,592 bits of memory That’s about 43 million transistors!That’s about 43 million transistors!
In reality, those transistors are split into 9 In reality, those transistors are split into 9 ICs of about 5 million transistors eachICs of about 5 million transistors each
34
Quick surveyQuick survey
I felt I understood the material in this I felt I understood the material in this slide set…slide set…
a)a) Very wellVery well
b)b) With some review, I’ll be goodWith some review, I’ll be good
c)c) Not reallyNot really
d)d) Not at allNot at all
35
Quick surveyQuick survey
The pace of the lecture for this The pace of the lecture for this slide set was…slide set was…
a)a) FastFast
b)b) About rightAbout right
c)c) A little slowA little slow
d)d) Too slowToo slow
Recommended