A CPU generates 32-bit virtual addresses. The page size is 4 KB. The p...
Size of a page = 4KB = 2^12 Total number of bits needed to address a page frame = 32 - 12 = 20 If there are ‘n’ cache lines in a set, the cache placement is called n-way set associative. Since TLB is 4 way set associative and can hold total 128 (2^7) page table entries, number of sets in cache = 2^7/4 = 2^5. So 5 bits are needed to address a set, and 15 (20 - 5) bits are needed for tag.
View all questions of this test
A CPU generates 32-bit virtual addresses. The page size is 4 KB. The p...
TLB Overview
The translation look-aside buffer (TLB) is a hardware cache used by the CPU to improve the speed of virtual address translation. It stores a subset of the page table entries (PTEs) that map virtual addresses to physical addresses.
Given parameters
- CPU generates 32-bit virtual addresses
- Page size = 4 KB
- TLB can hold 128 PTEs
- TLB is 4-way set associative
Formula to calculate TLB tag size
The tag size of the TLB can be calculated using the following formula:
tag size = virtual address size - page offset size - log2(number of entries in the TLB)
Page offset size
The page offset size is determined by the page size. In this case, the page size is 4 KB, which is equivalent to 2^12 bytes. Therefore, the page offset size is 12 bits.
Number of entries in the TLB
The TLB can hold 128 PTEs, and it is 4-way set associative. Therefore, there are 32 sets in the TLB, and each set contains 4 PTEs.
Calculating the tag size
Using the formula above, we can calculate the TLB tag size as follows:
tag size = 32 - 12 - log2(128/4)
tag size = 32 - 12 - log2(32)
tag size = 32 - 12 - 5
tag size = 15
Therefore, the minimum size of the TLB tag is 15 bits (option C).