In Computer/컴퓨터구조

[컴퓨터구조] Instruction Count and CPI | 명령어 수와 CPI[+CPI(Throughput) 추가]

팽이리 2023. 3. 19. 09:29

Average CPI | 평균 CPI (Cycles Per Instruction)

  • CPU 하드웨어에 의해 결정된다.
  • 명령 혼합(Instruction mix)의 영향을 받는다.
  • 프로그램의 명령 개수(Instruction Count)는 프로그램, ISA 및 컴파일러에 의해 결정된다.

$$Clock Cycle=Instruction Count \times CPI(Cycles Per Instruction)$$

$$CPU Time=Instruction Count \times CPI  \times Clock Cycle Time$$

$$=  \frac{Instruction Count \times CPI}{Clock Rate}$$

 

참고사항

$$*Clock Cycle Time =  \frac{1}{Clock Rate} $$

 

CPI Example

컴퓨터 A : Cycle Time = 250ps, CPI = 2.0

컴퓨터 B : Cycle Time = 500ps, CPI = 1.2

  • Same ISA

어느 것이 얼마나 빠른가요?

$$CPU Time_A=Instruction Count \times CPI_A \times Cycle Time_A$$

$$=I \times 2.0 \times 250ps=I \times 500ps$$

$$CPU Time_B=Instruction Count \times CPI_B \times Cycle Time_B$$

$$=I \times 1.2 \times 500ps=I \times 600ps$$

$$ \frac{CPU Time_B}{CPU Time_A} = \frac{I \times 600ps}{I \times 500ps} =1.2$$

"A가 1.2배 더 빠르다."

CPI in more detail

만약 다른 명령 클래스들이 다른 수의 사이클을 필요로 한다
$$Clock Cycles= \sum_{i=1}^{n}{(CPI _i \times Instruction Coun_i) }$$


Cycles Per Instruction (Throughput) | CPI

"Cycles Per Instruction"

CPI = (CPU Time * Clock Rate) / Instruction Count

        = Cycles / Instruction Count

CPU time = Cycle Time $\times \sum_{j=1}^{n}{CPI _j \times I_j}$

 

“Instruction Frequency” 명령 주파수

CPI = $\times \sum_{j=1}^{n}{CPI _j \times F_j}$    where $F_j$ = $\frac{I_j}{Instruction Count}$

 

이해를 돕기 위한 그림

[Ex]

1초 1클락 = 1Hz,

1초 4클락 = 4Hz

 

$*\frac{1}{10^9}초=10^{-9}초=1ns$