|
But comparing logs depends on your I/O registers working properly.
The way I described, it doesn't matter how the I/O system is implemented or whether it works properly. All that's compared is the operation of each CPU core in the environment.
For example, I run the control CPU core for one instruction and it makes a memory read then a write. The memory read is made like normal, then the address and value are logged. The memory write is performed as normal, and the address and data written are logged. Then I run the CPU under test. Its memory accesses go to special functions which only verify that the address matches the one in the log (and in the same order the accesses were originally made). For a memory read it returns the original value read (i.e. doesn't access the emulated hardware again). For a memory write it verifies that the same data value is being written. After running the CPU under test, it verifies that the same number of memory events occurred, then compares all registers and the cycle count.
Thus, it doesn't matter how well the hardware is emulated (though, if it's emulated very poorly, the code being executed might not do anything interesting, and thus might not exercise much of the CPU emulators).
|