Associative Caches

지드래곤드래밥·2025년 12월 5일

Fully Associative Cache

▪ Allow a given block to go in any cache entry (Any block to any line)
어떤 메모리 블록이든 캐시의 어느 자리(line)에도 저장될 수 있다

▪ More flexible, and reduces miss rate
유연해서 miss rate(미스율)이 낮아진다

▪ Requires all entries to be searched at once
모든 캐시 엔트리를 한 번에 비교해야 한다.

▪ Comparator per entry: expensive
엔트리마다 비교기(comparator)가 필요 → 비쌈


Set Associative Cache

▪ Divides the cache into sets
캐시를 여러 개의 '세트(set)'로 나눈다

▪ Each set contains M entries (M-way set)
각 세트(set)에 M개의 엔트리가 존재한다

▪ A block maps to a specific set but can occupy any line within that set
메모리 블록은 특정 세트에만 들어갈 수 있지만, 그 세트 안에서는 아무 라인이나 가능

▪ Search all entries in a given set at once
그 세트 안의 엔트리들만 비교하면 됨 → 전체 탐색보다 저렴

▪ M comparators (less expensive)
비교기가 M개만 필요하여 비용이 낮음


방식블록이 갈 수 있는 위치비교해야 하는 tag 개수장점단점
Direct-mapped딱 1곳1개빠르고 싸다충돌 많음
Set-associative한 set 안 여러 곳set 크기만큼유연 + 효율적당한 비용
Fully associative어디든 가능전체 라인miss 거의 없음가장 비싸고 복잡

방식Set 수Set당 line 수(way)저장 위치 자유도장점단점
1-way (Direct mapped)81매우 낮음빠름/저렴충돌 많음
2-way42증가적절한 성능비용 증가
4-way24더 증가miss rate 낮음비교회로 비쌈
8-way (Fully associative)18최고miss rate 최소가장 비싸고 느림

0개의 댓글