Previous - Up - Next

4   Programming Concepts

A Simics module is just some executable code loaded dynamically into the simulator, so it could virtually perform any operation. To be of any practical use however, a module has to interact with Simics, other modules, or the user. Simics provides a set of functions (the Simics API) for the modules to work within the simulator framework. The API defines a number of concepts like classes, objects, interfaces, haps and events, which will be presented below. The Simics Reference Manual provides the complete API documentation.

Simics modules can be written using different programming languages:

DML (Device Modeling Language)
DML has been designed to make writing new device model as simple as possible. It integrates in the language many of the concepts defined by the Simics API so that the user can focus on the model rather than on the interaction with Simics. This is by far the best language to write a device model. Note that although it was designed with device models in mind, DML can be used to develop other types of modules.
Python can be used to quickly write a new Simics module. It is well suited for Simics extensions that are not called very often, like some types of statistics gathering, or BIOS emulation. It can also be used for fast prototyping of more complex extensions that later on will be rewritten in a compiled language like C or DML. Note that in all cases, DML is easier to use than Python to write a device model.
C/C++ can be used for writing any type of Simics modules. Writing in C/C++ exposes all interactions with Simics, which can be sometimes cumbersome. C/C++ development is only recommended if the functionality being developed could seriously impact Simics performance (by being called very often during execution, by manipulating large quantities of data, ...). A few specialized functions in the API (like the Micro-Architectural Interface) are only available to C/C++ modules.

This chapter will cover the concepts that the Simics API defines. It will also present how to use them, first in DML, then in Python and C/C++.

4.1   Classes and Objects

4.2   Attributes

4.3   Interfaces

4.4   Logging

4.5   Events

4.6   Haps

4.7   Commands

Previous - Up - Next