Hardware Reference
In-Depth Information
Valid
Addresses that use this entry
Tag
Data
Entry
2047
65504-65535, 131040-131071, …
7
6
5
4
3
2
1
0
96-127, 65632-65663, 131168-131199
64-95, 65600-65631, 131136-131167, …
32-63, 65568-65599, 131104-131135, …
0-31, 65536-65567, 131072-131103, …
(a)
Bits
16
11
3
2
TAG
LINE
WORD BYTE
(b)
Figure 4-38. (a) A direct-mapped cache. (b) A 32-bit virtual address.
1. The TAG field corresponds to the Ta g bits stored in a cache entry.
2. The LINE field indicates which cache entry holds the corresponding
data, if they are present.
3. The WORD field tells which word within a line is referenced.
4. The BYTE field is usually not used, but if only a single byte is re-
quested, it tells which byte within the word is needed. For a cache
supplying only 32-bit words, this field will always be 0.
When the CPU produces a memory address, the hardware extracts the 11 LINE
bits from the address and uses these to index into the cache to find one of the 2048
entries. If that entry is valid, the TAG field of the memory address and the Ta g field
in cache entry are compared. If they agree, the cache entry holds the word being
requested, a situation called a cache hit . On a hit, a word being read can be taken
from the cache, eliminating the need to go to memory. Only the word actually
needed is extracted from the cache entry. The rest of the entry is not used. If the
cache entry is invalid or the tags do not match, the needed entry is not present in
the cache, a situation called a cache miss . In this case, the 32-byte cache line is
fetched from memory and stored in the cache entry, replacing what was there.
However, if the existing cache entry has been modified since being loaded, it must
be written back to main memory before being overwritten.
 
 
Search WWH ::




Custom Search