TEMU  4.4
The Terma Emulator
temu_MemTransaction Struct Reference

#include </builds/termade/temu/temu/include/temu-c/Memory/Memory.h>

Data Fields

uint64_t Va
 64 bit virtual for unified 32/64 bit interface. More...
 
uint64_t Pa
 64 bit physical address More...
 
uint64_t Value
 
uint64_t Size
 
uint64_t Offset
 
temu_InitiatorType InitiatorType
 
temu_Object_Initiator
 
void * Page
 
uint64_t Cycles
 Cycle cost for memory access (initialised to 0). More...
 
uint32_t Flags
 Flags for use in the memory hierarchy. More...
 
void * IR
 
void * Meta
 

Detailed Description

Generic memory transaction.

This type is kept in sync with the emulator core. The layout is guaranteed. and will remain as is, although more fields may be added (at the bottom).

When the emulator core issues a memory transaction (assuming no ATC hit), the core allocates this structure on the stack and fills in some of the fields with default values. The memory transaction is passed by pointer or reference. By filling in the different fields you can adapt the result of the memory transaction.

Field Documentation

◆ Cycles

uint64_t temu_MemTransaction::Cycles

Cycle cost for memory access (initialised to 0).

◆ Flags

uint32_t temu_MemTransaction::Flags

Flags for use in the memory hierarchy.

◆ Initiator

temu_Object_* temu_MemTransaction::Initiator

Initiator of the transaction (a CPU object). It can be null, which indicate that the transaction was not initiated by normal CPU activity (e.g. fetch, read or write). When the initiator is null, models should not attempt to stop the processor core, go to idle mode or raise traps (posting events is fine). An example when the initiator is null is when an MMU does a table walk. The MMU will normally special case handle table walks which access un-mapped memory.

◆ InitiatorType

temu_InitiatorType temu_MemTransaction::InitiatorType

InitiatorType identifies the type of object starting the transaction. this is only relevant when Initiator is set to non-null, and allows for the specification of device pointers in the initator. This field is new in TEMU 2.2. The field was introduced to support the implementation of I/O MMUs.

◆ IR

void* temu_MemTransaction::IR

Intermediate code for interpreter (internally managed do not modify)

◆ Meta

void* temu_MemTransaction::Meta

◆ Offset

uint64_t temu_MemTransaction::Offset

Used for device models, this will be filled in with the offset from the start address of the device (note it is in practice possible to add a device at multiple locations (which happens in some rare cases)).

◆ Pa

uint64_t temu_MemTransaction::Pa

64 bit physical address

◆ Page

void* temu_MemTransaction::Page

Page pointer (for caching), this can be filled in by a memory model to have the emulator core inject the page translation in the ATC. If a model sets this, the page pointer will automatically be cleared if the page has attributes (breakpoints, etc). Models that implement normal memory mapped registers should NOT populate the page pointer.

◆ Size

uint64_t temu_MemTransaction::Size

Two-logarithm of the size of the transaction in bytes it is at most the size of the CPUs max bus size. In case of SPARCv8, this is 4 bytes (double words are issued as two accesses). As this is the 2-log of the size in bytes, a single byte access will have a size of 0, a 2 byte transaction will have size 1, a 4 byte transaction will have size 2 and an 8 byte transaction will have size 3.

In TEMU3 this field was changed to an uint64_t from uint8_t. This as it does not add any additional space. And we can repurpose value and size as follows:

  • The lower 2 bits define the base unit of the transaction (same as before), 0 => 1 byte, 1 => 2 bytes, 2 => 4 bytes, 3 => 8 bytes.
  • The upper bits define the number of transferred units 0 implies one unit. If the transferred units is more than 0, we are dealing with a large transaction. These can be used by e.g. RAM models for block transfers etc. In that case the Value field is to be reinterpreted as a pointer to the location of the data. This means that we can use the memory access interface to e.g. read out send lists and similar items.

The memory space must thus have a way of determining which type of transaction is legal. The MemoryAccessIface has been extended with a capability query, which if implemented has the ability to query for supported features.

◆ Va

uint64_t temu_MemTransaction::Va

64 bit virtual for unified 32/64 bit interface.

◆ Value

uint64_t temu_MemTransaction::Value

Resulting value (or written value). On MMIO Reads the model fills in this value, and on writes the written value will be stored here.


The documentation for this struct was generated from the following file: