Am5
X
86 Microprocessor
19
AMD
PRELIMINARY
hanced system support because the cache may contain
data that is not identical to data in main memory at the
same address location.
4.5
The Am5
X
86 microprocessor family write-back cache
coherency protocol reduces bus activity while maintain-
ing data coherency in a multimaster environment. The
cache coherency protocol offers the following advan-
tages:
Write-Back Cache Protocol
I
No unnecessary bus traffic. The protocol dynamical-
ly identifies shared data to the granularity of a cache
line. This dynamic identification ensures that the traf-
fic on the external bus is the minimum necessary to
ensure coherency.
I
Software-transparent. Because the protocol gives
the appearance of a single, unified memory, soft-
ware does not have to maintain coherency or identify
shared data. Application software developed for a
system without a cache can run without modification.
Software support is required only in the operating
system to identify non-cacheable data regions.
The Am5
X
86 microprocessor family implements a mod-
ified MESI protocol on systems with write-back cache
support. MESI allows a cache line to exist in four states:
modified, exclusive, shared, and invalid. The Am5
X
86
microprocessor family allocates memory in the cache
due to a read miss. Write allocation is not implemented.
To maintain coherency between cache and main mem-
ory, the MESI protocol has the following characteristics:
I
The system memory is always updated during a
snoop when a modified line is hit.
I
If a modified line is hit by another master during
snooping, the master is forced off the bus and the
snooped cache writes back the modified line to the
system memory. After the snooped cache completes
the write, the forced-off bus master restarts the ac-
cess and reads the modified data from memory.
4.5.1
Cache Line Overview
To implement the Am5
X
86 microprocessor cache co-
herency protocol, each tag entry is expanded to 2 bits:
S1 and S0. Each tag entry is associated with a cache
line. Table 3 shows the cache line organization.
Table 3. Cache Line Organization
Data Words (32 Bits)
Address Tag and Status
Address Tag, S1, S0
D0
D1
D2
D3
4.5.2
A cache line can occupy one of four legal states as
indicated by bits S0 and S1. The line states are shown
in Table 4. Each line in the cache is in one of these
states. The state transition is induced either by the pro-
cessor or during snooping from an external bus master.
Line Status and Line State
4.5.2.1
An invalid cache line does not contain valid data for any
external memory location. An invalid line does not par-
ticipate in the cache coherency protocol.
Invalid
4.5.2.2
An exclusive line contains valid data for some external
memory location. The data exactly matches the data in
the external memory location.
Exclusive
4.5.2.3
A shared line contains valid data for an external memory
location, the data is shared by another cache, and the
shared data matches the data in the external memory
exactly; or the cache line is in Write-through mode.
Shared
4.5.2.4
A modified line contains valid data for an external mem-
ory location. However, the data does not match the data
in the external location because the processor has mod-
ified the data since it was loaded from the external mem-
ory. A cache that contains a modified line is responsible
for ensuring that the data is properly maintained. This
means that in the case of an external access to that line
from another external bus master, the modified line is
first written back to the external memory before the other
external bus master can complete its access. Table 5
shows the MESI cache line states and the correspond-
ing availability of data.
Modified
Table 4. Legal Cache Line States
S1
S0
Line State
0
0
1
1
0
1
0
1
Invalid
Exclusive
Modified
Shared