
Cache
MCF5282 Coldfire Microcontroller Reference Manual, Rev. 2.2
4-4
Freescale Semiconductor
With the cache enabled as defined by CACR[CENB], a cacheable fetch that misses in both the tag memory
and the line-fill buffer generates an external fetch. For data misses, the size of the external fetch is always
16 bytes. For instruction misses, the size of the external fetch is determined by the value contained in the
2-bit CLNF field of the CACR and the miss address.
Table 4-1 shows the relationship between the CLNF
bits, the miss address, and the size of the external fetch.
Depending on the runtime characteristics of the application and the memory response speed, overall
performance may be increased by programming the CLNF bits to values {00, 01}.
For all cases of a line-sized fetch, the critical longword defined by bits [3:2] of the miss address is accessed
first followed by the remaining three longwords that are accessed by incrementing the longword address
in a modulo-16 fashion as shown below:
if miss address[3:2] = 00
fetch sequence = {0x0, 0x4, 0x8, 0xC}
if miss address[3:2] = 01
fetch sequence = {0x4, 0x8, 0xC, 0x0}
if miss address[3:2] = 10
fetch sequence = {0x8, 0xC, 0x0, 0x4}
if miss address[3:2] = 11
fetch sequence = {0xC, 0x0, 0x4, 0x8}
Once an external fetch has been initiated and the data is loaded into the line-fill buffer, the cache maintains
a special “most-recently-used” indicator that tracks the contents of the associated line-fill buffer versus its
corresponding cache location. At the time of the miss, the hardware indicator is set, marking the line-fill
buffer as “most recently used.” If a subsequent access occurs to the cache location defined by bits [10:4]
(or bits [9:4] for split configurations of the fill buffer address), the data in the cache memory array is now
most recently used, so the hardware indicator is cleared. In all cases, the indicator defines whether the
contents of the line-fill buffer or the memory data array are most recently used. At the time of the next
cache miss, the contents of the line-fill buffer are written into the memory array if the entire line is present,
and the line-fill buffer data is still most recently used compared to the memory array.
Generally, longword references are used for sequential instruction fetches. If the processor branches to an
odd word address, a word-sized instruction fetch is generated.
For instruction fetches, the fill buffer can also be used as temporary storage for line-sized bursts of
non-cacheable references under control of CACR[CEIB]. With this bit set, a noncacheable instruction
fetch is processed as defined by
Table 4-2. For this condition, the line-fill buffer is loaded and subsequent
references can hit in the buffer, but the data is never loaded into the memory array.
Table 4-2 shows the relationship between CACR bits 31 and 10 and the type of instruction fetch.
Table 4-1. Initial Fetch Offset vs. CLNF Bits
CLNF[1:0
]
Longword Address Bits
00
01
10
11
00
Line
Longword
01
Line
Longword
1X
Line