
8-50
ColdFire CF4e Core User’s Manual
For More Information On This Product,
Go to: www.freescale.com
Cache Overview
8.7.11 Cache Management
The cache can be enabled and configured by using a MOVEC instruction to access CACR.
A hardware reset clears CACR, disabling the cache and removing all configuration
information; however, reset does not affect the tags, state information, or data in the cache.
Set CACR[DCINVA,ICINVA] to invalidate the caches before enabling them.
The privileged CPUSHL instruction supports cache management by selectively pushing
and invalidating cache lines. The address register used with CPUSHL directly addresses the
cache’s directory array. The CPUSHL instruction flushes a cache line.
The value of CACR[DDPI,IDPI] determines whether CPUSHL invalidates a cache line
after it is pushed. To push the entire cache, implement a software loop to index through all
sets and through each of the four ways in each set. The state of CACR[DEC,IEC] does not
affect the operation of CPUSHL or CACR[DCINVA,ICINVA]. Disabling a cache by
setting CACR[IEC] or CACR[DEC] makes the cache nonoperational without affecting
tags, state information, or contents.
The contents of A
n
used with CPUSHL specify cache row and line indexes. Figure 8-18
shows the A
n
format for the data cache.
Figure 8-19 shows the A
n
format for the instruction cache.
The following code example flushes the entire
data cache:
_cache_disable:
nop
move.w
jsr
clr.l
movec
#0x2700,SR
_cache_flush
d0
d0,ACR0
;mask off IRQs
;flush the cache completely
;ACR0 off
2
W
ACR0/ACR1 only. Write protect. Selects the write privilege of the memory region. ACR2[W] and
ACR3[W] are reserved.
0 Read and write accesses permitted
1 Write accesses not permitted
1–0
—
Reserved, should be cleared.
31
13
12
4
3
0
0
Set Index
Way Index
Figure 8-18. A
n
Format (Data Cache)
31
13
12
4
3
0
0
Set Index
Way Index
Figure 8-19. A
n
Format (Instruction Cache)
Table 8-29. ACR
n
Field Descriptions (Continued)
Bits
Name
Description
F
Freescale Semiconductor, Inc.
n
.