1. Consider an L1 cache that has 8 sets, is direct-mapped (1-way), and supports
ID: 3814688 • Letter: 1
Question
1. Consider an L1 cache that has 8 sets, is direct-mapped (1-way), and supports a block size of 16 bytes. For the following memory access pattern (shown as byte addresses), show which accesses are hits and misses. For each hit, indicate the set that yields the hit. (20 points)
0, 8, 4, 12, 16, 260, 24, 30, 31, 36, 42, 48, 8, 4, 278.
2. A 64 KB L1 cache has a 128 byte block size and is 8-way set-associative. How many sets does the cache have? How many bits are used for the offset, index, and tag, assuming that the CPU provides 32-bit addresses? How large is the tag array? If you do not explain your steps, you will not receive partial credit for an incorrect answer. (20 points)
Explanation / Answer
Ans 1. Direct Mapped Cache: i=j modulo m
where i is the cache block location
j is the memory address
m is the number of sets in cache..=8
1. 0 is mapped to 0%8=0 set of cache. Hit
2. 8 is mapped to 0%8=0.As 0 set is already occupied by 0 address of memory so it is a miss.
3. 4 is mapped to 4.Hit
4.12 is mapped to 4.As 4 set of cache is occupied ..it is a Miss.
5.16 is mapped to 0.As 0 set is already occupied by 0 address of memory so it is a miss.
6.260 is mapped to 4 set of cache.As 260%8 =4. As 4 set of cache is occupied ..it is a Miss
7.24 is mapped to 0.As 0 set of cache is occupied ..it is a Miss
8.30is mapped to 30%8=6.Hit
9.31 is mapped to 31%8=7.Hit
10.36 is mapped to 36%8=4.Miss
11.42 is mapped to 2. Hit
12.48 is mapped to 0 Miss
13.8 is mapped to 0.Miss
14.4 s mapped to 4.Miss
15.278 is mapped to 6.Miss
Ans 2. Size of cache=64 KB=216 bytes
Number of blocks in 1 set=8 =23
Size of set=128 bytes=27
Number of sets=216/23 * 27
=216-10
=26 =64
Tag
Index
Offset
Number of bytes in each block=128 =27
So number of bits needed for offset=7 bits.
Number of sets=64 =26
So number of bits for index= 6 bits.
So size of tag= Size of memory address-(Size of index+Size of offset)
=32-(7+6)
= 32-13
=19 bits.
19
6
7
Size of tag array= 219
Tag
Index
Offset
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.