a computer system uses 16 bits memory address.it has 2k byte cache organized in a direct mapped manner with 64 bytes per cache block size of each memory word is 1 byte.calculate no. of bits in each of the tag ,block and word fields of memory address
Answers
A computer system uses 16-bit memory addresses. It has a 2K-byte cache organized in a direct-mapped manner with 64 bytes per cache block. Assume that the size of each memory word is 1 byte.
When a program is executed, the processor reads data sequentially from the following word addresses:
128, 144, 2176, 2180, 128, 2176
All the above addresses are shown in decimal values. Assume that the cache is initially empty. The cache hits ratio occur for for above given addresses is __________ .
(A) 0.333
(B) 0.666
(C) 0.353
(D) 0.535
Answer: (A)
Explanation: First, find word, block and tag size:
Block size = 64 bytes = 26 bytes = 26 words (since 1 word = 1 byte)
Therefore, Number of bits in the Word field = 6
Cache size = 2K-byte = 211 bytes
Number of cache blocks = Cache size / Block size = 211/26 = 25
Therefore, Number of bits in the Block field = 5
Total number of address bits = 16
Therefore, Number of bits in the Tag field = 16 – 6 – 5 = 5
For a given 16-bit address, the 5 most significant bits, represent the Tag, the next 5 bits represent the Block, and the 6 least significant bits represent the Word.
Concept:
A memory address in computing is a reference to a particular memory region that is used at different levels by hardware and software. Memory addresses are unsigned numbers that are often presented and handled as fixed-length digit sequences.
Given:
Here it is given that a computer system uses bits memory address.it has byte cache organized in a direct mapped manner with bytes per cache block size of each memory word is byte.
Find:
We have to calculate no. of bits in each of the tag ,block and word fields of memory address.
Solution:
According to the question,
A computer system uses -bit memory addresses. It has a -byte cache organized in a direct-mapped manner with bytes per cache block. Assume that the size of each memory word is byte.
When a program is executed, the processor reads data sequentially from the following word addresses:
All the above addresses are shown in decimal values. Assume that the cache is initially empty. The cache hits ratio occur for for above given addresses is .
Hence the correct option of the question is and this is our final answer also.