202k views
5 votes
A computer system uses 36-bit memory addresses. It has a 16M-byte 16-way set-associative cache, with 128 bytes per cache block. Assume that the size of each memory word is 1 byte. Calculate the number of bits in each of the Tag, Set, and Word fields of the memory address.

A) Tag: 20 bits, Set: 8 bits, Word: 8 bits
B) Tag: 16 bits, Set: 10 bits, Word: 10 bits
C) Tag: 22 bits, Set: 7 bits, Word: 7 bits
D) Tag: 18 bits, Set: 9 bits, Word: 9 bits

1 Answer

2 votes

Final answer:

In a 36-bit memory address for a 16M-byte 16-way set-associative cache with 128 bytes per block, the Tag field is 16 bits, the Set field is 13 bits, and the Word field is 7 bits because we need to cover cache blocks and set sizes as well as the byte offset within a block.

Step-by-step explanation:

To calculate the number of bits in each of the Tag, Set, and Word fields of a 36-bit memory address for a 16M-byte 16-way set-associative cache with 128 bytes per cache block, we need to understand the structure of the memory address.

The cache size is 16M bytes, which equals 16 x 1024 x 1024 bytes, or 16777216 bytes. Therefore, the size of the cache is 224 bytes because 224 is the same as 16M. With 128 bytes per cache block, we have 224 / 128 = 217 blocks in the cache.

Since the cache is 16-way set-associative, the number of sets is 217 / 16 = 213 sets, which means we need 13 bits for the Set field.

The Word field refers to the byte offset within a block. Since each block is 128 bytes (27 bytes), we need 7 bits to represent each byte within a block.

For the Tag field, we subtract the Set bits and Word bits from the total address bits: 36 - (13 + 7) = 36 - 20 = 16 bits for the Tag field.

Therefore, the correct answer is B) Tag: 16 bits, Set: 13 bits, Word: 7 bits.

User Xandman
by
7.4k points