Skip to content
Omnikalc

Average memory access time calculator: how much does the cache really speed up memory?

Enter the hit times and miss rates of two cache levels and the memory time to get the AMAT, the effect of the L2 cache and the effective CPI.

Updated on
Your inputs
cycles

Value out of range

%

Value out of range

cycles

Value out of range

%

Value out of range

cycles

Value out of range

Value out of range

Value out of range

GHz

Value out of range

Results

Average memory access time

3.60 cycles

Average memory access time in nanoseconds
1.200 ns
Time without the L2 cache
11.00 cycles
Speed-up of memory access from the L2 cache
3.06 ×
Effective CPI with memory stalls
4.38
Share of the CPI spent on memory stalls
77.2 %
The program is limited by memory more than by the processor

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.

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.

Frequently asked questions

What is the average memory access time?

It is the mean time a processor spends on a memory access, weighted by how often the access hits or misses each level of the cache. A hit in the first level is fast, and a miss sends the access to the next level, with more delay at each step. AMAT sums these delays with their probabilities.

What is a local miss rate?

It is the share of the accesses reaching a cache level that miss at that level. The global miss rate of the L2 is the L1 miss rate times the L2 local miss rate. In the formula, each term uses the local rate, because it multiplies the cost of going on to the next level only for the accesses that arrive there.

How can I lower the AMAT?

You can cut the hit time with a smaller and simpler cache, cut the miss rate with a larger cache, higher associativity or better prefetching, and cut the miss penalty with a faster memory, a bigger L2 or an extra level. The terms trade off, since a bigger cache usually has a longer hit time.

Why is the CPI so much higher than the base?

Each instruction makes at least one memory reference, and a fraction of them miss and stall the pipeline. The stall cycles per instruction equal the references per instruction times the L1 miss rate times the miss penalty. Out-of-order execution and non-blocking caches hide some of this, so the real stall is often smaller.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.