Skip to content

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

Explain with AI

Consider two cache organizations. First one is 3232 kBkB 22-way set associative with 3232 bytebyte block size, the second is of same size but direct mapped. The size of an address is 3232 bitsbits in  both cases . A 22-to-11 multiplexer has latency of 0.6ns0.6 ns while a k−k-bit comparator has latency of  k10ns\frac{k}{10} ns. The hit latency of the set associative organization is h1h_1 while that of direct mapped is h2h_2.
The value of h2h_2 is:  

Choose one option
View worked solution

Answer: D

To find the hit latency h2h_2 of the direct-mapped cache, we first need to determine the number of tag bits used in its address translation.

1. Address Division for the Direct-Mapped 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 (Lines): Number of Blocks=Cache SizeBlock Size=21525=210=1024\text{Number of Blocks} = \frac{\text{Cache Size}}{\text{Block Size}} = \frac{2^{15}}{2^5} = 2^{10} = 1024

For a 3232-bit physical address, the division of bits is as follows:

  • Block Offset: log⁡2(32)=5 bits\log_2(32) = 5 \text{ bits}
  • Index Bits: log⁡2(1024)=10 bits\log_2(1024) = 10 \text{ bits}
  • Tag Bits: 32−(Index Bits+Offset Bits)=32−(10+5)=17 bits32 - (\text{Index Bits} + \text{Offset Bits}) = 32 - (10 + 5) = 17 \text{ bits}

2. Calculating Hit Latency h2h_2

In a direct-mapped cache:

  • A single tag comparison is performed to determine a hit.
  • The size of the comparator required is equal to the number of tag bits (k=17k = 17).
  • The latency of a kk-bit comparator is given as k10 ns\frac{k}{10} \text{ ns}.
  • Since there is only one way (direct-mapped), no multiplexer is needed to select between multiple ways.
Hit Latency h2=Comparator Latency=1710=1.7 ns\text{Hit Latency } h_2 = \text{Comparator Latency} = \frac{17}{10} = 1.7 \text{ ns}

Note: Calculating h1h_1 (for 2-way Set Associative Cache)

For completeness, let's calculate h1h_1:

  • Number of sets = 32 kB2×32 B=512=29  ⟹  9 index bits\frac{32 \text{ kB}}{2 \times 32 \text{ B}} = 512 = 2^9 \implies 9 \text{ index bits}.
  • Tag bits = 32−9−5=18 bits32 - 9 - 5 = 18 \text{ bits}.
  • Comparator latency = 1810=1.8 ns\frac{18}{10} = 1.8 \text{ ns}.
  • A 2-to-1 multiplexer (0.6 ns0.6 \text{ ns}) is required to select the correct way.
  • h1=1.8 ns+0.6 ns=2.4 nsh_1 = 1.8 \text{ ns} + 0.6 \text{ ns} = 2.4 \text{ ns}.

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