UM10208_2
© NXP B.V. 2007. All rights reserved.
User manual
Rev. 02 — 1 June 2007
15 of 362
NXP Semiconductors
UM10208
Chapter 4: LPC2800 Cache
•
A cache hit is defined as a read or write by the CPU to an address in memory which is
currently in cache.
•
A cache flush is the act of writing a dirty cache line back to memory.
4.
Description
shows the structure of the cache and how memory addresses map to cache
lines. For caching purposes, memory is divided into pages of 2 megabytes of 4 kB
sub-pages (1024 words of 32 bits). The sub-pages correspond to 128 cache lines (128
entries of eight 32-bit words).
The associated cache line in memory will be stored in cache memory at a fixed position.
An example sequence could begin with an access to one of the first 8 words of a 2
megabyte page of memory. These words will be stored on the first cache line (cache line
0) of Way_0. An access to one of the second 8 words in the same page will be stored on
the second cache line (cache line 1) of Way_0. Later, if an address that maps to cache
line 0 is read from a different portion of memory, it will be stored in Way_1 (since Way_1
has not yet been used). If still another address mapping to cache line 0 is read, the Least
Recently Used tag is used to decide whether the new line will be stored in Way_0 or
Way_1. The least recently used previously cached line must be removed, and the new
line stored in its place. In this example, the way that is overwritten will be Way_0, since
Way_1 was used more recently. If the cache line that must be removed is marked as
“dirty”, it will be written back to memory prior to being overwritten by the new memory line.
Note that the cache can be set to work only for instruction accesses, only for data
accesses, or for both. This is done via the DATA_ENABLE and INSTRUCTION_ENABLE
bits in the CACHE_SETTINGS register.