53
Modified by S. J. Fritz Spring 2009 (1) Based on slides from D. Patterson and www-inst.eecs.berkeley.edu/~cs152/ COM 249 – Computer Organization and Assembly Language Chapter 1 Computer Abstraction and Technology

Based on slides from D. Patterson and cs152

  • Upload
    riona

  • View
    15

  • Download
    0

Embed Size (px)

DESCRIPTION

COM 249 – Computer Organization and Assembly Language Chapter 1 Computer Abstraction and Technology. Based on slides from D. Patterson and www-inst.eecs.berkeley.edu/~cs152/. Arithmetic. Single/multicycle Datapaths. IFetch. Dcd. Exec. Mem. WB. µProc 60%/yr. (2X/1.5yr). 1000. CPU. - PowerPoint PPT Presentation

Citation preview

Page 1: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (1)

Based on slides from D. Patterson and

www-inst.eecs.berkeley.edu/~cs152/

COM 249 – Computer Organization andAssembly Language

Chapter 1 Computer Abstraction and

Technology

Page 2: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (2)

Where are we going??

COM 249Spring ‘09

µProc60%/yr.(2X/1.5yr)

DRAM9%/yr.(2X/10 yrs)

1

10

100

1000

19

80 1

98

1 19

83 1

98

4 19

85 1

98

6 19

87 1

98

8 19

89 1

99

0 19

91 1

99

2 19

93 1

99

4 19

95 1

99

6 19

97 1

99

8 19

99 2

00

0

DRAM

CPU

19

82

Processor-MemoryPerformance Gap:(grows 50% / year)

Per

form

ance

Time

“Moore’s Law”

34-b it A LU

LO register(16x2 bits)

Load

HI

Cle

arH

I

Load

LO

M ultiplicandRegister

S h iftA ll

LoadM p

Extra

2 bits

3 232

LO [1 :0 ]

Result[H I] Result[LO]

32 32

Prev

LO[1]

Booth

Encoder E N C [0 ]

E N C [2 ]

"LO

[0]"

Con trolLog ic

InputM ultiplier

32

S ub /A dd

2

34

34

32

InputM ultiplicand

32=>34sig nEx

34

34x2 M U X

32=>34sig nEx

<<13 4

E N C [1 ]

M ulti x2 /x1

2

2HI register(16x2 bits)

2

01

3 4 ArithmeticSingle/multicycleDatapaths

IFetchDcd Exec Mem WB

IFetchDcd Exec Mem WB

IFetchDcd Exec Mem WB

IFetchDcd Exec Mem WB

Pipelining

Memory Systems

I/O

YOUR

CPU

Page 3: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (3)

Where Are We Going?

°Performance issues (Chapter 1) overview, vocabulary and motivation

°A specific instruction set architecture (Chapter 2)

°Arithmetic and how to build an ALU (Chapter 3)

°Constructing a processor to execute our instructions (Chapter 4)

°Pipelining to improve performance (Chapter 4)

°Memory: caches and virtual memory (Chapter 5)

°I/O (Chapter 6)

°Multicores, Multiprocessors (Chapter 7)

Key to a good grade: reading the book!

Page 4: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (4)

What You Will Learn°How programs are translated into

the machine language•And how the hardware executes them

°The hardware/software interface

°What determines program performance•And how it can be improved

°How hardware designers improve performance

° What parallel processing is and what implications it has for programmers

Page 5: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (5)

Introduction° Rapidly changing field:

•vacuum tube -> transistor -> IC -> VLSI (see section 1.3)

•doubling every 1.5 years: (Moore’s Law)memory capacity processor speed (Due to advances in technology and

organization)

° Things you’ll be learning:

•how computers work, a basic foundation

•how to analyze their performance (or how not to!)

•issues affecting modern processors (caches, pipelines)

° Why learn this stuff?

•you want to call yourself a “computer scientist”

•you want to build software people use (need performance)

•you need to make a purchasing decision or offer “expert” advice

Page 6: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (6)

Understanding Performance

AlgorithmDetermines number of operations executed

Programming language, compiler, architectureDetermine number of machine instructions executed per operation

Processor and memory systemDetermine how fast instructions are executed

I/O system (including OS)Determines how fast I/O operations are executed

Page 7: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (7)

COM 249: So what's in it for me?

•Learn some of the big ideas in CS & engineering:

•5 Classic components of a Computer•Data can be anything (integers, floating point, characters): the program determines what it is•Stored program concept: instructions just data•Principle of Locality, exploited via a memory hierarchy (cache)•Greater performance by exploiting parallelism•Principle of abstraction, used to build systems as layers•Compilation vs. interpretation through system layers•Principles/Pitfalls of Performance Measurement•Designer’s “conceptual” toolbox

Page 8: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (8)

“Conceptual” Tool Box?°Evaluation Techniques

°Levels of translation (e.g., Compilation)

°Levels of Interpretation (e.g., Microprogramming)

°Hierarchy (e.g, registers, cache, memory, disk, tape)

°Pipelining and Parallelism

°Indirection and Address Translation

°Synchronous /Asynchronous Control Transfer

°Timing, Clocking, and Latching

°CAD Programs, Hardware Description Languages, Simulation

°Static / Dynamic Scheduling

°Physical Building Blocks (e.g., Carry Lookahead)

°Understanding Technology Trends

Page 9: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (9)

Our Goals

° To understand modern computer architecture in its rapidly changing form

° To explore the relationship between hardware and software

°To design by leading you through the process of challenging design problems and by examining real designs

°To learn how to test and to design for improved performance

Page 10: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (10)

COM249

Where is “Computer Organization and Assembly Language”?

*Coordination of many levels of abstraction

I/O systemProcessor

CompilerOperatingSystem

(Windows 2K)

Application (Netscape)

Digital DesignCircuit Design

Instruction Set Architecture

Datapath & Control

transistors

MemoryHardware

Software Assembler

Page 11: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (11)

Dual Level Abstraction

SOFTWARENegation, Add,

Double, Subtract

HARDWARENegation,

Add

Higher Levels

Lower Levels

Page 12: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (12)

Computer ArchitectureIncludes:

°Instruction set architecture (ISA) (programmer’s abstraction of a computer)

°Organization or microarchitecture (internal implementation of a computer at the register and functional unit level)

°System architecture (organization of the computer at the cache and bus level)

°See Computing Curriculum 2001 – pages 97-101

http://www.acm.org/education/education/curric_vols/cc2001.pdf

Page 13: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (13)

Instruction Set Architecture (ISA)

°A very important abstraction

•interface between hardware and low-level software

•standardizes instructions, machine language bit patterns, etc.

•advantage: different implementations of the same architecture

•disadvantage: sometimes prevents using new innovations

Modern instruction set architectures:

•80x86/Pentium/K6, PowerPC, DEC Alpha, MIPS, SPARC, HP

Page 14: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (14)

Hardware Levels

Level 0

Level 1

Level 2 CPU, Memory, Etc.

Digital Logic Circuits

Transistors

Page 15: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (15)

Software Levels

High-Level Languages

Assembly Language

Operating Systems

Machine Language

Level 6

Level 5

Level 4

Level 3

Page 16: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (16)

Software°At higher levels (above Level 2)•Level 3: Machine language•Level 4: Operating system services

•Level 5: Assembly language•Level 6: High-level languages

° Most programs are written at Level 6.

° Hardware only understands Level 3 instructions.

Page 17: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (17)

Below Your Program

°Application software•Written in high-level language (HLL)

°System software•Compiler: translates HLL code to machine code

•Operating System: service code- Handling input/output

- Managing memory and storage

- Scheduling tasks & sharing resources

°Hardware•Processor, memory, I/O controllers

§1.2 Below Your

Program

Page 18: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (18)

Levels of Representation

High Level Language Program (e.g., C)

Assembly Language Program (e.g.,MIPS)

Machine Language Program (MIPS)

Hardware Architecture Description (e.g., Verilog Language)

Compiler

Assembler

Machine Interpretation

temp = v[k];

v[k] = v[k+1];

v[k+1] = temp;

lw $t0, 0($2) #load word

lw $t1, 4($2)sw $t1, 0($2)

#store wordsw $t0, 4($2)0000 1001 1100 0110 1010 1111 0101 1000

1010 1111 0101 1000 0000 1001 1100 0110 1100 0110 1010 1111 0101 1000 0000 1001 0101 1000 0000 1001 1100 0110 1010 1111

Logic Circuit Description (Verilog Language)

Architecture Implementation

wire [31:0] dataBus;

regFile registers (databus);

ALU ALUBlock (inA, inB, databus);

wire w0;

XOR (w0, a, b);

AND (s, w0, a);

Page 19: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (19)

Revolutions

1. Agricultural

2. Industrial

3. Information / computer

Computers have become part of daily life and are ubiquitous (in cars, ATMs, microwave ovens, cell phones, etc.)

Classes: desktops, servers, supercomputers, embedded

Software: •Systems- Operating systems, compilers, assemblers

•Applications- Word processors, databases, spreadsheets, games, etc...

Page 20: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (20)

1/22/2008 CS152-Spring’08 2

Computing Devices Then…

EDSAC, University of Cambridge, UK, 1949

Page 21: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (21)

1/22/2008 CS152-Spring’08 3

Computing Devices Now

QuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.

Quic k T ime™ and aT IF F (Unc ompres s ed) dec ompres s orare needed to s ee this pic ture.

QuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.

QuickTime™ and aTIFF (Uncompressed) decompressorare needed to see thi s picture.

Robots

SupercomputersAutomobiles

Laptops

Set-top boxes

Games

Smart phones

Servers

Media Players

Sensor Nets

Routers

Cameras

Page 22: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (22)

Classes of Computers°Desktop computers

•General purpose, variety of software

•Subject to cost/performance tradeoff

°Server computers

•Network based

•High capacity, performance, reliability

•Range from small servers to building sized

°Embedded computers

•Hidden as components of systems

•Stringent power/performance/cost constraints

Page 23: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (23)

Embedded Computers

°Run one set of related applications, such as those in cell phones, TVs, cars, game machines, etc.

°Growth of cell phones, with embedded computers, has been faster than desktop computers.

°In 2004 there were 1 PC, 2.2 cell phones, and 2.5 TVs for every 8 people on the planet.

°In 2006, a US family owned 12 gadgets (3 TVs, 2 PCs, and others –MP3 players, cell phones, game consoles.)

Page 24: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (24)

The Processor Market

Page 25: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (25)

°Progress in computer technology•Underpinned by Moore’s Law

°Makes novel applications feasible•Computers in automobiles

•Cell phones

•Human genome project

•World Wide Web

•Search Engines

°Computers are pervasive

§1.1 IntroductionThe Computer Revolution

Page 26: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (26)

Moore’s Law

°Moore's Law, states that the number of transistors on a chip will double about every two years.

°Almost every measure of the capabilities of digital electronic devices is linked to Moore's law: processing speed, memory capacity, even the number and size of pixels in digital cameras

°http://en.wikipedia.org/wiki/Moore's_law

°http://www.intel.com/technology/mooreslaw/index.htm

Page 27: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (27)

From High Level to Low LevelAdvantages of High Level Languages

°Think in more natural terms about real world objects

°Improve programmer productivity

°Programmers independent of machine

Advantages of Low Level Language

°Faster

°Communicate directly with hardware

Page 28: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (28)

Components of a Computer

Same components forall kinds of computer

Desktop, server,embedded

Input/output includesUser-interface devices

Display, keyboard, mouse

Storage devicesHard disk, CD/DVD, flash

Network adaptersFor communicating with other computers

The BIG Picture

Page 29: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (29)

Anatomy: 5 components of any Computer

Personal Computer

Processor

Computer

Control(“brain”)

Datapath(“brawn”)

Memory

(where programs, data live whenrunning)

Devices

Input

Output

Keyboard, Mouse

Display, Printer

Disk (where programs, data live whennot running)

Page 30: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (30)

Anatomy of a Computer

Output device

Input device

Input device

Network cable

Page 31: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (31)

Anatomy of a Mouse

°Invented by Doug Englebart (1967)

°Mechanical (roller ball)

°Optical mouse•LED illuminates desktop

•Small low-res camera

•Basic image processor- Looks for x, y movement

•Buttons & wheel

°Supersedes roller-ball mechanical mouse

Page 32: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (32)

Through the Looking Glass

°LCD screen: picture elements (pixels)•Mirrors content of frame buffer memory

Page 33: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (33)

LCD Displays

°Liquid Crystal Display- thin, low power

°Uses rod shape molecules in a liquid forming a twisted helix that bends light.

°Rods straighten when current is applied and do not bend the light.

°Uses an active matrix of tiny transistors to control current and form sharper images.

°Images are composed of red, green and blue dots.

Page 34: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (34)

Forming Images

°An image is composed of picture elements or pixels, represented as a matrix of bits, called a bit map.

°Display matrix can be 640 x 480 to 2560 x 1600 pixels in size.

°A color display uses 8 bits for each of the 3 (RGB) colors, or 24 bits/pixel, creating millions of colors.

°A raster refresh or frame buffer is the hardware to support graphics. It stores the bit map.

Page 35: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (35)

Opening the Box

Page 36: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (36)

Inside the Processor (CPU)

°Datapath: performs operations on data

°Control: sequences datapath, memory, ...

°Cache memory•Small fast SRAM memory for immediate access to data

Page 37: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (37)

Inside the Processor

°AMD Barcelona: 4 processor cores

Page 38: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (38)

Abstractions

°Abstraction helps us deal with complexity•Hide lower-level detail

°Instruction set architecture (ISA)•The hardware/software interface

°Application binary interface (ABI)•The ISA plus system software interface

°Implementation•The details underlying and interface

The BIG Picture

Page 39: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (39)

A Safe Place for Data

°Volatile main memory•Loses instructions and data when power off

°Non-volatile secondary memory•Magnetic disk

•Flash memory

•Optical disk (CDROM, DVD)

Page 40: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (40)

Networks

°Communication and resource sharing

°Local area network (LAN): Ethernet•Within a building

°Wide area network (WAN: the Internet

°Wireless network: WiFi, Bluetooth

Page 41: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (41)

Technology Trends

°Electronics technology continues to evolve•Increased capacity and performance

•Reduced cost

Year Technology Relative performance/cost

1951 Vacuum tube 1

1965 Transistor 35

1975 Integrated circuit (IC) 900

1995 Very large scale IC (VLSI) 2,400,000

2005 Ultra large scale IC 6,200,000,000

DRAM capacity

Page 42: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (42)

Overview of Physical Implementations

°Integrated Circuits (ICs)•Combinational logic circuits, memory elements, analog interfaces.

°Printed Circuits (PC) boards•substrate for ICs and interconnection, distribution of CLK, Vdd, and GND signals, heat dissipation.

°Power Supplies•Converts line AC voltage to regulated DC low voltage levels.

°Chassis (rack, card case, ...) •holds boards, power supply, provides physical interface to user or other systems.

°Connectors and Cables.

The hardware out of which we make systems.

Page 43: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (43)

Review of Major Components

°Mouse ( mechanical, optical)

°Display (CRT, LCD)

°Motherboard

°Integrated Circuits (transistors, CMOS)

°CPU - controls memory, I/O, datapath according to instructions

°Datapath- performs arithmetic operations

Page 44: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (44)

Review of Major Components°Memory

•DRAM - Dynamic RAM - main memory

•SRAM - Static RAM- faster, more expensive

•Cache- fast buffer for main memory

•DIMM and SIMM - small boards that contain DRAM chips

•RAM, ROM, volatile, non-volatile, primary, secondary, magnetic disk, optical disks (CD, DVD), FLASH based

Page 45: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (45)

Memory Comparisons

°Main Memory vs. Disk

°Volatile Non Volatile

°Fast(electrical)Slower(mechanical)

°Expensive (100 * more) CheaperMemory AccessDRAM Disk

40 -80 nanoseconds 5- 15 milliseconds

10-9 10-3

(100,000 times faster)

Page 46: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (46)

Computer Technology - Dramatic Change!°Processor

•2X in speed every 1.5 years (since ‘85); 100X performance in last decade.

°Memory•DRAM capacity: 2x / 2 years (since ‘96); 64x size improvement in last decade.

°Disk•Capacity: 2X / 1 year (since ‘97)

•250X size in last decade.

Page 47: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (47)

Technology Trends: Processor Performance

0100200300400500600700800900

87 88 89 90 91 92 93 94 95 96 97

DEC Alpha 21264/600

DEC Alpha 5/500

DEC Alpha 5/300

DEC Alpha 4/266

IBM POWER 100

1.54X/yr

Intel P4 2000 MHz(Fall 2001)

We’ll talk about processor performance later on…

year

Performance measure

Page 48: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (48)

Technology Trends: Memory Capacity(Single-Chip DRAM)size

Year

Bit

s

1000

10000

100000

1000000

10000000

100000000

1000000000

1970 1975 1980 1985 1990 1995 2000

year size (Mbit)

1980 0.0625

1983 0.25

1986 1

1989 4

1992 16

1996 64

1998 128

2000 256

2002 512• Now 1.4X/yr, or 2X every 2 years.• 8000X since 1980!

Page 49: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (49)

Tech. Trends: Microprocessor Complexity

2X transistors/Chip Every 1.5 to 2.0 yearsCalled “Moore’s Law”

Page 50: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (50)

NetworksAdvantages

°Communication

°Resource Sharing

°Non-local access

Types

°LANs - Ethernet

°WANs

Page 51: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (51)

Computer Technology - Dramatic Change!

°State-of-the-art PC when you graduate: (at least…)•Processor clock speed: 5000 MegaHertz (5.0 GigaHertz)

•Memory capacity: 4000 MegaBytes (4.0 GigaBytes)

•Disk capacity: 2000 GigaBytes (2.0 TeraBytes)

•New units! Mega <= Giga, Giga <= Tera …

(Kilo, Mega, Giga, Tera, Peta, Exa, Zetta, Yotta = 1024)

Come up with a clever mnemonic, fame!

Page 52: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (52)

Technology in the News

°BIG•LaCie the first to offer consumer-level 1.6 Terabyte disk!

•$2,200

•Weighs 11 pounds!

°SMALL•Pretec is soon offering a 12GB CompactFlash card

•Size of a silver dollar

•Cost??

www.lacie.com/products/product.htm?

id=10129

www.engadget.com/entry/

4463693158281236/

Page 53: Based on slides from D. Patterson and cs152

Modified by S. J. Fritz Spring 2009 (53)

And in conclusion...°Continued rapid improvement in

Computing•2X every 1.5 years in processor speed; every 2.0 years in memory size; every 1.0 year in disk capacity; Moore’s Law enables processor, memory (2X transistors/chip/ ~ 1.5 or 2.0 yrs)

°5 classic components of all computers Control Datapath Memory Input Output

}Processor