6.3   Approximate Performance Counters and Hardwire Diagnostics

Performance meters and diagnostic functions are usually not accessed during normal operation, and should therefore be abstracted away. If they are ever read, diagnostic registers should normally be hardwired to report "everything OK" without bothering to access any internal state. If performance meters are accessed, it may be necessary to provide approximate values which are computed only when requested.

If you find that the driver reads values from, e.g., a JTAG port, you can look at the driver source code and try to figure out what values it expects to find (look at what it compares the data to), and make the model supply some values that are acceptable.

Sometimes it is necessary to model a bit more. One particular architecture provides interfaces to access parity bits and checksums in the caches. In its boot sequence, the OS performs a self-test on the caches by writing flawed parity bits and checking that the cache handles them gracefully (reporting error or auto-correcting the data). The model of this cache thus needs to simulate the parity bits. To increase performance, however, it is sufficient to simulate this only on cache lines where the parity bits have been accessed.

When approximate or invented values are being returned from the model, it is good practice to issue a warning to the user, and/or print a message to the appropriate log file. See section 9.3 for more on this.