110 likes | 276 Views
Instruction Flow. CDA 3101 Discussion Session. Problem1. Show the path of the following program through the MIPS subset showing major functional units 68 loop : ADD $r1, $r2, $r3 72 LD $r1, 0($r2) 76 SW $r3, 8($r1) 80 BNZ $r3 loop Let initial values are $r1 = 0
E N D
Instruction Flow CDA 3101 Discussion Session
Problem1 Show the path of the following program through the MIPS subsetshowing major functionalunits 68 loop: ADD $r1, $r2, $r3 72 LD $r1, 0($r2) 76 SW $r3, 8($r1) 80 BNZ $r3 loop Let initial values are $r1 = 0 $r2 = 128 $r3 = 132 2
Problem1 68 loop: ADD $r1, $r2, $r3 72 LD $r1, 0($r2) 76 SW $r3, 8($r1) 80 BNZ $r3 loop 72 260 68 68 $r1 128 ADD $r1, $r2, $r3 132 $r2 $r3 3
Problem1 68 loop: ADD $r1, $r2, $r3 72 LD $r1, 0($r2) 76 SW $r3, 8($r1) 80 BNZ $r3 loop 76 23 72 72 $r1 LD $r1, 0($r2) 128 $r2 0 4 M[128] = 23
Problem1 68 loop: ADD $r1, $r2, $r3 72 LD $r1, 0($r2) 76 SW $r3, 8($r1) 80 BNZ $r3 loop 80 76 76 $r3 SW $r3, 8($r1) 31 $r1 132 8 5
Problem1 68 loop: ADD $r1, $r2, $r3 72 LD $r1, 0($r2) 76 SW $r3, 8($r1) 80 BNZ $r3 loop 68 80 80 $r3 BNZ $r3 loop 6
Problem2 Suppose we have two implementations of the same ISA. Computer A has clock cycle time of 200ps and a CPI of 1.5, while for computer B the corresponding values are 150ps and 2.5 respectively. Which of the two machines is faster and by how much? 7
Problem2 Let the number of instructions be I for the program. CPUA = I X 200 X 1.5 = 300 X I CPUB = I X 150 X 2.5 = 375 X I Therefore, A is faster Speedup = 375/300 = 1.25 8
Problem3 • The FPU of an unit performs 40% of the total computation, and it is being accelerated to twice the performance • What is the eventual speedup? • Amdahl’s Law 9
Problem3 Fraction Accelerated = 0.4 Improvement = 2 Speedup = 1/{(1-0.4)+0.4/2} = 1/0.8 = 1.25 10
Problem3 cont. • The FPU of an unit performs 40% of the total computation, and it is being accelerated to twice the performance; • The ALU performs 40% of the total computation and is being accelerated by three times; • What is the eventual speedup? • Speedup = 1/{(1-0.4-0.4)+0.4/2+0.4/3} 11