Question Details

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?

Options

A

64 KB and 4 KB

B

128 KB and 16 KB

C

64 KB and 8 KB

D

128 KB and 6 KB

Show Answer

Correct Answer :

Option A

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:

Total Address Bits=Tag bits+Index bits+Block offset bits

Total Address Bits=4+12+0=16 bits

With 16 bits of address space, the total number of addressable locations in the main memory is:
216 bytes

Since 210 bytes = 1 KB:
216 bytes=26×210 bytes=64 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:
Number of Cache Blocks=2Index bits=212=4096 blocks

The cache memory size (data capacity) is the product of the number of cache blocks and the size of each block:
Cache Size=Number of Blocks×Block Size

Cache Size=4096×1 byte=4096 bytes

Converting this to kilobytes:
4096 bytes=40961024 KB=4 KB

Thus, the cache memory size is 4 KB.

Conclusion
The main memory size is 64 KB and the cache memory size is 4 KB.

Unlock Our Free Library

Access expert-curated educational resources and study materials—completely free.

Ask AI Tutor
5 left
Q1 View Question & Options
AI Tutor is solving this question...
Reading question context & options...