Instruction Cache and Memory Features
The Instruction Cache
MOTOROLA
Optimizing DSP56300/DSP56600 Applications
5-5
and written over. Locking a sector is useful for time-critical
code sections, that should execute at maximum speed
whenever called. Locking them will prevent the need to
re-allocate a sector and re-load it by slow fetches.
2. Unlock a sector (PUNLOCK,PUNLOCKR)—Make the sector
available again for the LRU replacement algorithm. The
unlocked sector is considered “most-recently-used”, that is,
last in line for replacement.
3. Unlock all locked sectors (PFREE)
4. Flush the whole cache (PFLUSH), bringing all the sector tags
and LRU stack to their default values.
5. Flush only the unlocked sectors (PFLUSHUN).
The argument for the PLOCK and PUNLOCK instructions is an
address. The cache controller matches the tag field to the tag
registers, thus identifying the sector. This means that the 8 cache
sectors cannot be allocated by the user directly by using a sector
number or another designator. A sector can be accessed by
searching a match to its tag register. Selecting a sector for allocation
from one of the available (unlocked) sectors is always done by the
controller hardware using the LRU algorithm.
The PLOCK and PUNLOCK are given the address argument by
using one of the regular addressing modes (Absolute Address, or
Memory Indirect Using an Address Register). The PLOCKR and
PUNLOCKR use a PC relative displacement to calculate the address
argument.
Locking sectors enables the user to select actively what code
segments will be in the cache at any given moment. Unlocking
sectors enables changing the sector allocation map dynamically,
according to changing program needs. Software control over sector
allocation should normally be done by locking. It is possible to
allocate an available sector to a tag without locking it (using the
PUNLOCK/R commands on an unallocated address), but it has no
benefit over a regular sector miss during execution.
The multiple unlocking/flushing commands are useful for fast task
switching, in multi-tasking systems. For example, the routines from
the operating system's kernel could be in locked cache sectors, while
the unlocked sectors are for the use of the current task. The
PLFUSHUN instruction could be used at the beginning of a
context-switch.