Suppose we have a processor with a base CPI of 2.0, assuming all references hit
ID: 3621276 • Letter: S
Question
Suppose we have a processor with a base CPI of 2.0, assuming all references hit in the primary cache. The clock rate is 4 GHz. Assume the main memory access needs 125 ns, including all the miss handling. The miss rate per instruction at the primary cache is 2%.(a) What is the total CPI of this processor?
(b) If we add a level 2 cache (L2) which needs only 8 ns to access, it is observed that its local miss rate is 25%. The main memory access from L2 remains 125 ns. What is the total CPI now?
(c) What is the speedup achieved by the two-level design? (speedup = cpu time before improvement / cpu time after improvement).
Explanation / Answer
What's Given:
Base CPI: 2.0
Clock rate: 4 GHz
Main Memory Access time: 125 ns
Primary Cache Miss Rate: 2%
Time to Access Level 2 Cache: 8 ns
Miss Rate of Level 2 Cache: 25%
---------------------------------------------------
a) Total CPI of Processor = ?
Clk cycle time
= (t = 1/f)
= 1/4ghz
= 0.25 ns
Memory access clock count
= (Main Memory Access Time/ Clk Cycle Time)
= 125ns/0.25ns
= 500 clk
Executing 100 instructions with a 2% Miss Rate: 98 will be executed from primary cache consuming 2 clks execution time. The other 2 instructions will consume 500 clks for fecthing from memory and +2 clks to execute.
Total # of clks to execute 100 instructions =
= (# of passed instructions * Base CPI) + (# of missed instructions * Memory Access Clock Count) + (# of missed instructions * Base CPI)
= (98*2)+(2*500)+(2*2)
=196+1000+4
=1200 clks
CPI =
=(total number of clks to execute # instructions)/(# of instructions)
=(1200 clks/100 instructions)
= 12.0 CPI
-------------------------------------------------------------------------------------------------------------------------------
b) Total CPI with L2 Cache = ?
# of clks to fetch data from Main Memory Access
= [(Main Memory Access Time + Memory Access Time of Level 2 Cache)/Clk Cycle Time]
= [(125 ns + 8 ns)/0.25ns)]
= 532 clks
# of clks to fetch data from second level cache
= (Memory Access Time of Level 2 Cache / Clk Cycle Time)
= 8 ns/0.25 ns
= 32 clks
If we execute 200 instructions, 196 (98%) will be executed from primary memory with 2 clk execution time. 3 instructions (75%) will be executed from second level caches with 32 clks fetch time (and 2 clks for execution time for each instruction) and one instruction will be executed from main memory with fetch time of 532 clks (and 2 clks for execution)
Total # number of clks to execute 200 instructions:
= (# of passed instructions * Base CPI) + (# of L2 Cache instructions * L2 data fetch clk count) + (# of L2 Cache instructions * Base CPI) + (# of missed instructions * Main Memory fetch clk count) + (# of missed instructions * Base CPI)
=(196*2)+(3*32)+(3*2)+(1*532)+(1*2)
= 392 + 96 + 6 + 532 + 2
= 1028 clks
CPI =
= (total # of clocks/ # of instructions)
= 1028 clks/200 instructions
= 5.14 CPI
-------------------------------------------------------------------------------------------------------------------------------
c) speedup = ?
(speedup = cpu time before improvement / cpu time after improvement)
= 12 CPI /5.14 CPI
= 2.33
Hope that helps.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.