Title: Computer Logic, Logic Gates, and Building Circuits
1Computer Logic, Logic Gates,and Building Circuits
- Matt HuenerfauthCSE 100Lab Session 1September
2003U. of Pennsylvania
Image Intel Museum
2Logic and Computers
- The technology inside of computers (and in fact
all logical ideas) is based on several simple
logic operations - AND
- OR
- NOT
- These logical operations are related to real
world equivalents
3What does AND mean?
- When we say AND, formally we mean that
something is true only when both parts of it are
true. - If the stove is on AND waters in the kettle,
then we will make steam. - If either part isnt there, then the result wont
be true.
4What does AND mean in Logic?
- AND takes two inputs and produces the value TRUE
if both inputs are TRUEs. - So, with the inputs T AND T output is T
- T AND F output is F
- F AND T output is F
- F AND F output is F
- (Just like in the real world.)
5A Truth Table
- A truth table is a convenient way to write down
the definition of a logic operation. - Lets use 1s for True and 0s for False
- Heres the table for AND
- input input output
- 1 1 1
- 1 0 0
- 0 1 0
- 0 0 0
Output of 1 onlywhen both inputsare 1.
6Truth Table for OR and NOT
- OR NOT
- input input output input output
- 1 1 1 1 0
- 1 0 1 0 1
- 0 1 1
- 0 0 0
This just givesthe opposite.
We only need one of the inputsto be true, but if
both are true,thats ok, too.
7A Logic Gate
- A logic gate is a small computer circuit that
simulates one of the logic operators weve seen. - There are one or two wires that go into the gate
that represent the input. - There is one output wire that represents the
result of the logic operation. - When the power is on, that means True.
8Logic Gates
- When drawing diagramsof logic circuits, weuse
some traditionalshapes for each one.
A
C
NOT
If A is off, turn on C.
AND
AND
A
A
C
C
OR
B
B
If A and B are on, turn on C.
If A or B is on, turn on C.
9The Logic Gate Demo (1)
- Explore how AND, OR, and NOT work.
- http//www.seas.upenn.edu/cse100/labs/01/
10What have we seen so far?
- We saw what a logic gate is. We saw how to use
one. - Now we will see how they work inside.
- But we will return to the LogSim program later to
see how we can combine multiple logic gates
together to do useful work.
11But whats inside the box?
- How do we build an individual logic gate?
- Pattern on the Stone chapter 1 shows to build
each logic gate from tinker toys, water pipes,
or wires. - But real computers today use logic gates built
out of small electronic devices.
Image Tinkertoy Website
12OR Gate from Tinker Toys
spring
Pushing a pole to the right means TRUE.
moveable
Push either one of theseto make the output
polemove.
Not moveable
13Building Gates from Wires
Lighting-up means TRUE for output.
Flipping a switch means TRUE for input.
-
AND
OR
-
How many switches must you turn on in
eachcircuit in order for the light bulb to light
up?
14Real Computers
- Real computers are not built from tinker toys or
any of the other wacky approaches shown in the
Pattern on the Stone. - Computers today use logic gates that are built
out of small electronic devices called
transistors.
15Whats a Transistor
Image Intel Museum
16Why are transistors special?
- Transistors are like real switches, but
- 1. They have no moving parts.
- 2. They can be turned on and off by an electric
signal. - 3. You could hook the output of one switch to the
input of another since they both use electricity! - So that means They are small and fast.
- In fact, as transistors get smaller and faster,
so do computers.
ControlSignal
Image Intel Museum
17Computers Get Smaller ENIAC
- The tremendous size of the first electronic
computer, built here at Penn, was because the
transistors used to built it were the size of
lightbulbs. - Modern transistors are microscopic.
- Thats what we have laptop and handheld
computers nowadays.
Image Van Pelt Library ENIAC Exhibit
18Sizes of Transistors
- Look at the transistors samples in class.
- Moores Law is a famous observation that
Researchers tend to shrink transistor sizes in
half every 18 months.
Transistors shrink so we can make chips smaller
and fit more on a single chip.
Image Intel Research
19A Transistor
- A transistor controlswhether a switch ison or
off. - It turns off its switch when its given an
electric signal. - When there is no power on the signal line, the
transistor turns the switch on.
Transistor
signal
20A Transistor
- A transistor controlswhether a switch ison or
off. - It turns off its switch when its given an
electric signal. - When there is no power on the signal line, the
transistor turns the switch on.
TransistorOFF
signalON
21A Transistor
- A transistor controlswhether a switch ison or
off. - It turns off its switch when its given an
electric signal. - When there is no power on the signal line, the
transistor turns the switch on.
TransistorON
signalOFF
22Logic Gates from Transistors
- For example, we will build a NOT gate from a
transistor.
extrapowersource
Transistor
Output fromNOT gate.
Input toNOT gate.
23Logic Gates from Transistors
- For example, we will build a NOT gate from a
transistor.
extrapowersource
TransistorOFF
Output fromNOT gateis OFF.
Input toNOT gateis ON.
NOT 1 ? 0
24Logic Gates from Transistors
- For example, we will build a NOT gate from a
transistor.
extrapowersource
TransistorON
Output fromNOT gateis ON.
Input toNOT gateis OFF.
NOT 0 ? 1
25Summary A Hierarchy of Parts
- We started with TRANSISTORS.
- We built some LOGIC GATES.
- Can we build useful stuff out of logic
gates?How can we combine them?
26The Logic Gate Demo (2)
- Explore how to combine logic gates together.
- http//www.seas.upenn.edu/cse100/labs/01/
- What if we want to build a circuit that can
calculate either one or the other but not both ?
27Building Exclusive OR
- One or the other but not both.
- Different than OR.
-
- _
28Building Exclusive OR
- One or the other but not both.
- Different than OR.
- Want output TRUE when eitherInput 1 is TRUE
and Input 2 is FALSE orInput 1 is FALSE and
Input 2 is TRUE
29Building Exclusive OR
- One or the other but not both.
- Different than OR.
- Want output TRUE when eitherInput 1 is TRUE
and Input 2 is FALSE orInput 1 is FALSE and
Input 2 is TRUE
Can replace False with NOT TRUE.
30Building Exclusive OR
- Want output TRUE when eitherInput 1 is TRUE and
Input 2 is NOT TRUE orInput 1 is NOT TRUE and
Input 2 is TRUE
AND
NOT
Input 1
OR
Output
Input 2
AND
NOT
31If theres extra time
- Can we build an AND circuit using only NOT and OR
gates?
32If theres extra time
AND should be FALSE if either Input 1 is NOT
TRUE or Input 2 is NOT TRUE.
Input 1
NOT
Output
OR
NOT
Input 2
NOT
33Credits
- The Intel Museum
- http//www.intel.com/education/transworks/
- Intel Research Website
- http//www.intel.com/research/silicon/mooreslaw.h
tm - Van Pelt Library ENIAC Exhibit
- John W. Mauchly and the Development of the ENIAC
Computer - http//www.library.upenn.edu/exhibits/rbm/mauchly
/jwm0-1.html - Tinker Toys Website
- http//www.hasbro.com/tinkertoy/