Previous - Up - Next

3.5   Devices

A device defined by a DML program corresponds directly to a Simics configuration object, i.e., a component that can be included in a Simics configuration. Typically, the device object will make its functionality available by implementing one or more Simics API interfaces (sets of methods).

A configuration object can also contain state (data), and can have any number of attributes, which are a specialized form of interfaces with a pair of get/set methods used for inspecting and manipulating some part of the state. (See the Simics User Guide and Simics Programming Guide for further details about configuration objects, interfaces and attributes.)

3.5.1   Memory-mapped I/O

The most common interface that a device might implement is the io_memory interface, which allows the device to be mapped into a Simics memory space.

To use the standard implementation of the io_memory interface in a DML file, include the following line:

    import "io-memory.dml";

The standard library file io-memory.dml provides the default implementation of the io_memory interface, in such a way that each register bank of the device for which the function parameter is set (to a nonnegative integer), can be easily mapped into a memory space in a Simics configuration by specifying the device object and the function number. Accesses to the mapped addresses are automatically translated into calls to the access method of the corresponding bank.

3.5.2   Connections to other objects

Interaction with other Simics configuration objects from within a device model is made easy through connect objects in DML, which literally serve as connectors, and can be initialized from outside the device - typically in a configuration file. Connected objects are generally expected to implement some particular interface so that the device can communicate with them.

A device can also implement Simics interfaces on its own, in addition to the standard io_memory interface described above. This can be done by defining an implement object containing the necessary methods. The device will be automatically be registered in Simics as implementing the interface.

3.5.3   Attributes

The Simics configuration object attributes that are automatically added to the device object for components such as connects and registers are often sufficient, but is also possible to define arbitrary additional attributes of the device, represented by attribute objects.

Previous - Up - Next