1Module 5: CPU How the CPU executes instructions Each CPU has its own instruction set Instructions...

8
1 Module 5: CPU Module 5: CPU How the CPU executes How the CPU executes instructions instructions Each CPU has its own instruction set Each CPU has its own instruction set Instructions are fundamental operations such as addition, Instructions are fundamental operations such as addition, load/save, branch load/save, branch Each instruction is represented by 0-1 string of a word length, Each instruction is represented by 0-1 string of a word length, must be load from memory to register before execution. must be load from memory to register before execution. Four steps performed for each instruction execution Four steps performed for each instruction execution Fetch, decode, execute, store Fetch, decode, execute, store Machine cycle Machine cycle Machine cycle: the amount of time needed to execute an Machine cycle: the amount of time needed to execute an instruction instruction Instruction time Instruction time Execution time Execution time Personal computers execute in less than one millionth of a second Personal computers execute in less than one millionth of a second Supercomputers execute in less than one trillionth of a second Supercomputers execute in less than one trillionth of a second System clock synchronizes the execution of a program, one System clock synchronizes the execution of a program, one instruction after another. instruction after another.

Transcript of 1Module 5: CPU How the CPU executes instructions Each CPU has its own instruction set Instructions...

Page 1: 1Module 5: CPU How the CPU executes instructions Each CPU has its own instruction set Instructions are fundamental operations such as addition, load/save,

11Module 5: CPUModule 5: CPU

How the CPU executes instructionsHow the CPU executes instructions

Each CPU has its own instruction setEach CPU has its own instruction set Instructions are fundamental operations such as addition, load/save, branchInstructions are fundamental operations such as addition, load/save, branch Each instruction is represented by 0-1 string of a word length, must be load Each instruction is represented by 0-1 string of a word length, must be load

from memory to register before execution. from memory to register before execution.

Four steps performed for each instruction executionFour steps performed for each instruction execution Fetch, decode, execute, storeFetch, decode, execute, store

Machine cycleMachine cycle Machine cycle: the amount of time needed to execute an instructionMachine cycle: the amount of time needed to execute an instruction

Instruction timeInstruction timeExecution timeExecution time

Personal computers execute in less than one millionth of a secondPersonal computers execute in less than one millionth of a second Supercomputers execute in less than one trillionth of a secondSupercomputers execute in less than one trillionth of a second

System clock synchronizes the execution of a program, one instruction System clock synchronizes the execution of a program, one instruction after another. after another.

Page 2: 1Module 5: CPU How the CPU executes instructions Each CPU has its own instruction set Instructions are fundamental operations such as addition, load/save,

22Module 5: CPUModule 5: CPU

The machine cycleThe machine cycle

Page 3: 1Module 5: CPU How the CPU executes instructions Each CPU has its own instruction set Instructions are fundamental operations such as addition, load/save,

33Module 5: CPUModule 5: CPU

Time for executing an instructionTime for executing an instructionInstruction timeInstruction time

Control unit gets instruction from memory and puts it into a Control unit gets instruction from memory and puts it into a registerregister

Control unit decodes instruction and determines the memory Control unit decodes instruction and determines the memory location of needed datalocation of needed data

Execution timeExecution time Control unit moves data from register to ALU, which does the Control unit moves data from register to ALU, which does the

computation on the datacomputation on the data Control unit stores result of operation in memory or in a registerControl unit stores result of operation in memory or in a register

Fetch Decode execute store

one instruction time Next instruction

Clock cycle time

Page 4: 1Module 5: CPU How the CPU executes instructions Each CPU has its own instruction set Instructions are fundamental operations such as addition, load/save,

44Module 5: CPUModule 5: CPU

MicroprocessorMicroprocessorA CPU etched on silicon chipA CPU etched on silicon chip

Contain tens of millions of tiny transistorsContain tens of millions of tiny transistors Transistors: electronic switches that may or may not allow Transistors: electronic switches that may or may not allow

electric current to pass throughelectric current to pass through

New technology makes the size of a transistor smaller and New technology makes the size of a transistor smaller and smaller! smaller!

Current: 0.13 micro meter or 130 nano meterCurrent: 0.13 micro meter or 130 nano meterMoving to 0.09 micro meter 90 nano meterMoving to 0.09 micro meter 90 nano meterNext a few years: 60 nano meters Next a few years: 60 nano meters

a

bc

b = 1, a and c are connected, ONb = 0, a and c are disconnected, OFF

Page 5: 1Module 5: CPU How the CPU executes instructions Each CPU has its own instruction set Instructions are fundamental operations such as addition, load/save,

55Module 5: CPUModule 5: CPU

Types of chipsTypes of chips

Intel makes a family of processorsIntel makes a family of processors Pentium III and Pentium4 processors in most PCsPentium III and Pentium4 processors in most PCs Celeron processor sold for low-cost PCsCeleron processor sold for low-cost PCs Xeon and Itanium for high-end workstations and Xeon and Itanium for high-end workstations and

network serversnetwork servers

Other processorsOther processors Cyrix and AMD make Intel-compatible Cyrix and AMD make Intel-compatible

microprocessorsmicroprocessors PowerPC chips used primarily in Macintosh PowerPC chips used primarily in Macintosh

computerscomputers Compaq’s Alpha microprocessor used in high-end Compaq’s Alpha microprocessor used in high-end

serversservers

Page 6: 1Module 5: CPU How the CPU executes instructions Each CPU has its own instruction set Instructions are fundamental operations such as addition, load/save,

66Module 5: CPUModule 5: CPU

Microprocessor speedsMicroprocessor speeds

Measure of system clock speed Measure of system clock speed How many electronic pulses the clock produces per How many electronic pulses the clock produces per

second (clock frequency)second (clock frequency) Usually expressed in frequencyUsually expressed in frequency

Gigahertz (GHz), Megahertz (MHz), Kilohertz (KHz)Gigahertz (GHz), Megahertz (MHz), Kilohertz (KHz) Or how much time for each cycle: clock cycle timeOr how much time for each cycle: clock cycle time

clock cycle time = 1 / clock frequency clock cycle time = 1 / clock frequency Second, millisecond, microsecond, nanosecond,Second, millisecond, microsecond, nanosecond, picoseconds picoseconds

Comparison of clock speed only meaningful Comparison of clock speed only meaningful between identical microprocessorsbetween identical microprocessors

Page 7: 1Module 5: CPU How the CPU executes instructions Each CPU has its own instruction set Instructions are fundamental operations such as addition, load/save,

77Module 5: CPUModule 5: CPU

Other performance measuresOther performance measures

Millions of Instructions per Second (MIPS)Millions of Instructions per Second (MIPS) High-speed personal computers can perform High-speed personal computers can perform

over 500 MIPSover 500 MIPS Typically a more accurate measure of Typically a more accurate measure of

performance than clock speedperformance than clock speed

Megaflop: one million floating-point Megaflop: one million floating-point operationsoperations Measures ability of computer to perform Measures ability of computer to perform

complex mathematical operationscomplex mathematical operations

Page 8: 1Module 5: CPU How the CPU executes instructions Each CPU has its own instruction set Instructions are fundamental operations such as addition, load/save,

88Module 5: CPUModule 5: CPU

CacheCache

A temporary storage A temporary storage areaarea Speeds up data Speeds up data

transfer within computertransfer within computer

Control Unit

ALU

Registers

Memory

CPU

Cache L1

Cache L2

Secondarystorage