
Instruction Cache
4-10
4.3
Instruction Cache
The 128
×
32-bit instruction cache speeds instruction fetches and lowers sys-
tem cost. The instruction cache allows the use of slow external memories while
still achieving single-cycle access performance. The cache also frees the ex-
ternal buses from program fetches, thus, allowing the use of these buses for
DMA or other system needs. The cache can operate in a completely automatic
fashion without the need for external intervention. It uses a form of the LRU
(least recently used) cache update algorithm.
4.3.1
Instruction Cache Architecture
The instruction cache (see Figure 4–9 on page 4-11 ) contains 128 32-bit
words of RAM, enough to hold 128 words of program memory. It is divided into
four 32-word segments. Associated with each segment is a 27-bit segment
start address (SSA) register. For each word in the cache, there is a corre-
sponding single-bit present (P) flag.
When the CPU requests an instruction word, a check is made to determine
whether the word is already in the instruction cache. The partitioning of an in-
struction address as used by the cache control algorithm is shown in
Figure 4–8. The 27 most significant bits (MSBs) of the instruction address se-
lect the segment, and the five least significant bits (LSBs) define the address
of the instruction word within the pertinent segment. The 27 MSBs of the in-
struction address are compared with the four SSA registers. If a match is
found, the relevant P flag is checked. The P flag indicates whether the word
within a particular segment is already present in cache memory:
P = 1: the word is already present in cache memory.
P = 0: location in cache is invalid (e.g., contains garbage).
Figure 4–8.Address Partitioning for Cache Control Algorithm
Instruction word
address within segment
5 4
31
0
Segment start address
(SSA)
If there is no match, one of the segments must be replaced by the new data.
The segment replaced in this circumstance is determined by the LRU (least
recently used) algorithm. The LRU stack (see the upper-right portion of
Figure 4–9) is maintained for this purpose.