Answer: B
To determine which cache set each physical address maps to, we first analyze the division of the physical address bits.
1. Address Bit Division:
Main Memory Size: 16 MB = 2 24 16\text{ MB} = 2^{24} 16 MB = 2 24 bytes ⟹ \implies ⟹ Physical Address = 24 24 24 bits.
Block Size: 256 bytes = 2 8 256\text{ bytes} = 2^8 256 bytes = 2 8 bytes ⟹ \implies ⟹ Block Offset = 8 8 8 bits.
Number of Cache Blocks: 64 KB 256 B = 2 16 2 8 = 256 \frac{64\text{ KB}}{256\text{ B}} = \frac{2^{16}}{2^8} = 256 256 B 64 KB = 2 8 2 16 = 256 blocks.
Number of Sets: Since the cache is 4 4 4 -way set associative, Number of Sets = 256 4 = 64 = 2 6 \text{Number of Sets} = \frac{256}{4} = 64 = 2^6 Number of Sets = 4 256 = 64 = 2 6 sets ⟹ \implies ⟹ Set Index = 6 6 6 bits.
Tag: 24 − ( 6 + 8 ) = 10 24 - (6 + 8) = 10 24 − ( 6 + 8 ) = 10 bits.
Thus, the 24 24 24 -bit physical address is structured as:
[ Tag (10 bits) | Set Index (6 bits) | Block Offset (8 bits) ]
2. Extracting Set Index for each Address:
Since the block offset is the lower 8 8 8 bits (corresponding to the last 2 2 2 hexadecimal digits), the Set Index consists of the next 6 6 6 bits.
A 1 = 0x42C8A4 A1 = \text{0x42C8A4} A 1 = 0x42C8A4
Binary: 0100 0010 11 ⏟ Tag 00 1000 ⏟ Set Index 1010 0100 ⏟ Offset \underbrace{0100\,0010\,11}_{\text{Tag}}\ \underbrace{00\,1000}_{\text{Set Index}}\ \underbrace{1010\,0100}_{\text{Offset}} Tag 0100 0010 11 Set Index 00 1000 Offset 1010 0100
Set Index = 001000 2 = 8 10 001000_2 = 8_{10} 00100 0 2 = 8 10
A 2 = 0x546888 A2 = \text{0x546888} A 2 = 0x546888
Binary: 0101 0100 01 ⏟ Tag 10 1000 ⏟ Set Index 1000 1000 ⏟ Offset \underbrace{0101\,0100\,01}_{\text{Tag}}\ \underbrace{10\,1000}_{\text{Set Index}}\ \underbrace{1000\,1000}_{\text{Offset}} Tag 0101 0100 01 Set Index 10 1000 Offset 1000 1000
Set Index = 101000 2 = 40 10 101000_2 = 40_{10} 10100 0 2 = 4 0 10
A 3 = 0x6A289C A3 = \text{0x6A289C} A 3 = 0x6A289C
Binary: 0110 1010 00 ⏟ Tag 10 1000 ⏟ Set Index 1001 1100 ⏟ Offset \underbrace{0110\,1010\,00}_{\text{Tag}}\ \underbrace{10\,1000}_{\text{Set Index}}\ \underbrace{1001\,1100}_{\text{Offset}} Tag 0110 1010 00 Set Index 10 1000 Offset 1001 1100
Set Index = 101000 2 = 40 10 101000_2 = 40_{10} 10100 0 2 = 4 0 10
A 4 = 0x5E4880 A4 = \text{0x5E4880} A 4 = 0x5E4880
Binary: 0101 1110 01 ⏟ Tag 00 1000 ⏟ Set Index 1000 0000 ⏟ Offset \underbrace{0101\,1110\,01}_{\text{Tag}}\ \underbrace{00\,1000}_{\text{Set Index}}\ \underbrace{1000\,0000}_{\text{Offset}} Tag 0101 1110 01 Set Index 00 1000 Offset 1000 0000
Set Index = 001000 2 = 8 10 001000_2 = 8_{10} 00100 0 2 = 8 10
Comparing the set indices, we find that A 2 A2 A 2 and A 3 A3 A 3 both map to set 40 40 40 .