11 CACHE CONTROLLER (CCU)
S1C33L26 TECHNICAL MANUAL
Seiko Epson Corporation
11-5
Writing Operation
11.3.5
Writing only supports the write through mode.
The write through mode enables the relevant external memory to be written at the same time when the cache mem-
ory is written in response to a request for writing to the data address in the cache. Thus, data matching is always
ensured (if not changed by the DMAC). Also, in order to prevent the processing speed from dropping due to write
through operation, the CCU incorporates a one-word write buffer. To enable the write buffer, set WBEN/CCU_CFG
register to 1 (default). When WBEN is set to 0, the write buffer is disabled. In this case the CPU is placed into wait
status until the data writing to the external memory has completed.
When any data is hit
A write cycle is issued to both the cache and the external memory. Additionally, LRU information is updated.
When any data is mishit
When any data is mishit, the cache memory is not written, and only the external memory is written. If this is the
case, LRU information is not updated since nothing is written to the cache. No refilling is performed, either.
When the write buffer is enabled, writing data to the external memory is performed in two steps, first the data is
written to the write buffer and then the external memory is updated. WBEMPTY/CCU_WB_STAT register and
WEFINISH/CCU_WB_STAT register are provided to check the write buffer status and whether the buffered data
has been actually written to the external memory or not.
WBEMPTY is set to 0 by writing data to the write buffer and is set to 1 when the buffered data is read out for writ-
ing to the external memory. At the same time the WBEMPTY is set to 1, WEFINISH goes 0 to indicate that the data
is being written to the external memory. WEFINISH is set to 1 upon completion of writing to the external memory.
The write buffer improves writing speed as the CPU does not need to wait for completion of writing to the external
memory. However, read the above flags to check if the data has been written to, especially when data is written to a
low-speed external device.
Flush
11.3.6
Flushing refers to nullifying all data in the cache.
To flush the instruction cache, set IC/CCU_CFG register to 0 (to disable the instruction cache). To flush the data
cache, set DC/CCU_CFG register to 0 (to disable the data cache).
Set these bits back to 1 to enable the caches again.
Note that the cache is flushed several cycles after writing 0 to IC or DC. Before resuming caching operation, check
the status bit to ensure that flushing is completed. Check ICS/CCU_STAT register for the operating status of the
instruction cache, and DCS/CCU_STAT register for that of the data cache. If these bits are 1, then the cache is in
operation and the flushing is not completed. When the flushing has completed and cache stops the operation, then
these bits turns to 0.
Cache Lock with Interrupt Level Specified
11.4
The cache memory size is not large, therefore, frequently generated refilling may cause system performance degra-
dation depending on the program. To avoid this, the CCU has a feature to lock the cache against refilling with inter-
rupt handler routines of the specified levels. LKPRI[7:0]/CCU_LK register is provided for this setting.
By setting an LKPRI[7:0] bit to 1, the priority level of interrupts to disabled refilling can be selected. Each LK-
PRI[7:0] bit corresponds to an interrupt level, for example, LKPRI0 corresponds to interrupt level 0 (IL[2:0] = 0)
and LKPRI7 corresponds to interrupt level 7 (IL[2:0] = 7). If the interrupt level in IL[2:0] (set by the interrupt oc-
curred) and an LKPRI[7:0] bit that has been set to 1 are matched, the cache will be locked after a lapse of several
cycles. After this point, the CCU will not refill the cache until the IL[2:0] value is altered to the interrupt level of an
LKPRI[7:0] bit that has been set to 0.
Example 1: When LKPRI1 is set to 1 and other bits are set to 0 (LKPRI[7:0] = 0x02, the current IL[2:0] value is 0)
The CCU can refill until a level 1 interrupt occurs. When IL[2:0] is set to 1 due to occurrence of a level 1 inter-
rupt, the cache is locked. Therefore, the handler routine for the interrupt occurred is executed at the store loca-
tion in the memory (when not hit to the cached data). Executing the reti instruction at the end of the interrupt
handler routine reset IL[2:0] to 0 and releases the cache lock status.