Most modules need to do some work when initially loaded into Simics. Typically this work includes registering the classes implemented by the module, and their attributes.
A module written in C/C++ must implement the functions init_local() and fini_local(). They must exist, even if they are empty. The functions are defined as:
void init_local(void) { } void fini_local(void) { }
If the module is written in C++, these functions must be declared extern "C" for C linkage. Simics does currently not support unloading of modules, so fini_local() is usually empty.
Before the first statement, a structured comment is required. It must be formatted as follows:
# MODULE: module-name # CLASS: class-name
The Python file is executed as a program at load time, so all Python statements in global scope will be executed. Normally there will be some statements that registers classes and attributes with Simics.