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
47% 1 Loads
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?
ginwah 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.