118k views
2 votes
Suppose we have a byte-addressable computer using 2-way set associative mapping with 16-bit main memory addresses and 32 blocks of cache. If each block contains 8 bytes:

a) determine the size of the offset field.
b) determine the size of the set field
c) determine the size of the tag field

User Axiopisty
by
7.6k points

1 Answer

6 votes

Answer:

a) The size of the offset field is 3 bits.

b) The size of the set field is 4 bits.

c) The size of the tag field is 9 bits.

Step-by-step explanation:

a) To determine the size of the offset field, we need to know the number of bytes in each block. Given that each block contains 8 bytes, the offset field size will be the number of bits needed to represent 8 unique values. Since 2^3 = 8, the offset field size is 3 bits.

b) For a 2-way set associative mapping, there are two sets in total (since it is 2-way). The total number of blocks in the cache is 32. Therefore, the number of blocks in each set will be 32 / 2 = 16. To represent 16 unique values, we need 4 bits. So, the size of the set field is 4 bits.

c) The remaining bits in the main memory address that are not occupied by the offset and set fields are used for the tag field. In this case, the main memory addresses are 16 bits. From the previous calculations, we know that the offset field is 3 bits and the set field is 4 bits. Hence, the remaining bits for the tag field will be 16 - 3 - 4 = 9 bits.

To summarize:

a) The size of the offset field is 3 bits.

b) The size of the set field is 4 bits.

c) The size of the tag field is 9 bits.

User Erf
by
8.0k points