9.2   Checkpointing

The ability to checkpoint and restore the state of a system is crucial to Simics functionality. Your device model should support checkpointing. In particular, you should ensure that:

Attributes containing information which is set when a configuration is first loaded, have historically been coded as not being dynamically settable (as changing such information on the fly could compromise the stability and consistency of the simulation). Their contents are supposed to maintain the same value over the entire life of a Simics process; thus, updating them does not make sense. In order to support Simics Hindsight, however, it is necessary to make these attributes settable. The solution is to check that the value being set is the same as the previous value (i.e., the one set upon initialization), and if not, report an error.

Furthermore, device models often cache parts of their state internally for the sake of speed, rather than keeping it accessible via attributes. To ensure correct behavior, e.g. when reversing to a micro-checkpoint, all internal caches have to be cleared when an attribute is set.

In the case that a module lacks any attributes that can be used to indicate flushing of the state, there is a special interface temporal_state_interface_t available that lets a module get callbacks when the state is being reset for Hindsight micro-checkpoints. This is however very rarely needed.