For a direct-mapped cache, 4 bits are used for the tag field and 12 bits are used to index into a cache block. The size of each cache block is one byte. Assume that there is no other information stored for each cache block. Which ONE of the following is the CORRECT option for the sizes of the main memory and the cache memory in this system (byte addressable), respectively?
Correct Answer :
64 KB and 4 KB
Solution :
The correct option is 64 KB and 4 KB.
Let us understand the step-by-step breakdown of how to find the sizes of the main memory and the cache memory in this system.
1. Understanding the Address Format
In a direct-mapped cache, a main memory address is typically divided into three fields:
• Tag field
• Index (or Line/Block offset) field
• Block offset (or Byte offset) field
First, let's look at the given parameters:
• Tag field bits = 4 bits
• Index field bits = 12 bits
• Block size = 1 byte
Since the cache block size is 1 byte, and the system is byte-addressable, we only need 0 bits to identify a byte within a cache block because 20 = 1. Therefore, the block offset field is 0 bits.
2. Determining Main Memory Size
The total number of address bits required for the main memory is the sum of the bits in the tag, index, and block offset fields:
With 16 bits of address space, the total number of addressable locations in the main memory is:
Since 210 bytes = 1 KB:
Thus, the main memory size is 64 KB.
3. Determining Cache Memory Size
The number of cache lines (or cache blocks) is determined by the number of index bits:
The cache memory size (data capacity) is the product of the number of cache blocks and the size of each block:
Converting this to kilobytes:
Thus, the cache memory size is 4 KB.
Conclusion
The main memory size is 64 KB and the cache memory size is 4 KB.
Access expert-curated educational resources and study materials—completely free.
Create, conduct, and manage professional online assessments with Mindyard. Perfect for teachers and institutes.
Copyright © 2026 Mindyard. All Rights Reserved.