Professional Documents
Culture Documents
Lec-9 Memory-5 CompArch
Lec-9 Memory-5 CompArch
Memory
Part-5
CSE-2823
Computer Architecture
Dr. Md. Waliur Rahman Miah
Associate Professor, CSE, DUET
1
Today’s Topic
Memory
Ref:
Hennessy-Patterson 5e-Ch-5; 4e-Ch-7
Stallings 8e-Ch-4-5-6
Direct Mapped
Direct mapped 2-way Set Associative
Set associative Fully Associative
Fully associative
Block # 0 1 2 3 4 5 6 7 Set # 0 1 2 3
1 1 1
Tag Tag Tag
2 2 2
12 mod 8 = 4 12 mod 4 = 0
4 1
5 2
6 3
• Find the number of misses for a cache with four 1-word blocks given the
following sequence of memory block accesses:
0, 8, 0, 6, 8,
• for each of the following cache configurations
1. direct mapped
2. 2-way set associative (use LRU replacement policy)
3. fully associative
Cache contents after each reference – color indicates new entry added
0 miss Memory[0]
8 miss Memory[0] Memory[8]
0 hit Memory[0] Memory[8]
6 miss Memory[0] Memory[6]
8 miss Memory[8] Memory[6]
Cache contents after each reference – color indicates new entry added
0 miss Memory[0]
8 miss Memory[0] Memory[8]
0 hit Memory[0] Memory[8]
6 miss Memory[0] Memory[8] Memory[6]
8 hit Memory[0] Memory[8] Memory[6]
Cache contents after each reference – color indicates new entry added
Set
FIGURE 5.18
The implementation of a four-way set-associative cache requires four comparators and a 4-to-1 multiplexor.
The comparators determine which element of the selected set (if any) matches the tag. The output of the
comparators is used to select the data from one of the four blocks of the indexed set, using a multiplexor
Dr. Md. Waliur Rahman Miah Dept of CSE, DUET
with a decoded select signal.
Performance with Set-Associative Caches
15%
12%
9%
Miss rate
6%
3%
0%
One-way Two-way Four-way Eight-way
Associativity 1 KB 16 KB
2 KB 32 KB
4 KB 64 KB
8 KB 128 KB
Miss rates for each of eight cache sizes with increasing associativity:
data generated from SPEC92 benchmarks with 32 byte block size for all caches