82
Let’s Go Buy a Computer

Let’s Go Buy a Computer. So What’s in a Computer? Processor brains Memory scratch paper Disk long term memory I/O communication (senses) Software reconfigurability

  • View
    214

  • Download
    1

Embed Size (px)

Citation preview

Let’s Go Buy a Computer

So What’s in a Computer?

• Processor brains• Memory scratch paper• Disk long term memory• I/O communication (senses)

• Software reconfigurability

What’s in a Computer?

CPUCommunications

I/OText

SoundSoftware

Power

Disk

RAM

Ports

Putting Together an Application

• Word (is a part of the Office application)• Runs on Windows (an operating system)• Which runs on a Dell PC (a computer)• Which has a Pentium (a processor)• Enhanced by connections to monitor, printer, network• Uses random access memory (RAM) to work on

document, disk (non-volatile) memory to store in• Need a CD-ROM to install application (or install off

the Internet over a broadband connection)

Let’s Go Buy a Computer

Computer Configuration

• Processor (Pentium IV, 2.8 GHz)• RAM (512 MB of SDRAM (expandable))• Disk (80 GB)• CD ROM/ CD RW/DVD/…• 17" XGA TFT Display (1280 x 1024 res.) • 3.5" 1.44MB Floppy Disk Drive • S3 Savage IX 128-bit AGP 2x graphics

– 8MB memory, 3D Hardware acceleration, composite TV-Out support, …

• 16-bit Sound

Computer Configuration (contd)

• 2 Type-I or Type-II slots or 1 Type-III slot • 2 USB Ports • Built-in 56Kbps V.90 Data/fax modem • Built-in 10/100 Ethernet Adapter and

802.11b/g wireless

• Also – universal AC adapter, – built-in Lithium-Ion battery, – Microsoft Windows XP, – Encarta World Encyclopedia online version…

What’s Special About a Computer?

• Most complex object made by humans• A rich communication mechanism for society• Amazing how it works• Reconfigurability• Moore’s Law

More for Less --Moore’s Law

• 1985 when I was a student here– A desktop machine in the lab

• $150,000 (now < $1,000)

• 700 KHz chip (now ~3 GHz)

• 1 MB memory (now 128-512 MB)

• 80 MB disk (now 80 GB +)

• CD-ROM had just been invented (83)

• Minimal Internet connection

• Communication to Internet 9600 bps (now 10 Mbps)

Moore’s Law (contd)

• $150,000 (now < $1,000)– Factor of 150

• 700 Khz processor (now 2 GHz chip)– Factor of 3000

• 1 MB memory (now 256MB)– Factor of 256

• 80 MB disk (now 40/80 GB)– Factor of 1000

• Communication 9600 bps (now 10 Mbps)

– Factor of 1000

An interesting example: Walmart/Microtel PC

• AMD 1.5 GHz Sempron processor with 3DNow! Technology• 128 MB DDR Memory, expandable to 2 GB• 20 GB Ultra ATA-100 Hard Drive / 5400 RPM• 52x CD-ROM drive• Integrated 10/100 Ethernet Connection• Integrated graphics up to 64 MB shared video memory• Integrated 5.1 Channel AC'97 Audio• Available drive bays: Two 5.25", one 3.5“• No operating system installed• Speakers, but no display

• Price: $198

Moore’s Law (contd)

year

log

(p

eo

ple

pe

r c

om

pu

ter)

Mainframe

Minicomputer

Workstation

PC

Laptop

PDA

???

* This slide and the next lifted from a presentation by David Culler

Moore’s Law (contd)

Itanium2 (241M )

nearly a thousand 8086’swould fit in a modern microprocessor

Processing & Storage

LNAmixerPLL basebandfilters

I Q

CommunicationSensingActuation

SOON:

Rest of the Course

• Hardware: Building a computer– How arithmetic and logical operations are realized– How data are represented– How memory is realized– How sequencing is done and state machines are realized

• Software: Programming and Using a computer– Programs and Programming languages– Algorithms– Applications: Graphics and Sound

• Operating Systems, Networking and Distributed Computing– Operating Systems– Basic Networking– Applications: E-mail and the Internet– Peer-to-peer and music sharing

• Hard Problems and Limits of Computing

• Security, Privacy, Artificial Intelligence (?)

Let’s Build a Computer

Building a computer

ReallySimpleStuff

Why build a computer?

• Curiosity– What really happens when I hit a key?

• Necessity– Prerequisite to parts of the course

• Breadth– Should understand what’s changing the world

Why NOT build a computer?

• Computers seem really complicated– Pentium IV chip has 42 million transistors

– (in an area of 217 square mm, )

• How can we hope to understand them ?

Analogy with Building a House

• Components• Glue for combining components• Modeling the process• Tools and Rules

In fact, computer design is called computer architecture

Questions in Building a House

• What are the basic components – 2”x4”’s, I-beams, plasterboard, ..

– Light fixtures, plumbing, …

• What is glue for combining them– Nails, screws, bolts, pipes, …

• How do we model the process– Architectural drawings, building codes, …

Questions in Building a Computer

• What are the basic components – Logic gates

• What is glue for combining them– Wires to build circuits

• How do we model the process– Architectural drawings, design rules, …

– Mathematical formulation

Details

• Wires are made of silicon or other chemicals• Crossing wires implement transistors, the basic unit of

computer design• Transistors control the flow of electrons (current)

– They either do or don’t flow through – Think of light switches turning current on or off

• Wire thickness is currently about .1 micron– 1 micron = 10-6 meters– Can fit 42 million transistors in less than 1.5cmx1.5cm

• Design must follow fabrication rules– Wires can’t get too close (unless they cross)

• A key tool is abstraction

What is Abstraction?

• Ignoring or hiding details to capture essential features for the purpose at hand

• E.g. we’ll ignore whether we’re talking about:– A Pentium II or a Pentium III

– A Mac or a PC

• Instead, we’ll focus on what really makes a computer a computer.

Abstraction in Everyday Life

• Parent says: “Brush your teeth”• Parent doesn’t specify:

– What kind of toothbrush

– What kind of toothpaste

– What you’re wearing

– etc.

• These things aren’t important to the order at hand

Abstraction (cont.)

• If we had to spell out everything in full detail, our lives would be really complicated

• Abstraction allows us to understand things in a modular fashion

• Same is true for computers: To understand them, we use abstraction

It’s Not 100 Million Transistors

• It’s a few major functional components– Each exposes a functional interface– They’re connected to one another with wires

• Each is composed of a number of smaller components– Each of which exposes a functional interface– They’re connected to one another with wires

• And so on, until each is composed of a few transistors– There’s usually a lot of regularity among these (many

similar building blocks)

Layers of Abstraction

ReallySimpleStuff

Computers

• Build more powerful tools out of simpler ones• What’s the really simple stuff?

– 0s and 1s

Layers of Abstraction (cont.)

0sand1s

Computers

Logic gates Logic

circuitsMemory

State Machines

Logic and Logic Gates

• Frank will go to the party if Ed goes AND Dan does NOT.

• Dan will go if Bob does NOT go OR if Carole goes.

• Ed will go to the party if Alice AND Bob go.

• Alice and Bob decide to go,but Carol stays home.

• Will Frank go to the party?

• Answer: YES

A Simple Logic Puzzle

• What do 0’s and 1’s mean?

• For now, we’ll take “Natural meanings:”

• For example, if we have a variable ‘Alice’ that denotes whether Alice goes to the party,

• If Alice goes, we say Alice = 1

• If Alice doesn’t, we say Alice = 0

0 = False 1 = True

Using 0s and 1s

• Computers are circuits made of Logic Gates.

• Logic gates manipulate 0’s and 1’s (False and True) by letting electrons flow or not.

• We’ll look at three types of Logic Gates:

• AND are all inputs true?

• OR is at least one input true?

• NOT flip the truth value

Logic Gates

• “Zac will go to the party if Xena AND Yanni go.”

ANDX

Y

Z

X Y Z

F F F

F T F

T F F

T T T

“Truth Table”

AND Gate

• “Zac will go to the party if Xena AND Yanni go.”

ANDX

Y

Z

X Y Z

0 0 0

0 1 0

1 0 0

1 1 1

“Truth Table”

AND Gate

AND Gate (contd)

• AND Gate is a circuit that allows output current to flow if both inputs are flowing– i.e. output is 1 if and only if both inputs are 1

ANDW

Y

ZX

ANDW

Y

ANDZX

is shorthand for:

AND Gate (cont.)

ANDW

Y

ZX

W X Y Z

0 0 0 ?

0 0 1 ?

0 1 0 ?

0 1 1 ?

1 0 0 ?

1 0 1 ?

1 1 0 ?

1 1 1 ?

AND Gate (cont.)

W X Y Z

0 0 0 0

0 0 1 0

0 1 0 0

0 1 1 0

1 0 0 0

1 0 1 0

1 1 0 0

1 1 1 1

ANDW

Y

ZX

AND Gate (cont.)

• “Zac will go to the party if Xena OR Yanni go.”

ORX

Y

Z

X Y Z

F F F

F T T

T F T

T T T

Truth Table

OR Gate (cont.)

• “Zac will go to the party if Xena OR Yanni go.”

ORX

Y

Z

X Y Z

0 0 0

0 1 1

1 0 1

1 1 1

Truth Table

OR Gate (cont.)

• OR Gate is a circuit that allows output current to flow if either input is flowing– i.e. output is 1 if either input is 1 (or both inputs are 1)

OR Gate (contd)

ORW

Y

ZX

OROR

W

Y

ZX

is shorthand for:

OR Gate (contd)

ORW

Y

ZX

W X Y Z

0 0 0 ?

0 0 1 ?

0 1 0 ?

0 1 1 ?

1 0 0 ?

1 0 1 ?

1 1 0 ?

1 1 1 ?

OR Gate (contd)

ORW

Y

ZX

W X Y Z

0 0 0 0

0 0 1 1

0 1 0 1

0 1 1 1

1 0 0 1

1 0 1 1

1 1 0 1

1 1 1 1

OR Gate (contd)

• “Yanni will go to the party if Xena does NOT go.”

X YNOT

X Y

Shorthand:

Truth Table

X Y

0 1

1 0

NOT Gate

• NOT Gate is a circuit that reverses the sense of a flow. – i.e. Logical complement: Output is 1 if and only if input is 0

NOT Gate (contd)

• Frank will go to the party if Ed goes AND Dan does NOT.

• Dan will go if Bob does NOT go OR if Carole goes.

• Ed will go to the party if Alice AND Bob go.

• Alice and Bob decide to go,but Carol stays home.

• Will Frank go to the party?

Back to Our Simple Logic Puzzle

Frank will go to the party if Ed goes AND Dan does NOT.

AND

Ed

Dan

Frank

NOT

Logic Puzzle Circuit

Frank will go to the party if Ed goes AND Dan does NOT.

AND

Ed

Dan

Frank

Logic Puzzle Circuit (contd)

AND

Ed will go to the party if Alice AND Bob go.

AND

Ed

Dan

FrankAlice

Bob

Logic Puzzle Circuit (contd)

OR

ANDAND

Ed

Dan

Frank

Dan will go if Bob does NOT go OR if Carole goes.

Carole

Alice

Bob

Logic Puzzle Circuit (contd)

OR

ANDAND

Ed

Dan

Frank

Alice and Bob decide to go,but Carol stays home.

1

1

0Carole

Alice

Bob

Logic Puzzle Circuit: Inputs

OR

ANDAND

Ed

Dan

Frank

Evaluation…

1

1

0Carole

Alice

Bob

1

1

0

0

Logic Puzzle Circuit (contd)

OR

ANDAND

Ed

Dan

Frank

Evaluation…

1

1

0Carole

Alice

Bob

1

1

0

0

1

Logic Puzzle Circuit (contd)

OR

ANDAND

Ed

Dan

Frank

Evaluation…

1

1

0Carole

Alice

Bob

1

1

0

0

1

0

Logic Puzzle Circuit (contd)

OR

ANDAND

Ed

Dan

Frank

Evaluation…

1

1

0Carole

Alice

Bob

1

1

0

0

1

0

1

1

Logic Puzzle Circuit (contd)

OR

ANDAND

Ed

Dan

Frank

Evaluation Complete!

Answer: Frank goes to the party.

1

1

0Carole

Alice

Bob

1

1

0

0

1

0

1

1

1

Logic Puzzle Circuit (contd)

OR

ANDAND

Ed

Dan

Frank

What if:

Alice, Bob, and Carol all go to the party?

1

1

1Carole

Alice

Bob

Logic Puzzle Circuit: Different Inputs

OR

ANDAND

Ed

Dan

Frank

Answer: Frank does NOT go to the party!

1

1

1Carole

Alice

Bob

1

1

1

0

1

1

1

0

0

What if:

Alice, Bob, and Carol all go to the party?

Logic Puzzle Circuit (contd)

All Clear?

• Suppose someone gives us an arbitrary Truth Table.

• How do we build a circuit which satisfies exactly that Truth Table?

Building Circuits

• Frank will go to the party if Ed goes AND Dan does NOT.

• Dan will go if Bob does NOT go OR if Carole goes.

• Ed will go to the party if Alice AND Bob go.

• Let’s start with the Truth Table instead

Our Friend the Logic Puzzle

Alice Bob Carole Frank

0 0 0 0

0 0 1 0

0 1 0 0

0 1 1 0

1 0 0 0

1 0 1 0

1 1 0 1

1 1 1 0

Note: Frank goes only if A=B=1 and C=0

Truth Table for Logic Puzzle Circuit

ANDA

C

FB A B C F

0 0 0 0

0 0 1 0

0 1 0 0

0 1 1 0

1 0 0 0

1 0 1 0

1 1 0 0

1 1 1 1

Recall the AND Gate

ANDA

C

FB A B C F

0 0 0 0

0 0 1 0

0 1 0 0

0 1 1 0

1 0 0 0

1 0 1 0

1 1 0 1

1 1 1 0

Modify the AND Gate

ANDA

C

FB

Note: Frank goes only if A=B=1 and C=0.

The modified AND also solves the Logic Puzzle!

A B C F

0 0 0 0

0 0 1 0

0 1 0 0

0 1 1 0

1 0 0 0

1 0 1 0

1 1 0 1

1 1 1 0

Modify the AND Gate

ANDA

C

FB

?

A B C F

0 0 0 0

0 0 1 0

0 1 0 0

0 1 1 0

1 0 0 0

1 0 1 0

1 1 0 1

1 1 1 0

Modify the AND Gate?

ANDA

C

FB A B C F

0 0 0 0

0 0 1 1

0 1 0 0

0 1 1 0

1 0 0 0

1 0 1 0

1 1 0 0

1 1 1 0

Sure …

ANDA

C

FB

Similarly,we can makea circuit for

any Truth Tablewith only a single

1 in its output.

A B C F

0 0 0 0

0 0 1 0

0 1 0 1

0 1 1 0

1 0 0 0

1 0 1 0

1 1 0 0

1 1 1 0

Similarly …

First, make circuitsfor every row in the Truth Table that hasa 1 in the output.

A B C F

0 0 0 0

0 0 1 1

0 1 0 1

0 1 1 0

1 0 0 0

1 0 1 0

1 1 0 1

1 1 1 0

Given Any Truth Table

ANDA

C

B

ANDA

C

ANDA

C

B

B

A B C F

0 0 0 0

0 0 1 1

0 1 0 1

0 1 1 0

1 0 0 0

1 0 1 0

1 1 0 1

1 1 1 0

A Circuit from Any Truth Table (contd)

ORANDA

C

B

ANDA

C

ANDA

C

B

B

Finally, combine themwith an OR gate.

F

A Circuit from Any Truth Table (contd)

ORANDA

C

B

ANDA

C

ANDA

C

B

B

• The only way F=1 is if at least ONE of the AND gates outputs a 1.• But each AND gate corresponds to a row in the Truth Table with a 1 in the output!

F

A Circuit from Any Truth Table (contd)

First, make circuitsfor each row in theTruth Table that hasa 1 in the output.

A B C X

0 0 0 1

0 0 1 0

0 1 0 0

0 1 1 0

1 0 0 0

1 0 1 0

1 1 0 0

1 1 1 1

Another Example

ANDA

C

ANDA

C

B

B

A B C X

0 0 0 1

0 0 1 0

0 1 0 0

0 1 1 0

1 0 0 0

1 0 1 0

1 1 0 0

1 1 1 1

Another Example (contd)

OR

Finally, combine themwith an OR gate.

X

ANDA

C

ANDA

C

B

B

Another Example

• Same idea works no matter how many input variables.

• So for ANY Truth Table we can write down, we can make a circuit for it using only 3 Logic Gates: AND, OR, NOT

• This gives us a very powerful tool !

• Our first technical use of abstraction: “Make a circuit for that Truth Table” is something we can abstract and understand.

Universality

Some issues to think about on your own

• We know that AND,OR, and NOT together are “universal” – we can make a circuit for any Truth Table using just these gates ! What else is universal?

• Surprising answer: There is a single gatecalled “NAND” which is universal all by itself!

Additional Issues

NANDX

Y

Z

X Y Z

0 0 1

0 1 1

1 0 1

1 1 0

ANDX

Y

Z

NAND Gate

NAND

X

Y

Z

X Y Z

0 0 1

0 1 1

1 0 1

1 1 0

Truth Table Truth Table

NAND

X

1

Z

X Y Z

1 1 0

0 1 1

Fix Y at 1

NOT from a NAND Gate

Some issues to think about on your own:

We saw two circuits for the Logic Puzzle that both worked – but one (the modified AND) was much simpler than the other.

• Can you come up with methods for simplifying circuits?

• This is important for efficiency when you are dealing with very large Truth Tables (which we will see in the future).

Additional Issues

Are We Done?