
286
Evaluating and Programming the 29K RISC Family
latency is 3–cycle or more, the processor does not delay the forwarding of the first
data word. For single–cycle burst–mode memories, the remaining data words are not
delayed internally by an additional cycle (given 2–cycle first access) unless a
load–multiple is being performed. Only accessed data, rather than reloaded data
values, are sent to the 29K data channel.
Peripheral devices such as a UART can be accessed at physical memory
locations determined by specific system hardware. Because the status and data of an
external device can change at any time, it is undesirable to cache their contents.
Access to these devices is normally accomplished in Supervisor mode. On entering
Supervisor mode the data cache could be disabled by setting the DD bit in the CFG
configuration register (this happens automatically if the FPD bit is not set in the CFG
register). This may be convenient for assembly level code as the cache may only be
disabled for a short time. Alternatively, assembly code could use LOADL
instructions (which, unlike the Am29240, may cause block allocation) when
accessing peripherals. The LOADL instruction always accesses off–chip memory.
However, if operating system code is implemented in C then it is desirable, for
performance reasons, that the operating system data also be cached. A note of
caution, when the cache is disabled its contents are retained. Consequently, if
memory locations, currently cached, are modified while the cache is disabled, the
cache will supply out–of–date data when it is reenabled. This must be avoided.
The key word
volatile
can be used in C to indicate that data should not be held in
internal registers. However, this data may still be cached. Hence, marking data
volatile is insufficient to ensure that it is always accessed from off–chip memory. As
described in the previous
Am29240
section, defining the data type to be
_LOCK
volatile
is one way of instructing the compiler to use only LOADL instructions when
accessing peripherals. The Am29040 has an alternative; the MMU can be configured
to disable caching of selected memory pages. This means the operating system code
(or for that mater User mode code) must run with address translation turned on. When
TLB reload occurs, the memory management software must ensure the two–bit field
(PGM) of the TLB registers is set to “non cachable” for memory addresses
containing mapped peripherals. The PGM field format is shown on Table 5-4.
Table 5-4.
PGM Field of the Am29040 Microprocessor TLB
PGM1 PGM0
0
0
1
1
Effect
0
1
0
1
normal (copy–back)
write–through
reserved
non cachable