Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
COMPUTERORGANIZATION ANDDESIGN
The Hardware/Software Interface
CIS 273:
Computer
Organization and
Design
Chapter 2 — Instructions: Language of the Computer — 2
Administrivia
n Midterm – 02/15/2023
§2.1 Introduction
Chapter 1 — Computer Abstractions and Technology — 3
Relative Performance
n Define Performance = 1/Execution Time
n “X is n time faster than Y”
n== XY
YX
time Executiontime Execution
ePerformancePerformanc
n Example: time taken to run a program
n 10s on A, 15s on B
n Execution TimeB / Execution TimeA
= 15s / 10s = 1.5
n So A is 1.5 times faster than B
Chapter 1 — Computer Abstractions and Technology — 4
Measuring Execution Time
n Elapsed time
n Total response time, including all aspects
n Processing, I/O, OS overhead, idle time
n Determines system performance
n CPU time
n Time spent processing a given job
n Discounts I/O time, other jobs’ shares
n Comprises user CPU time and system CPU
time
n Different programs are affected differently by
CPU and system performance
Chapter 1 — Computer Abstractions and Technology — 5
CPU Time
n Performance improved by
n Reducing number of clock cycles
n Increasing clock rate
n Hardware designer must often trade off clock
rate against cycle count
Rate Clock
Cycles Clock CPU
Time Cycle ClockCycles Clock CPUTime CPU
=
´=
Chapter 1 — Computer Abstractions and Technology — 6
CPU Time Example
n Computer A: 2GHz clock, 10s CPU time
n Designing Computer B
n Aim for 6s CPU time
n Can do faster clock, but causes 1.2 × clock cycles
n How fast must Computer B clock be?
4GHz
6s
1024
6s
10201.2Rate Clock
10202GHz10s
Rate ClockTime CPUCycles Clock
6s
Cycles Clock1.2
Time CPU
Cycles ClockRate Clock
99
B
9
AAA
A
B
B
B
=
´
=
´´
=
´=´=
´=
´
==
Chapter 1 — Computer Abstractions and Technology — 7
Instruction Count and CPI
n Instruction Count for a program
n Determined by program, ISA and compiler
n Average cycles per instruction
n Determined by CPU hardware
n If different instructions have different CPI
n Average CPI affected by instruction mix
Rate Clock
CPICount nInstructio
Time Cycle ClockCPICount nInstructioTime CPU
nInstructio per CyclesCount nInstructioCycles Clock
´
=
´´=
´=
Chapter 1 — Computer Abstractions and Technology — 8
CPI Example
n Computer A: Cycle Time = 250ps, CPI = 2.0
n Computer B: Cycle Time = 500ps, CPI = 1.2
n Same ISA
n Which is faster, and by how much?
1.2
500psI
600psI
ATime CPU
BTime CPU
600psI500ps1.2I
BTime CycleBCPICount nInstructioBTime CPU
500psI250ps2.0I
ATime CycleACPICount nInstructioATime CPU
=
´
´
=
´=´´=
´´=
´=´´=
´´=
A is faster…
…by this much
Chapter 1 — Computer Abstractions and Technology — 9
CPI in More Detail
n If different instruction classes take different
numbers of cycles
å
=
´=
n
1i
ii )Count nInstructio(CPICycles Clock
n Weighted average CPI
å
=
÷
ø
ö
ç
è
æ ´==
n
1i
i
i Count nInstructio
Count nInstructioCPI
Count nInstructio
Cycles ClockCPI
Relative frequency
n Consider two different implementations of the same instruction set
architecture. The instructions can be divided into two classes according to
their CPI (class A, class B). P1 with a clock rate of 3 GHz and CPIs of 1 and
4 and P2 with a clock rate of 4 GHz and CPIs of 3 and 2.
n Given a program with a dynamic instruction count of 1.000.000 instructions
divided into classes as follows: 40% class A, 60% class B. Answer based on
the solution of the following questions.
n What are the CPIs of each implementation?
Chapter 1 — Computer Abstractions and Technology — 10
n Class A: 4 × 105 instr
n Class B: 6 × 105 instr
Chapter 1 — Computer Abstractions and Technology — 11
n CPI (P1) = 0.4 * 1 + 0.6 * 4 = 2.8
Chapter 1 — Computer Abstractions and Technology — 12
n Total Time P1 = (4 x 105 x 1 + 6 x 105 x 4)
/ (3 x 109) s
n = (28/3) x 10-4 s
n = 9.33 x 10-4 s
n CPI (P1) = 9.33 x 10-4 x 3 x 109/106 = 2.79
Chapter 1 — Computer Abstractions and Technology — 13
Rate Clock
CPICount nInstructio
Time Cycle ClockCPICount nInstructioTime CPU
nInstructio per CyclesCount nInstructioCycles Clock
´
=
´´=
´=
n CPI (P2) = 0.4 * 3 + 0.6 * 2 = 2.4
Chapter 1 — Computer Abstractions and Technology — 14
n Total Time P2 = (4 x 105 x 3 + 6 x 105 x 2)
/ (4 x 109) s
n = (24/4) x 10-4 s
n = 6 x 10-4 s
n CPI (P2) = 6 x 10-4 x 4 x 109/106 = 2.4
Chapter 1 — Computer Abstractions and Technology — 15
Rate Clock
CPICount nInstructio
Time Cycle ClockCPICount nInstructioTime CPU
nInstructio per CyclesCount nInstructioCycles Clock
´
=
´´=
´=
Chapter 1 — Computer Abstractions and Technology — 16
Relative Performance
n Define Performance = 1/Execution Time
n “X is n time faster than Y”
n== XY
YX
time Executiontime Execution
ePerformancePerformanc
n Example: time taken to run a program
n 9.33 x 10-4 s on P1, 6 x 10-4 s P2
n Execution TimeP1 / Execution TimeP2
= 9.33 / 6 = 1.55
n So P2 is ~1.55 times faster than P1