01.04.2014 Views

Preliminary C8051F120/1/2/3 C8051F124/5/6/7 - KEMT FEI TUKE

Preliminary C8051F120/1/2/3 C8051F124/5/6/7 - KEMT FEI TUKE

Preliminary C8051F120/1/2/3 C8051F124/5/6/7 - KEMT FEI TUKE

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>C8051F120</strong>/1/2/3<br />

<strong>C8051F124</strong>/5/6/7<br />

<strong>Preliminary</strong><br />

beginning. When CHALGM is set to ‘1’, the cache will use the pseudo-random algorithm to replace cache locations.<br />

The pseudo-random algorithm uses a pseudo-random number to determine which cache location to replace. The<br />

cache can be manually emptied by writing a ‘1’ to the CHFLUSH bit (CCH0CN.4).<br />

Figure 16.2. Branch Target Cache Organiztion<br />

Valid<br />

Bit Address Data<br />

Prefetch Data<br />

VL<br />

LINEAR TAG<br />

LINEAR SLOT<br />

V0<br />

V1<br />

V2<br />

TAG 0 SLOT 0<br />

TAG 1 SLOT 1<br />

TAG 2 SLOT 2<br />

Cache Data<br />

V58<br />

V59<br />

V60<br />

V61<br />

V62<br />

TAG 58 SLOT 58<br />

TAG 59 SLOT 59<br />

TAG 60 SLOT 60<br />

TAG 61 SLOT 61<br />

TAG 62 SLOT 62<br />

A16 A2 A1 A0<br />

0 0<br />

0 1<br />

TAG = 15 MSBs of Absolute FLASH Address<br />

1 0<br />

1 1<br />

Byte 0<br />

Byte 1<br />

Byte 2<br />

Byte 3<br />

SLOT = 4 Instruction<br />

Data Bytes<br />

16.2. Cache and Prefetch Optimization<br />

By default, the branch target cache is configured to provide code speed improvements for a broad range of circumstances.<br />

In most applications, the cache control registers should be left in their reset states. Sometimes it is<br />

desirable to optimize the execution time of a specific routine or critical timing loop. The branch target cache includes<br />

options to exclude caching of certain types of data, as well as the ability to pre-load and lock time-critical branch<br />

locations to optimize execution speed.<br />

The most basic level of cache control is implemented with the Cache Miss Penalty Threshold bits, CHMSTH<br />

(CCH0TN.1-0). If the processor is stalled during a prefetch operation for more clock cycles than the number stored<br />

in CHMSTH, the requested data will be cached when it becomes available. The CHMSTH bits are set to zero by<br />

default, meaning that any time the processor is stalled, the new data will be cached. If, for example, CHMSTH is<br />

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<br />

1-2 clock cycles will not be cached.<br />

Certain types of instruction data or certain blocks of code can also be excluded from caching. The destinations of<br />

RETIinstructions are, by default, excluded from caching. To enable caching of RETIdestinations, the CHRETIbit<br />

(CCH0CN.3) can be set to ‘1’. It is generally not beneficial to cache RETI destinations unless the same instruction is<br />

Page 182<br />

DS008-0.8-AUG02 © 2002 Cygnal Integrated Products, Inc.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!