Commands in Simics are written in Python, and they access the internal state of Simics by using the Simics API, and by accessing configuration objects and their attributes. Since modules cannot add functions to the Simics API, all commands for devices and extensions use the configuration system.
There are several benefits of using Python to define commands: The code is forced to make its internal state visible, allowing other script users to access it. The module can be distributed in binary form, while the Python commands are still available with source, allowing a user to change them in a way he or she prefers.
The command can be declared in two files that should reside in the same directory as the source code of the module:
When the module is compiled, these two files (if they exist) are copied to the simics/host/lib/python directory; e.g., simics/x86-linux/lib/python. The resulting file will get the name mod_module-name_commands.py (respectively _gcommands.py) with any dash (-) characters replaced with underscore (_).