Consider two computer systems A and B. For A, a branch is implemented by two instructions:
Sub \$3, \$1, \$2 #\$3=\$1-\$2
Branch \$3, 300 #take the branch if \$3=0
For B, the compare is included in the branch instruction as in our MIPS architecture
Beq, \$1, \$2, 300
All other instructions of the two machines are the same and on both machines, the instructions take the same number of cycles. The instruction frequency of machine A is shown in the following table. Since in a single instruction, machine B has to test the condition as well as handle the branch, the cycle time of machine B is 25% longer than A.
Instruction type
% Clock cycle count ALU ops
21% 2 Stores
12% 2 Branches
20% 2
(1) What is CPI of A? CPI of B?
(2) Execution time of A?
(3) Execution time of B?
(4) Which one if faster? By how much?

2
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by ginwah

Hi Ginwah,

Sorry but you have to do a little better than that. Do you know what CPI is?

I know the first answer:
CPI of A = 0.47 + (2 x 0.21) + (2 x 0.12) + (2 x 0.2)
But what about CPI of B?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.