41
Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology [email protected]

Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology [email protected]

Embed Size (px)

Citation preview

Page 1: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer OrganizationPerformance,

RISC and CISC

1

Department of Computer Science Missouri University of Science & Technology

[email protected]

Page 2: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Note, this unit will be covered in threelectures. In case you finish it earlier, thenyou have the following options:

1) Take the early test and start CS3889.module72) Study the supplement module

(supplement CS3889.module6)3) Act as a helper to help other students in

studying CS3889.module6Note, options 2 and 3 have extra credits as noted in courseoutline. 2

Computer Organization

Page 3: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Glossary of prerequisite topics

Familiar with the topics?No Review

CS3889.module6.background

Yes

Remedial actionYes

NoTake the Module

Take Test

Pass?

Glossary of topics

Familiar with the topics?Yes

Pass?

Take Test

Yes

Options

Lead a group of students in this module (extra credits)?

Study more advanced related topics (extra credits)?

Study next module?

No

{

Extra Curricular activities

Enforcement of background

{Current Module

At the end give a test, record the score, and impose remedial

action if not successful

No

Computer Organization

Page 4: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance MetricsResponse Time (Execution time, Latency) — The time

elapse between the start and the completion of an event.

Throughput (Bandwidth) — The amount of work donein a given time.

Performance — Number of events occurring per unit oftime.

4

Page 5: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance MetricsNote execution time is the reciprocal of

performance — lower execution time implieshigher performance.

Note Response time, Throughput, andPerformance are all closely related to eachother.

5

Page 6: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance MetricsA system (X) is faster than (Y), if for a

given task, the response time on X is lowerthan on Y.

6

Page 7: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance Metrics — Example

Machine A runs a program in 10 secondsand machine B runs the same program in 15seconds. Therefore:

Execution time BExecution time A

==n =( )15

101.5

7

Page 8: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance MetricsAverage Execution time — Equal probability of

running programs in the workload

∑=

n

iiTimen 1

1

8

Where Timei is the execution time of the ith program And n is the number of the program in the workload.

Page 9: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance MetricsWeighted Execution time — unequal mix of

programs in the workload

TimeWeight i

n

ii×∑

=1

9

where weighti is the frequency of the ith gram in the workload.

Note 11

=∑=

n

iiWeight

Page 10: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance MetricsMillion Instructions Per Second — MIPS is

another performance measure to be used toevaluate computers.

Execution time * 10MIPS = C

I

6

10

Page 11: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance MetricsMillion Floating Point Operations Per Second

— MFLOPSis another performance measure to be used toevaluate computers.

11

MFLOPS = Number of floating point operations in a program

Execution time * 106

Page 12: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance MetricsResponse Time (Elapse time) — The latency to

complete a task, including disk accesses,memory accesses, I/O activities, operatingsystem overhead, ...

12

Page 13: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance MetricsCPU time — The time the CPU is computing.

It is further divided into:User CPU time — The CPU time spent in the

program,

System CPU time — The CPU time spent inoperating system performing tasks requested by theprogram.

13

Page 14: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance MetricsThe processor of today's computer is driven by

a clock with a constant cycle time (τ).The inverse of the cycle time is the clock rate

(f).The size of a program is determined by its

instruction count (Ic) — number of the machineinstructions to be executed.

14

Page 15: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance MetricsLet us define the average number of clock

cycle per instruction (CPI) as:

15

Page 16: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance MetricsFor a given instruction set, one can calculate the

CPI over all instruction types, if the frequencies ofthe appearance of the instructions in the program isknown.CPI depends on the organization/architecture and

the instruction set of the machine.Clock rate depends on the technology and

organization/architecture of the machine.Instruction count depends on the instruction set of

the machine and compiler technology.

16

Page 17: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance MetricsCPU =

Time Clock cyclesCPU * Clock

Cycle tim e

RateClock

CPU =Time

Clock cyclesCPU

17

The CPU time is estimated as

Page 18: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance Metrics — ExampleIt takes 10 seconds to run a program on

machine A that has a 400 MHz clock rate.

We are intended to build a faster machine thatwill run this program in 6 seconds. However,machine B requires 1.2 times as many clockcycles as machine A for this program.Calculate the clock rate of machine B:

18

Page 19: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance Metrics — Example

19

ClockRatecleCPUClockCyCpuTime

A

AA=

SecondCycles

cleCPUClockCy A

106*40010 =

106*4000=cleCPUClockCy A

ClockRatecleCPUClockCyCPUTime

B

AB

*2.1=

MHzClockRateB 8006*4000*2.1 106

==

Page 20: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance Metrics — ExampleSuppose we have two implementation of the same

instruction set architecture. Computer A has a clockcycle time of 250 ps and a CPI of 2.0 for someprogram, and computer B has a clock cycle time of 500ps and a CPI of 1.2 for the same program.

Which computer is faster for this program?

20

Page 21: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance Metrics — ExampleWe know that both machines execute the same number of

instructions, say I.

Clearly A is faster than B.

21

CPU TimeA= CPUClockCyclesA * ClockCycleTimeA= I * 2.0 * 250 ps = 500 * I ps

CPU TimeB= CPUClockCyclesB * ClockCycleTimeB= I * 1.2 * 500 ps = 600 * I ps

Page 22: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance Metrics — Example Assume we have the following information for different classes

of operations:

Also assume the same code segment with different instructionmix:

Class A

Class B

Class C

CPI 1 2 3

Code Sequence Instruction CountsA B C

1 2 1 22 4 1 1 22

Page 23: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance Metrics — ExampleRefer to the previous example, which code is faster?CPUClockCycle1 = (2*1) + (1*2) + (2*3) = 10CPUClockCycle2 = (4*1) + (1*2) + (1*3) = 9So code sequence 2 is faster, however, note that code

sequence2 has more instructions than code sequence1.

23

Page 24: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance MetricsThe execution of an instruction requires

going through the instruction cycle. Thisinvolves the instruction fetch, decode,operand(s) fetch, execution, and storeresult(s):

24

Page 25: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Performance MetricsP is the number of processor cycles needed to

decode and execute the instruction, m is thenumber of the memory references needed, and kis the ratio between memory cycle time andprocessor cycle time, memory latency.

25

Page 26: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

QuestionWith respect to our earlier definition of

CPU time, discuss how the performance canbe improved?

26

Page 27: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

In response to this question, the CPU timecan be reduced either by reducing the ICand/or CPI.Note the performance improvement due to

the advances in technology to reduce τ isbeyond the scope of this discussion.

27

Page 28: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Two Design philosophiesIC can be reduced by increasing the

functionality of the system — increasing theinstruction set by allowing hardware supportfor more complex instructions.This design pattern results in the so-called

complex instruction set computer (CISC).

28

Page 29: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Two Design philosophiesCPI can be reduce by allowing hardware

support for just simple instructions.This design pattern results in the so-called

reduced instruction set computer (RISC).

29

Page 30: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Two Design philosophiesIn an effort to improve the performance one

design philosophy suggest complexity and theother suggest simplicity!

30

Page 31: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Complex Instruction Set ComputerIn general, Complex Instruction Set Computer

(CISC) supports:Relatively large instruction set containing some

complex and time consuming instructions.Large number of addressing modes.Large number of instruction formats.

31

Page 32: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Reduced Instruction Set ComputerFunctions should be kept simple unless there is a

very good reason to do otherwise.Micro instructions should not be faster than simple

instructions.Simple decoding and pipelined execution are more

important than program size.Compiler technology should be used to simplify

instructions rather than to generate complexinstructions.

32

Page 33: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

Reduced Instruction Set ComputerCommon RISC FeaturesOperations are register-to-register with only LOAD

and STORE instructions to access memory.The operations and addressing modes are reduced.Instruction formats are simple and do not cross word

boundaries.RISC branches avoid pipeline penalties.

33

Page 34: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

CISC CharacteristicsInstruction set usually larger than 100,Number of addressing modes supported is

usually larger than 4,Number of instruction formats supported in

usually larger than 4,Most instructions require multiple cycles for

execution,

34

Page 35: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

CISC CharacteristicsSupport of memory-to-memory model of

execution,Existence of special purpose registers,Micro-programmed control unit, andMachine instructions at a relatively high

level, which is close to the level of highlevel language statements.

35

Page 36: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

RISC CharacteristicsMost instructions require single cycle for

execution,Memory is accessed just through LOAD and

STORE instructions,Hardwired control unit,Supports relatively few instruction formats and

addressing modes,

36

Page 37: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

RISC CharacteristicsFixed instruction length format,Highly pipelined instruction cycle,Large number of on chip registers,Instruction set is targeted for a specific

application, andUse of co-processor for complex operations

requiring hardware support.

37

Page 38: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

RISC vs. CISCRISC allows performance improvement

through careful design of the data path, pipelineand other CPU resources.RISC offers fewer clock cycles per instruction.RISC is more suitable for current technology.RISC might imply specialization.

38

Page 39: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

RISC vs. CISCFor the same program RISC requires larger

assembly code than CISC.From software reliability point of view, RISC

has a disadvantage.

39

Page 40: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

RISC vs. CISCBack to our original question — based on the

equation

40

what is a better design philosophy, RISC or CISC?

Page 41: Computer Organization - Dr. Ali R. Hurson · Computer Organization Performance, RISC and CISC 1 Department of Computer Science Missouri University of Science & Technology hurson@mst.edu

Computer Organization

QuestionsTrue or False: shorter length instructions imply

faster processor (why)?Length of the operation code affects the length

of the instructions. Define two schemes whichallows one to reduce the length of the op-code.Name and explain different factors which affect

the length and format of an instruction.

41