30 likes | 121 Views
Quiz3 - 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. Answer 2.
E N D
Quiz3 - 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.
Answer 2 • 16KB = 4K word = 1K blocks = 210 blocks, thus there are 10 index bits, each block is 16 bytes (128 bits) so there are 4 offset bits. This leaves 18 bits of tag. Add a valid bit for each block we have.1K*(128 + 18 + 1) = 147KBits = 18.4KB • If the cache is 4-way set associative the number of sets is 1K/4 = 256 = 28, thus there are only 8 index bits which means the tag is 20 bits. But there are still 1K block so the number of bits in the cache is:1K(128 + 20 + 1) = 149Kbits = 18.6KB
Answer 3, 4 • AMAT = (hit ratio * hit time) + (miss ratio * miss penalty)AMAT = 0.95*1 + (1-0.95) * AMAT of L2AMAT = 0.95 + 0.05*(0.92*4 + 0.08*12) = 1.182 • For the AMAT to be 1.0 the L1 hit ratio must be 100%. • The hit ratio for a 4 word block is 75% as each item is read once but reading an item brings in to the cache it’s following 3 items. i and sum are probably in registers so now memory isn’t accessed when they are read or written. • For every miss there are 7 hits. 7/8 = 87.5%