⚠️ Please use a computer for the best experience

Cache Visualization

CS 233 · Step through C loop iterations and observe a 2-way set associative cache in real time

Cache Configuration (fixed)

Total size: 32 KB
Block size: 32 B
Associativity: 2-way
Sets: 512
Offset bits: 5
Index bits: 9
Tag bits: 18

Arrays: int A[100] at 0x0000 · int B[100] at 0x4000 · stride = 20 elements (80 B)

void optimize_me() {
    for (int i = 0; i < N; i += 20) {
        for (int j = 0; j < N; j += 20) {
            total_sum += A[i] * B[j];
        }
    }
}

Loop Controls

step = 20, N = 100
020406080
step = 20, N = 100
020406080

Current iteration: i=0, j=0

A[0]0x00000Set 0, Way 1, Tag 0COLD MISS
B[0]0x04000Set 0, Way 0, Tag 1COLD MISS
2
Accesses
0
Hits
2
Misses

Cache State 1 of 512 sets occupied

SetWay 0Way 1
0B[0]tag=1A[0]tag=0
A[ ] elementB[ ] elementHit (✓)Cold miss (↓ loaded)Active set

Access Log — all accesses up to current iteration

#ElementAddressSetWayTagResult
1A[0]0x00000010MISS
2B[0]0x04000001MISS