# Two addresses point to the same data - is the data then stored 2 times in the cache?

Let's say a program reads the addresses 0x00 cd 10 54and0x00 cd 10 50. The tag size and and index size added are just 4 bits, the cache has 8 blocks to 8 Bytes and thus 4 together make a set. The CPU is 32 bit.

Then above addresses would point to:

0x00 cd 10 50: ca 01 6b 7f ff 00 10 ee ff 41 45 e8 00 a7 56 00


and would want to write ca 01 6b 7f ff 00 10 ee into set 0 with tag 0x00 cd 10 5

Let's say further say, the cache were empty beforehand. Is the data now written once or two times?

## 1 Answer

To answer the question: The read addresses are always rounded down to the next cache line address, then it will be looked up, whether an cache entry already matches this address.

In case yes: Then the address will just be ignored. Nothing further happens.

In case no: Then the data corresponding to the address will be load into the cache.