• edited by
20,444 views
44 44 votes

A CPU has $32-bit$ memory address and a $256 \ KB$ cache memory. The cache is organized as a $4-way$ set associative cache with cache block size of $16$ bytes.

  1. What is the number of sets in the cache?
  2. What is the size (in bits) of the tag field per cache block?
  3. What is the number and size of comparators required for tag matching?
  4. How many address bits are required to find the byte offset within a cache block?
  5. What is the total amount of extra memory (in bytes) required for the tag bits?

3 Answers

Best answer
66 66 votes

What is the number of sets in the cache

 $\text{Number of sets}=\dfrac{\text{Cache memory}}{\text{(set associativity $\times$ cache block size)}}$

 $=\dfrac{256KB}{(4\times 16 B)}$

 $=4096$

What is the size (in bits) of the tag field per cache block?

 Memory address size $=32\text{-bit}$

 Number of bits required to identify a particular set  $=12\text{ (Number of sets}= 4096)$

 Number of bits required to identify a paticular location in cache line $=4\text{ (cache block size = 16)}$

 Size of tag field $=32-12-4=16\text{-bit}$

What is the number and size of comparators required for tag matching?

We use $4\text{-way}$ set associate cache. So, we need $4$ comparators each of size $16\text{-bits}$

http://ecee.colorado.edu/~ecen2120/Manual/caches/cache.html

How many address bits are required to find the byte offset within a cache block?

Cache block size is $16\text{-byte.}$ so $4\text{-bits}$ are required to find the byte offset within a cache block.

What is the total amount of extra memory (in bytes) required for the tag bits?

size of tag $=16\text{-bits}$

Number of sets $=4096$

Set associativity $=4$

Extra memory required to store the tag bits $=16\times 4096\times 4\text{-bits}= 2^{18}\text{ bits}=2^{15}\text{ bytes}.$

• edited by
4 4 votes

A. To find the number of sets we need to determine the number of rows. To do that we need to determine the number of blocks. We are given that this is a 4-way set associative cache, hence each set has four blocks.

It holds:

#Blocks = Capacity / BlockSize = 218 / 24 = 214. There are 214 blocks.

#Sets = #Blocks / #ways = 214 / 22 = 212. There are 212 sets.

• edited by
Position:
Show:

Related questions

80 80 votes
3 answers 3 answers
33.5k
33.5k views
Kathleen asked Sep 14, 2014
33,469 views
Consider a $5-$stage pipeline - IF (Instruction Fetch), ID (Instruction Decode and register read), EX (Execute), MEM (memory), and WB (Write Back). All (memory or registe...
58 58 votes
8 answers 8 answers
27.7k
27.7k views
Kathleen asked Sep 14, 2014
27,695 views
More than one word are put in one cache block to:exploit the temporal locality of reference in a programexploit the spatial locality of reference in a programreduce the m...
1 1 vote
1 1 answer
3.3k
3.3k views
Kathleen asked Sep 14, 2014
3,346 views
A low memory can be connected to 8085 by using$INTER$$\overline{RESET\text{ }IN}$$HOLD$$READY$
71 71 votes
11 answers 11 answers
33.7k
33.7k views
Kathleen asked Sep 14, 2014
33,710 views
Consider the following data path of a simple non-pipelined CPU. The registers $A, B$, $A_{1},A_{2}, \textsf{MDR},$ the $\textsf{bus}$ and the $\textsf{ALU}$ are $8$-$bit$...