The size of the physical address space of a processor is 2^𝑃 bytes. The word…

2018

The size of the physical address space of a processor is 2^𝑃 bytes. The word length is 2^π‘Š bytes. The capacity of cache memory is 2^𝑁 bytes. The size of each cache block is 2^𝑀 words. For a 𝐾-way set-associative cache memory, the length (in number of bits) of the tag field is

  1. A.

    𝑃 βˆ’ 𝑁 βˆ’ log2 𝐾

  2. B.

    𝑃 βˆ’ 𝑁 + log2 𝐾

  3. C.

    𝑃 βˆ’ 𝑁 βˆ’ 𝑀 βˆ’ π‘Š βˆ’ log2 𝐾

  4. D.

    𝑃 βˆ’ 𝑁 βˆ’ 𝑀 βˆ’ π‘Š + log2 𝐾

Attempted by 258 students.

Show answer & explanation

Correct answer: B

Key idea: compute index bits from the number of sets, compute offset bits from block size, then tag = total address bits βˆ’ index βˆ’ offset.

  • Block size in bytes = 2^M words Γ— 2^W bytes/word = 2^(M+W) bytes.

  • Number of sets = cache capacity / (K Γ— block size) = 2^N / (K Γ— 2^(M+W)) = 2^(N - M - W - log2 K).

  • Index bits = N - M - W - log2 K. Offset (block + byte within word) bits = M + W.

  • Tag bits = P - index - offset = P - (N - M - W - log2 K) - (M + W) = P - N + log2 K.

Answer: The tag field length is P - N + log2 K bits.

A video solution is available for this question β€” log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir