Problem
Solving:
Mapping
an Address to a Multiword Cache Block
1)
Consider a cache with 64 blocks with 64 blocks and a block size
16 bytes. What block number does byte address 1200 map to?
Ans:
The block is given by (block address) modulo (Number of cache
blocks)
Where
the address of the block is Byte address/Bytes per clock
Notice
that his block addresss is the block containing all addresses
between (Byte address/Bytes per clock)*Bytes per clock and (
Byteaddresss/ Bytes per block) *Bytes per block+ (Bytes per
block - 1)
Thus,
with 16 bytes per clock, byte address 1200 is block address
(1200/16)=75 which maps to cache block number (75 modulo 64)=11
Bits
in a Cache
2)
How
many total bits are required for a direct-mapped cache with
64kb of data and one-word blocks, assuming a 32-bit adress?
Ans:
We know that 64 KB is 64K words, which is 2 to the power 14
words, and, with a block size of one word, 2 to the power 14
blocks. Each block hs 32 bits of data plus a tag, which is 32-14-2
bits, plus a valid bit. Thus, the total cache size is (2 to
the power 14)*49= 784 bits or 98KB for a 64-KB cache. For this
cache, the total number of bits in the cache is over 1.5 times
as many as needed just for the storage of the data.
|