Download
quiz1 answer 1 n.
Skip this Video
Loading SlideShow in 5 Seconds..
Quiz1 - Answer 1 PowerPoint Presentation
Download Presentation
Quiz1 - Answer 1

Quiz1 - Answer 1

93 Views Download Presentation
Download Presentation

Quiz1 - Answer 1

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Quiz1 - Answer 1 • The CPI (Cycles Per Instruction) for the first program is the sum of the frequency of each instruction type multiplied by the instruction type:0.17*7 + 0.63*4 + 0.10*12 + 0.10*3 = 5.21 • For the second program the CPI is 1 as each and every instruction takes 1 cycle. • The 1st instructions completes in 8ns, the 2nd in 10ns, the 3rd in 12ns, and the 4th in 14ns. So the speedup is:28ns/14ns = 2.0 • 1000 instructions complete in: 8ns + 999*2ns = 2006nsThe speedup is 7000ns/2006ns ~ 3.5 Quiz1 - Answer 2

  2. Quiz1 - Answer 3 • The instruction after beq can’t be fetched until the result of the comparison is known. It might be add or it might be subi. This is called a controlhazard. • A solution is to stall the pipeline (not fetch more instructions) until the branch is resolved. Another solution is to predict the branch is taken and fetch the subi instruction. If the prediction is wrong ... • The control line PCsrc, which controls which is the next instruction to fetch is dependent on: • The opcode of the instruction. • The value of the ALU zero line (if a branch is being performed) • The value of the Interrupt line. Quiz1 - Answer 4