A CPU generates 32-bit virtual addresses. The page size is 4 KB. The processor…
2016
A CPU generates 32-bit virtual addresses. The page size is 4 KB. The processor has a translation look-aside buffer (TLB) which can hold a total of 128 page table entries and is 4-way set associative. The minimum size of the TLB tag is:
Answer: C. 15 bits — For any set-associative addressing structure - a cache or a TLB - the address first splits into an offset (the bits needed to select a byte within one page or…
- A.
11 bits
- B.
13 bits
- C.
15 bits
- D.
20 bits
Attempted by 189 students.
Show answer & explanation
Correct answer: C
For any set-associative addressing structure - a cache or a TLB - the address first splits into an offset (the bits needed to select a byte within one page or block, sized log2(page/block size)) and a page/block number. When the structure holds S sets, that page/block number further splits into an index of log2(S) bits, which selects the set, and a tag - the remaining upper bits - which identifies which resident entry within that set the address belongs to. The number of sets S equals the total entries divided by the associativity (number of ways).
The page size is 4 KB = 2^12 bytes, so the offset is 12 bits.
The virtual address is 32 bits, so the virtual page number (VPN) is 32 - 12 = 20 bits.
The TLB holds 128 entries at 4-way associativity, so the number of sets is 128 / 4 = 32.
The index needs log2(32) = 5 bits to select one of the 32 sets.
The tag is the remaining VPN bits: 20 - 5 = 15 bits.
Check: offset (12) + index (5) + tag (15) = 32 bits, exactly the virtual address width; and 32 sets x 4 ways = 128 entries, matching the given TLB size. So the minimum TLB tag size is 15 bits.
A video solution is available for this question — log in and enroll to watch it.
Explore the full course: Iocl Engineers Officers Grade A Paper 2