Processor Performance

Answer & solution
Official answer: 3.0
Multiply each class count by its cycles per instruction before adding. Branches use 2·2.25×108=4.5×108 cycles; loads use 5·1.20×108=6.0×108; stores use 4·1.65×108=6.6×108; arithmetic uses 3·1.30×108=3.9×108. Total cycles are (4.5+6.0+6.6+3.9)×108=2.1×109.
CPU time equals total cycles times cycle duration, so T_cycle=6.3/(2.1×109)=3×10−9 seconds=3.0 ns. Equivalently, the instruction-count-weighted average CPI is 2.1×109/(6.4×108)=3.28125, leading to the same result. A simple arithmetic average of the four CPIs would be incorrect because the instruction counts differ. The corresponding clock frequency is approximately 333.33 MHz, a useful unit check. Answer: 3.0.


![Question 64, GATE 2004: A CPU has user registers R1,R2,R3. Program in order (operation; instruction size in words): MOV R1,5000 (R1←Memory[5000];2); MOV R2,(R1) (R2←Memory[R1];1); ADD R2,R3 (R2←R2+R3;1); MOV 6000,R2 (Memory[6000]←R2;2); HALT (machine halts;1). Each register/memory transfer costs 3 cycles, register ADD costs 1 cycle, and instruction fetch/decode costs 2 cycles per word. What is the total execution-cycle count?
Options:
(A) 29
(B) 24
(C) 23
(D) 20](../../../assets/questions/CS-2004-Q64-1.webp)
![Question 64, GATE 2004: A CPU has user registers R1,R2,R3. Program in order (operation; instruction size in words): MOV R1,5000 (R1←Memory[5000];2); MOV R2,(R1) (R2←Memory[R1];1); ADD R2,R3 (R2←R2+R3;1); MOV 6000,R2 (Memory[6000]←R2;2); HALT (machine halts;1). Each register/memory transfer costs 3 cycles, register ADD costs 1 cycle, and instruction fetch/decode costs 2 cycles per word. What is the total execution-cycle count?
Options:
(A) 29
(B) 24
(C) 23
(D) 20](../../../assets/questions/CS-2004-Q64-2.webp)
![Question 64, GATE 2004: A CPU has user registers R1,R2,R3. Program in order (operation; instruction size in words): MOV R1,5000 (R1←Memory[5000];2); MOV R2,(R1) (R2←Memory[R1];1); ADD R2,R3 (R2←R2+R3;1); MOV 6000,R2 (Memory[6000]←R2;2); HALT (machine halts;1). Each register/memory transfer costs 3 cycles, register ADD costs 1 cycle, and instruction fetch/decode costs 2 cycles per word. What is the total execution-cycle count?
Options:
(A) 29
(B) 24
(C) 23
(D) 20](../../../assets/questions/CS-2004-Q64-3.webp)

