Previous - Up - Next

4.3   Interfaces

Interfaces allows objects to interact with each other. A interface defines a number of functions. Every class that implements an interface (by registering it) must define those functions. An object A may then ask for an interface registered by an object B, and thus use the interface's functions to communicate with B. Simics comes with many predefined interfaces but you can freely add your owns.

One of the most important interfaces for a device class is probably the io-memory interface. Implementing the io-memory interface enables a class to be mapped into a memory space and be accessed by the simulated machine. In C or DML, it is defined as:

typedef int (*map_func_t)(conf_object_t *obj,
                          addr_space_t memory_or_io,
                          map_info_t map_info);
typedef exception_type_t (*operation_func_t)(conf_object_t *obj,
                                             generic_transaction_t *mem_op,
                                             map_info_t map_info);

typedef struct io_memory_interface {
        map_func_t map;
        operation_func_t operation;
} io_memory_interface_t;

Another important interface is the event-poster interface, which should be implemented by all classes that post events. Other interfaces can be used for things like raising processor interrupts or implementing PCI device functionality. A complete list of all interfaces and functions for handling interfaces can be found in the Simics Reference Manual.

To learn more about interfaces in DML, refer to section 5.3. For C and Python, refer to section 6.5.

Previous - Up - Next