search
Log In
18 votes
5.6k views

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$
in CO and Architecture
edited by
5.6k views

2 Answers

31 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).


edited by
1
sir if question ask like that " how many bits required to index the words present in cache" than ans would be c option.??
1
@kunal ;

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

In Direct mapped cache:

    Address format= Tag + cache index + Offset

     Offset  = log(block size)  = log(32B) = log(2^5) =5 bits

     index = log(cache size / block size) = log(32KB)/log(32B) = 10 bits

     Finally Tag = Total bits - index - offset = 32 - 10 - 5 = 17 bits

NOTE: Base of log is 2 

Answer:

Related questions

18 votes
2 answers
1
2.5k views
Match each of the high level language statements given on the left hand side with the most natural addressing mode from those listed on the right hand side.$\begin{array}{clcl} \text{(1)} &\text{$A[I] = B[J]$} & \qquad\text{(a)} &\text{Indirect addressing} \\ \text{(2)} &\text{while $ ... $(1, c), (2, c), (3, b)$ $(1, b), (2, c), (3, a)$ $(1, a), (2, b), (3, c)$
asked Sep 22, 2014 in CO and Architecture Kathleen 2.5k views
17 votes
2 answers
2
3.4k views
Consider a relation scheme $R = (A, B, C, D, E, H)$ on which the following functional dependencies hold: {$A \rightarrow B$, $BC \rightarrow D$, $E \rightarrow C$, $D \rightarrow A$}. What are the candidate keys R? $AE, BE$ $AE, BE, DE$ $AEH, BEH, BCH$ $AEH, BEH, DEH$
asked Sep 22, 2014 in Databases Kathleen 3.4k views
49 votes
6 answers
3
12.5k views
The relation book (title,price) contains the titles and prices of different books. Assuming that no two books have the same price, what does the following SQL query list? select title from book as B where (select count(*) from book as T where T.price ... four most expensive books Title of the fifth most inexpensive book Title of the fifth most expensive book Titles of the five most expensive books
asked Sep 22, 2014 in Databases Kathleen 12.5k views
21 votes
2 answers
4
3.2k views
The following diagram represents a finite state machine which takes as input a binary number from the least significant bit. Which of the following is TRUE? It computes $1$’s complement of the input number It computes $2$’s complement of the input number It increments the input number it decrements the input number
asked Sep 22, 2014 in Theory of Computation Kathleen 3.2k views
...