Skip to content

GATE CS 2006 Q74 — Memory Hierarchy: Cache, Main Memory and Secondary Storage

Explain with AI

Consider two cache organizations. First one is 32  KB  2-way32 \; \textsf{KB}\;2\text{-way} set associative with 32  byte32 \; \text{byte} block size, the second is of same size but direct mapped. The size of an address is 32  bits32\; \text{bits} in  both cases . A 2-to-12\text{-to-}1 multiplexer has latency of 0.6  ns0.6 \; \text{ns} while a k-bitk\text{-bit} comparator has latency of  k10ns\frac{k}{10} \text{ns}. The hit latency of the set associative organization is h1h_1 while that of direct mapped is h2h_2.

The value of h1h_1 is: 

Choose one option
View worked solution

Answer: A

To find the hit latency h1h_1 of the 2-way set-associative cache, we first need to determine the size of the tag field (kk bits) in the address.

1. Address Division for 2-Way Set-Associative Cache

  • Total Cache Size: 32 KB=215 bytes32 \text{ KB} = 2^{15} \text{ bytes}
  • Block Size: 32 bytes=25 bytes32 \text{ bytes} = 2^5 \text{ bytes}
  • Number of Cache Blocks: 21525=210=1024\frac{2^{15}}{2^5} = 2^{10} = 1024 blocks
  • Set Size: 22 blocks (since it is 22-way set-associative)
  • Number of Sets: 10242=512=29\frac{1024}{2} = 512 = 2^9 sets

The 3232-bit physical address is divided as follows:

Tag (k bits)Set Index (9 bits)Block Offset (5 bits)\begin{array}{|c|c|c|} \hline \text{Tag } (k \text{ bits}) & \text{Set Index } (9 \text{ bits}) & \text{Block Offset } (5 \text{ bits}) \\ \hline \end{array} Tag size (k)=32−(9+5)=18 bits\text{Tag size } (k) = 32 - (9 + 5) = 18 \text{ bits} ---

2. Calculating Hit Latency (h1h_1)

In a 2-way set-associative cache, the hit path consists of two main sequential steps after the set is indexed:

  1. Tag Comparison: Comparing the 1818-bit tag of the incoming address with the tags of the two blocks in the selected set using 1818-bit comparators in parallel. Comparator Latency=k10=1810=1.8 ns\text{Comparator Latency} = \frac{k}{10} = \frac{18}{10} = 1.8 \text{ ns}
  2. Data Selection (Multiplexing): A 2-to-12\text{-to-}1 multiplexer selects the data from the correct block based on the comparator output. Multiplexer Latency=0.6 ns\text{Multiplexer Latency} = 0.6 \text{ ns}

Therefore, the total hit latency h1h_1 is:

h1=Comparator Latency+Multiplexer Latencyh_1 = \text{Comparator Latency} + \text{Multiplexer Latency} h1=1.8 ns+0.6 ns=2.4 nsh_1 = 1.8 \text{ ns} + 0.6 \text{ ns} = 2.4 \text{ ns}

Thus, the correct option is A.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Memory Hierarchy: Cache, Main Memory and Secondary Storage questions