8   Testing Device Models

How do you test a completed model to see if it is accurate and efficient enough? Basically, you try to find software that stresses the device as much as possible. Try different OS/driver combinations (if this is a requirement). Find programs on top of the OS that exercise the device in different ways. Perhaps there are diagnostic programs that verify that the device functions correctly. It is a good idea to run the programs on real hardware first, to make sure the software is functional, before trying them on the virtual hardware.

Run the selected programs in Simics, with the device model in place, and look for signs of trouble. Such signs may be

  1. The device reports accesses to unimplemented features. These will need to be modeled.
  2. The program, OS, or simulated machine behaves strangely, indicating flaws in the device model's functional behavior.
  3. Simulation performance is poor. The model needs to be made more efficient.

It is also a good idea to sometimes let the tests run for a longer time. This allows you to spot problems with, e.g., memory leaks in the model implementation, or diagnose situations where the driver has entered some fall-back mode after seeing too many errors. The VTMEM package can help in diagnosing memory-related problems (see the Simics Reference Manual for details).