# Answer 1 - PowerPoint PPT Presentation

1 / 5

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

#### Presentation Transcript

beq\$8,\$2,c2

bne\$8,\$3,End

End:…

The CPI is 7/11 = 0.63

Reordering doesn’t add anything in this case

• The CPI on a Multi-Cycle datapath is:15%*4 + 11%*5 + 61%*4 + 10%*3 + 3%*2 = 0.6 + 0.55 + 2.44 + 0.3 + 0.06 = 3.95

• On a 5 stage pipelined datapath the number of cycles the program is executed is 5 + 99*1 = 104. On the Multi-Cycle datapath 100 instructions take 395 cycles.

• The speedup is 395/104 = 3.79

• Answer 3: When more than one instruction in the same cycle needs the same unit and there is only one copy of it.

• For instance if there is only 1 multiplier and two multiplication instructions can be issued in the same cycle.

for(i=0;i<n;i++){

if(i%2==0)branch A

a[i]=a[i]*2;

sum = sum + a[i];

if(i%2==1)branch B

sum++;

}branch C

• Assuming that the first time a branch is encountered it is mispredicted then the misprediction rates are 100% for branches A and B and 2/n for branch C. Every iteration the predictions A and B are reversed.

• Adding a 2-level (2,1) BHT doesn’t change the rate of branch C but lowers the rates of A and B to 2/n as well.

• This is because B is taken if A isn’t and isn’t taken if A is. Ais taken if the former B was and isn’t taken if the former B wasn’t taken.

• CPI = 52%*1 + 16%*1 + 15%*(75%*2 + 25%*1) + 3%*2 + 14%*(20%*2 + 80%+1) =0.52 + 0.16 + 0.15*(1.75) + 0.06 + 0.14*(1.2) = 1.17

• Answer 6: We can’t perform two branches in the same cycle because they both might succeed. Which instruction changes the PC? But if both branch to the same PC it would be possible to execute them at the same cycle.

• For example the codeif(a==b || a==c)b++;could be translated to:beq \$a0,\$a1,L1beq\$a0,\$a2,L1…L1:addi \$a1,\$a1,1