VIRTUTECH CONFIDENTIAL    Previous - Up - Next

memory_space

Implemented By
memory-space
Description
This interface is implemented by classes that provide linear address spaces. Other objects may perform accesses in the address space using the access() function or one of the simplified access functions, or may ask for mapped objects using space_lookup(). Typical usage of this interface would be memory accesses from devices or processors.

The access_simple() function is similar to access() but takes some additional arguments instead of a complete generic_transaction_t structure. An inquiry version of this function is available as access_simple_inq(). Both these functions can perform endian conversion if the buffer pointed to by buf contains a value in host endian byte-order. To avoid endian conversion, Sim_Endian_Target should be specified as endian. These two functions are not available from Python.

The functions read() and write() operate on data in an attr_value_t format. This is useful for accesses from Python, but they can also be used from C/C++. The value returned by read() is statically allocated and should be copied to a destination buffer directly after the call. The largest amount of data that can be transferred in a single read() call is 1024 bytes. If the write() function fails, the pseudo exception is returned as an integer.

#define MEMORY_SPACE_INTERFACE "memory_space"
struct memory_space_interface {
        map_list_t *(*space_lookup)(conf_object_t *NOTNULL obj,
                                    generic_transaction_t *NOTNULL mop,
                                    map_info_t mapinfo);
        exception_type_t (*access)(conf_object_t *NOTNULL obj,
                                   generic_transaction_t *NOTNULL mop);
        exception_type_t (*access_simple)(conf_object_t *obj,
                                          conf_object_t *initiator,
                                          physical_address_t addr,
                                          char *buf,
                                          physical_address_t len,
                                          read_or_write_t type,
                                          endianness_t endian);
        exception_type_t (*access_simple_inq)(conf_object_t *obj,
                                              conf_object_t *initiator,
                                              physical_address_t addr,
                                              char *buf,
                                              physical_address_t len,
                                              read_or_write_t type,
                                              endianness_t endian);
        attr_value_t (*read)(conf_object_t *NOTNULL obj,
                             conf_object_t *initiator,
                             physical_address_t addr,
                             int length,
                             int inquiry);
        exception_type_t (*write)(conf_object_t *NOTNULL obj,
                                  conf_object_t *initiator,
                                  physical_address_t addr,
                                  attr_value_t data,
                                  int inquiry);
        cycles_t (*timing_model_operate)(conf_object_t *NOTNULL space,
                                         generic_transaction_t *NOTNULL mop);
};

VIRTUTECH CONFIDENTIAL    Previous - Up - Next