The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+11 votes

Consider a direct mapped cache of size $32$ $KB$ with block size $32$ $bytes$. The $CPU$ generates $32$ $bit$ addresses. The number of bits needed for cache indexing and the number of tag bits are respectively,

  1. $10, 17$
  2. $10, 22$
  3. $15, 17$
  4. $5, 17$
asked in CO & Architecture by Veteran (59.5k points)
edited by | 2.4k views

1 Answer

+18 votes
Best answer

Number of blocks $= \dfrac{\text{cache size}}{\text{block size}}= \dfrac{32\text{-KB}}{32}=\text{1024-Bytes.}$

So, indexing requires $\text{10-bits}.$ Number of OFFSET bits required to access $\text{32-bit block} = 5.$
So, number of TAG bits $= 32 - 10 - 5 = 17.$

So, answer is (A).

answered by Veteran (355k points)
edited by
sir if question ask like that " how many bits required to index the words present in cache" than ans would be c option.??
@kunal ;

Indexing is for arrays. Cache is an array of cache lines/blocks. So, we won't say "index  a word" in cache.
@Arjun sir, This is virtually addressed cache?
(as cpu generates virtual address)
but the cache index is equal to line offset plus word offset???
I have the same doubt as Sachin's. We usually do these calculations on physical address.

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

38,039 questions
45,533 answers
48,848 users