1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Permit instructions that end in an address error to differ in transactions.

This commit is contained in:
Thomas Harte 2022-06-08 16:15:33 -04:00
parent da8e6737c6
commit 2e42bda0a3

View File

@ -258,6 +258,8 @@ template <typename M68000> struct Tester {
srand(68000);
for(int c = 0; c < 65536; c++) {
printf("%04x\n", c);
// Test only defined opcodes.
const auto instruction = decoder.decode(uint16_t(c));
if(instruction.operation == InstructionSet::M68k::Operation::Undefined) {
@ -295,7 +297,17 @@ template <typename M68000> struct Tester {
newTester->run_instructions(1);
oldTester->run_instructions(1);
// Compare bus activity.
// Grab final states.
oldState = oldTester->processor.get_state();
newState = newTester->processor.get_state();
// Compare bus activity only if it doesn't look like an address
// error occurred. Don't check those as I don't have good information
// on the proper stack write order, so transactions are permitted to differ.
//
// Net effect will be 50% fewer transaction comparisons for instructions that
// can trigger an address error.
if(oldState.program_counter != 0x1404 || newState.registers.program_counter != 0x1404) {
const auto &oldTransactions = oldTester->bus_handler.transactions;
const auto &newTransactions = newTester->bus_handler.transactions;
@ -321,11 +333,9 @@ template <typename M68000> struct Tester {
++newIt;
++oldIt;
}
}
// Compare registers.
oldState = oldTester->processor.get_state();
newState = newTester->processor.get_state();
bool mismatch = false;
for(int c = 0; c < 8; c++) {
mismatch |= oldState.data[c] != newState.registers.data[c];