C8051F120/1/2/3/4/5/6/7
194
Rev. 1.2
beginning. When CHALGM is set to ‘1’, the cache will use the pseudo-random algorithm to replace cache locations.
The pseudo-random algorithm uses a pseudo-random number to determine which cache location to replace. The
cache can be manually emptied by writing a ‘1’ to the CHFLUSH bit (CCH0CN.4).
17.2. Cache and Prefetch Optimization
By default, the branch target cache is configured to provide code speed improvements for a broad range of circum-
stances.
In most applications, the cache control registers should be left in their reset states.
Sometimes it is
desirable to optimize the execution time of a specific routine or critical timing loop. The branch target cache includes
options to exclude caching of certain types of data, as well as the ability to pre-load and lock time-critical branch
locations to optimize execution speed.
The most basic level of cache control is implemented with the Cache Miss Penalty Threshold bits, CHMSTH
(CCH0TN.1-0). If the processor is stalled during a prefetch operation for more clock cycles than the number stored
in CHMSTH, the requested data will be cached when it becomes available. The CHMSTH bits are set to zero by
default, meaning that any time the processor is stalled, the new data will be cached. If, for example, CHMSTH is
equal to 2, any cache miss causing a delay of 3 or 4 clock cycles will be cached, while a cache miss causing a delay of
1-2 clock cycles will not be cached.
Certain types of instruction data or certain blocks of code can also be excluded from caching. The destinations of
RETI instructions are, by default, excluded from caching. To enable caching of RETI destinations, the CHRETI bit
(CCH0CN.3) can be set to ‘1’. It is generally not beneficial to cache RETI destinations unless the same instruction is
SLOT = 4 Instruction
Data Bytes
0
0
TAG 58
SLOT 58
V58
TAG 62
SLOT 62
V62
TAG 61
SLOT 61
V61
TAG 2
SLOT 2
V2
TAG 1
SLOT 1
V1
TAG 0
SLOT 0
V0
TAG 60
SLOT 60
V60
TAG 59
SLOT 59
V59
LINEAR TAG
LINEAR SLOT
VL
Prefetch Data
Valid
Bit
Address
Data
Cache Data
TAG = 15 MSBs of Absolute FLASH Address
A16
A2
A1 A0
1
0
0
1
1
1
Byte 0
Byte 1
Byte 2
Byte 3
Figure 17.2. Branch Target Cache Organiztion
Summary of Contents for C8051F120
Page 2: ...C8051F120 1 2 3 4 5 6 7 2 Rev 1 2 Notes ...
Page 8: ...C8051F120 1 2 3 4 5 6 7 8 Rev 1 2 26 2 Flash Programming Commands 318 26 3 Debug Support 321 ...
Page 16: ...C8051F120 1 2 3 4 5 6 7 16 Rev 1 2 Notes ...
Page 48: ...C8051F120 1 2 3 4 5 6 7 48 Rev 1 2 ...
Page 98: ...C8051F120 1 2 3 4 5 6 7 98 Rev 1 2 ...
Page 106: ...C8051F120 1 2 3 4 5 6 7 106 Rev 1 2 Notes ...
Page 183: ...C8051F120 1 2 3 4 5 6 7 Rev 1 2 183 Notes ...
Page 184: ...C8051F120 1 2 3 4 5 6 7 184 Rev 1 2 ...
Page 214: ...C8051F120 1 2 3 4 5 6 7 214 Rev 1 2 Notes ...