Question

A computer system implements a 40-bit virtual address, page size of 8 kilobytes, and a 128-entry translation look-aside buffer (TLB) organized into 32 sets each having four ways. Assume that the TLB tag does not store any process id. The minimum length of the TLB tag in bits is _____.

Official answer and solution
Official answer
22
From
Official GATE 2015 answer key

Solution

Decompose the virtual address into Page Offset, TLB Set Index, and TLB Tag fields.

  1. Virtual Address breakdown:
  • Total virtual address size = 40 bits.
  • Page size = 8 KB=8×210 bytes=213 bytes8\text{ KB} = 8 \times 2^{10}\text{ bytes} = 2^{13}\text{ bytes}.
  • Page offset field = 13 bits.
  • Virtual Page Number (VPN) = 40−13=2740 - 13 = 27 bits.
  1. TLB organization:
  • Total entries = 128.
  • Ways per set = 4.
  • Number of sets = 1284=32=25\dfrac{128}{4} = 32 = 2^5 sets.
  • Set index field = log⁡2(32)=5\log_2(32) = 5 bits.
  1. TLB Tag length:
    The TLB set index is selected from the Virtual Page Number. The remaining bits form the TLB tag:
TLB tag length=VPN length−Set index bits=27−5=22 bits.\text{TLB tag length} = \text{VPN length} - \text{Set index bits} = 27 - 5 = 22\text{ bits}.
Final answer

22

Common trap

Subtracting the set index from the entire 40-bit virtual address instead of the 27-bit Virtual Page Number.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2015 Computer Science and Information Technology (CS) Session 2
Question
35 of 65, printed as CS Q.25
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.