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.
A CPU generates 32-bit virtual addresses. The page size is 4 KB. The p...
Solution:
Given:
Virtual address size = 32 bits
Page size = 4 KB = 2^12 bytes
TLB size = 128 entries
Set associativity = 4-way
To determine the minimum size of the TLB tag, we need to calculate the number of bits required for the page offset and the page number.
Page Offset:
The page offset is the number of bits required to represent the byte offset within a page. Since the page size is 4 KB, which is 2^12 bytes, the page offset requires 12 bits.
Page Number:
The page number is the number of bits required to represent the virtual page number. Since the virtual address size is 32 bits, and the page size is 4 KB, the number of bits required for the page number can be calculated as follows:
Number of bits for page number = 32 - 12 = 20 bits
Associativity:
The TLB is 4-way set associative, which means that each set in the TLB contains 4 page table entries. Therefore, the number of sets in the TLB can be calculated as follows:
Number of sets in TLB = TLB size / Associativity = 128 / 4 = 32
Tag size:
To determine the tag size, we need to subtract the number of bits required for the page offset and page number from the total number of bits in the virtual address, and then divide by the number of sets in the TLB. The formula for calculating the tag size is:
Tag size = (Virtual address size - Page offset - Number of bits for page number) / Number of sets in TLB
Substituting the values, we get:
Tag size = (32 - 12 - 20) / 32 = 15 / 32 = 0.46875
Since the tag size has to be an integer value, we need to round up to the nearest integer. Therefore, the minimum size of the TLB tag is 15 bits.
Therefore, option C is the correct answer.