Cache Memory Calculator
The address splits into tag, set index and block offset: a 32 KB 4-way cache with 64 B blocks on a 32-bit address uses 19 tag bits, 7 index bits and 6 offset bits.
19
- Set index bits
- 7
- Block offset bits
- 6
- Cache lines (blocks)
- 512
- Sets
- 128
- Lines per set
- 4
- Address split
- 19 | 7 | 6 (tag | index | offset)
- Tag directory size
- 10240 bits
- Tag directory size
- 1280 bytes
Step-by-step solution
- Offset = log₂(block) = log₂(64) = 6
- Lines = cache ÷ block = 512; sets = lines ÷ k = 128; index = log₂(sets) = 7
- Tag = address − index − offset = 32 − 7 − 6 = 19
Cache Memory Formula
tag = address bits − log₂(sets) − log₂(block)
lines = cache ÷ block, sets = lines ÷ k
Worked Example
A 32-bit address, 32 KB 4-way set-associative cache with 64-byte blocks:
- Offset = log₂(block) = log₂(64) = 6
- Lines = cache ÷ block = 512; sets = lines ÷ k = 128; index = log₂(sets) = 7
- Tag = address − index − offset = 32 − 7 − 6 = 19
Block offset bits: 6 · Cache lines (blocks): 512 · Sets: 128 · Lines per set: 4 · Address split: 19 | 7 | 6 (tag | index | offset) · Tag directory size: 10240 bits · Tag directory size: 1280 bytes
GATE tip
Write the split as tag | index | offset and check the bits add up to the address size. Most GATE cache questions are this one calculation plus the tag-directory size.
More Computer Organization and Architecture Calculators
-
Average Memory Access Time Calculator
AMAT = t₁ + (1 − h₁)[t₂ + (1 − h₂)tₘ]
hierarchical access; simultaneous: h₁t₁ + (1 − h₁)h₂t₂ + …
Example: A 1 ns cache with a 95 % hit rate in front of 100 ns memory: Average memory access time = 6 ns.
-
Pipeline Speedup Calculator
T = (k + n − 1) × clock, clock = max stage + latch
speedup = n × Σ stages ÷ T
Example: Five stages of 150, 120, 160, 140 and 130 ns with 10 ns latches, 100 instructions: Speedup = 3.959276018.
-
Amdahl’s Law Calculator
S = 1 ÷ [(1 − p) + p/s]
p fraction improved, s its speedup; limit 1/(1 − p)
Example: 80 % of a program made 8 times faster: Overall speedup = 3.333333333.
Frequently asked questions
How does associativity change the tag?
Doubling the ways halves the number of sets, removing one index bit and adding one tag bit. Fully associative caches have no index bits.
What goes into the tag directory size?
Each line stores its tag plus control bits (valid, often dirty and replacement bits): size = lines × (tag + extra bits).
Sources
Last reviewed: . Factors are stored exactly and computed with 50-digit decimal arithmetic. See how we verify conversion factors.
Cite this page
APA
Scientific Converters. (2026, October 15). Cache Memory Calculator. Retrieved October 25, 2026, from https://scientificconverters.com/calculators/cache-memory-calculator/
IEEE
Scientific Converters, "Cache Memory Calculator," scientificconverters.com. Accessed: Oct. 25, 2026. [Online]. Available: https://scientificconverters.com/calculators/cache-memory-calculator/