Whenever an error occurs in a Simics API function, that function will raise an exception. An exception consists of an exception type and an error message.
The following exception types are defined in the Simics API:
typedef enum sim_exception { SimExc_No_Exception, SimExc_General, SimExc_Lookup, SimExc_Attribute, SimExc_IOError, SimExc_Index, SimExc_Memory, SimExc_InquiryOutsideMemory, SimExc_InquiryUnhandled, SimExc_Type, SimExc_Break, SimExc_PythonTranslation, SimExc_License, SimExc_IllegalValue, SimExc_InterfaceNotFound, SimExc_AttrNotFound, SimExc_AttrNotReadable, SimExc_AttrNotWritable } sim_exception_t;
Note that API users writing in C must use SIM_clear_exception()
and SIM_last_error() since C does not support exceptions. In
Python, the Simics API exceptions will trigger actual Python exceptions,
which you can capture using try ... except
.