A processor is only as fast as the memory that feeds it, and caches decide how much of the delay it sees. The average memory access time calculator takes the hit time and miss rate of an L1 and an L2 cache, the main memory time, the references per instruction, the base CPI and the clock frequency, and gives the AMAT in cycles and nanoseconds, the time without the L2, the speed-up from the L2, the effective CPI and the share of memory stalls.
How the calculation works
- Enter the hit time and the miss rate of the L1 cache, then the hit time and the local miss rate of the L2 cache.
- Enter the main memory access time in cycles, the memory references per instruction, the base CPI and the clock frequency.
- The average memory access time is AMAT = t₁ + m₁ × (t₂ + m₂ × t_mem), where each miss rate is local to its level.
- Read the AMAT in cycles and nanoseconds, the time without the L2, the speed-up from the L2, the effective CPI and the share of the CPI lost to memory stalls.
Example
An L1 cache hits in 1 cycle and misses 5 % of the time. The L2 hits in 12 cycles and misses 20 % of its accesses, and main memory takes 200 cycles. The miss path costs 12 + 0.20 × 200 = 52 cycles, so AMAT = 1 + 0.05 × 52 = 3.6 cycles, or 1.2 ns at 3 GHz. Without the L2, AMAT would be 1 + 0.05 × 200 = 11 cycles, so the L2 gives a 3.06 × speed-up. With 1.3 references per instruction and a base CPI of 1.0, the effective CPI is 4.38, and 77.2 % of it is memory stalls.
Why it matters
The AMAT formula is the standard tool of computer architecture courses and design reviews for comparing cache designs. It shows quickly how a change in the miss rate or in the memory latency feeds through to the performance, and which level of the hierarchy is worth improving first.
Good to know
The model assumes blocking caches with no overlap between misses, a fixed number of cycles per level, and miss rates that do not depend on each other. Real processors hide some latency with out-of-order execution, prefetching and multiple outstanding misses, and miss rates change with the workload. Use the result as a first-order estimate, and measure the real program with counters.
Related tools
The bandwidth-delay product calculator covers latency and throughput in networks, the FPS and frame time calculator converts frame rates to times, the computer energy cost calculator prices power use, and the gaming PC cost calculator budgets a build.