The ram
interface is implemented by classes that provide
random access read/write memory. The rom
interface is
identical to ram
but provides read only memory (writes are
dropped by the memory system).
Both the ram and rom interfaces are Simics internal, and should not be used by user-defined classes.
The get_page method is obsolete and should not be implemented.
The fill method fills a range with a specified byte value.
The read method reads a number of bytes from address addr into the buffer data. The number of bytes read is given by the buffer size.
The write method writes the bytes in data to address addr.
The touch method is similar to the read and write methods, except that no data is actually transferred; the method triggers side effects like revoking conflicting direct-memory permissions from affected pages. The rw argument determines whether the operation is a handled as a read or as a write.
The flags argument is a bitmask which modify the behavior of read, write and touch operations in various ways.
The size method returns the memory size in bytes; that is, the highest usable address plus one.
typedef enum { Sim_Ram_Op_Fetch = 1, /* Read is an instruction fetch. */ Sim_Ram_Op_Non_Coherent = 2, /* Operation should not cause atomic reservations to be lost. */ } ram_operation_flags_t; SIM_INTERFACE(ram) { #ifndef PYWRAP /* The get_page is method is obsolete and should be left unimplemented. */ page_t *(*get_page)(conf_object_t *NOTNULL obj, physical_address_t addr); #endif void (*fill)(conf_object_t *NOTNULL obj, physical_address_t start, uint64 length, uint8 value); exception_type_t (*read)(conf_object_t *NOTNULL obj, conf_object_t *initiator, uint64 addr, buffer_t data, ram_operation_flags_t flags); exception_type_t (*write)(conf_object_t *NOTNULL obj, conf_object_t *initiator, uint64 addr, bytes_t data, ram_operation_flags_t flags); exception_type_t (*touch)(conf_object_t *NOTNULL obj, conf_object_t *initiator, uint64 addr, uint64 size, read_or_write_t rw, ram_operation_flags_t flags); uint64 (*size)(conf_object_t *NOTNULL obj); }; #define RAM_INTERFACE "ram" #define ROM_INTERFACE "rom" typedef ram_interface_t rom_interface_t;