A digital computer has a memory of 64k x 16 and a cache memory of 1k words. the cache uses direct mapping with a block size of four words.
a.how many bits are there in the tag, index, block and word fields of the address format?
b.how many bits are there in each word of cache and what is the size of cache?
c.how many blocks can the cache accommodate?
Answers
Answered by
78
Main memory has 64K = 64 x 1024 = 2^6 x 2^10 = 2^16 words
Cache memory has 1K = 1024 = 2^10 words
Cached address consists of Index and Tag part. Index and Tag together make main memory address. Index part addresses cache memory and Tag part represents the rest of the main memory address.
In this case to address main memory we need 16 bits (2^16) and to address cache memory we need 10 bits (2^10).
So Index is 10 bits wide and Tag is 6 bits wide (16 - 10 = 6).
When using blocks the the Index is divided into the "Block" part and the "Word" part. Block part addresses blocks of cache memory and Word part addresses individual words in a block.
In this case the block is 4 words long for what we need 2 bits (2^2) and that leaves 8 bits (10 - 2 = 8) for addressing blocks.
Summary:
Tag = 6 bits
Index = 10 bits
Block = 8 bits
Word = 2 bits
b. How many bits are there in each word of the cache, and how are they divided into functions? Include the valid bit.
For the above example a cache word with a Valid bit would contain
Valid bit = 1 bit
Tag = 6 bits
Data = 16 bits
total bits = 23 bits
c. How many blocks can the cache accommodate?
If cache has 1K words and block size is 4 words then number of blocks is 1K / 4 = 1024 / 4 = 256 blocks.
Cache memory has 1K = 1024 = 2^10 words
Cached address consists of Index and Tag part. Index and Tag together make main memory address. Index part addresses cache memory and Tag part represents the rest of the main memory address.
In this case to address main memory we need 16 bits (2^16) and to address cache memory we need 10 bits (2^10).
So Index is 10 bits wide and Tag is 6 bits wide (16 - 10 = 6).
When using blocks the the Index is divided into the "Block" part and the "Word" part. Block part addresses blocks of cache memory and Word part addresses individual words in a block.
In this case the block is 4 words long for what we need 2 bits (2^2) and that leaves 8 bits (10 - 2 = 8) for addressing blocks.
Summary:
Tag = 6 bits
Index = 10 bits
Block = 8 bits
Word = 2 bits
b. How many bits are there in each word of the cache, and how are they divided into functions? Include the valid bit.
For the above example a cache word with a Valid bit would contain
Valid bit = 1 bit
Tag = 6 bits
Data = 16 bits
total bits = 23 bits
c. How many blocks can the cache accommodate?
If cache has 1K words and block size is 4 words then number of blocks is 1K / 4 = 1024 / 4 = 256 blocks.
Similar questions