The size of the physical address space of a processor is 2𝑃 bytes

The size of the physical address space of a processor is 2𝑃 bytes

Q. 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

(A) 𝑃 βˆ’ 𝑁 βˆ’ log2 𝐾                                          (B) 𝑃 βˆ’ 𝑁 + log2 𝐾

(C) 𝑃 βˆ’ 𝑁 βˆ’ 𝑀 βˆ’ π‘Š βˆ’ log2 𝐾                          (D) 𝑃 βˆ’ 𝑁 βˆ’ 𝑀 βˆ’ π‘Š + log2 𝐾

Ans: 𝑃 βˆ’ 𝑁 + log2 𝐾

Sol:

Physical Address Space = 2PΒ Bytes. Word Length is 2WΒ bytes, which means each word is of size 2WΒ bytes.
Cache memory size = 2NΒ Bytes and Tag Size = 2XΒ Bytes.
Physical address is P – W bits
Number of blocks in cache = 2(N-W-M)

It is a K-way set associative cache memory, each set in cache will have K-blocks.
So, Number of sets = 2(N-W-M)/ K
SET bits will be N-W-M-logk
Offset bits will be M

We know,
TAG bits = Main memory bits – SET bits – offset bits
So, TAG bits(x) = P – W – (N-M-W-logk)- M
Β  Β  Β  = P – W – N + M + W + logk – M
Β  Β  Β  x = P – N + logk

Gkseries: Gkseries.com is a premier website to provide complete solution for online preparation of different competitive exams like UPSC, SBI PO, SBI clerical, PCS, IPS, IAS, IBPS PO, IBPS Clerical exam etc. & other graduate and post-graduate exams. Learn more on about us page