19.3 Memory Mapping Types
There are a few different kinds of mappings that can be specified in the map
attribute. All use the format described in the previous section.
- Device Mapping
- The most common kind of mapping. It is used for
devices, RAM and ROM objects. The target field is not set.
- Translator Mapping
- Sometimes the address has to be modified between memory-spaces, or the
destination memory-space depends on the address or some other aspect of
the access such as the initiating processor. In these cases a translator
can be used. A translator mapping is specified with the translator in the
object field, and the default target as target. The translator
has to implement the TRANSLATE interface. When an access reaches
a translator mapping, the translate function in the
TRANSLATE interface is called. The translator can then modify
the address if necessary, and specify what destination memory-space to use.
If it doesn't specify any new memory-space, the default one from the configuration
is used. The following fields can be changed by the translator:
physical_address, ignore, block_STC,
inverse_endian and user_ptr.
- Translate to RAM/ROM Mapping
- Used to map RAM and ROM objects with a translator first. The object
field is set to the translator, and target is set to the RAM/ROM object.
- Space-to-space Mapping
- Map one memory-space in another. Both object and target
should be set to the destination memory-space object.
- Bridge Mapping
- A bridge mapping is typically used for mappings that are setup by some
kind of bridge device. The purpose of a bridge mapping is to handle accesses
where nothing is mapped, in a way that corresponds to the bus architecture.
For a bridge mapping, the object field is set to the bridge device,
implementing the BRIDGE interface. The target field is
set to the destination memory-space. If both a translator and bridge is needed,
they must be implemented by the same object. If an access is made where nothing
is mapped, the memory-space by default returns the Sim_PE_IO_Not_Taken
pseudo exception. But if the access was made through a bridge mapping, the
bridge device will be called to notify it about the unmapped access. It can
then update any internal status registers, specify a new return exception,
and set the data that should be returned in the case of a read access. Since
the bridge is associated with the mapping and not the memory-space itself,
several bridges can exist for one space, and devices doing accesses directly
to the memory-space in question will not affect the bridge for non-mapped
addresses. In the latter case, the device itself has to interpret the
Sim_PE_IO_Not_Taken exception. The Sim_PE_IO_Error exception,
indicating that a device returned an error is also sent to the bridge. Finally,
bridges are called for accesses that generate Sim_PE_Inquiry_Outside_Memory,
i.e. an inquiry access where nothing is mapped. In this case the bridge may have
to set a default return value, such as −1.