From be84ce657b6b5ed6ba0cb590718eadc983fdac0d Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 9 Jun 2022 16:18:04 -0400 Subject: [PATCH] Add an optional testing whitelist. --- .../Mac/Clock SignalTests/68000OldVsNew.mm | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/OSBindings/Mac/Clock SignalTests/68000OldVsNew.mm b/OSBindings/Mac/Clock SignalTests/68000OldVsNew.mm index 133205668..e96513e60 100644 --- a/OSBindings/Mac/Clock SignalTests/68000OldVsNew.mm +++ b/OSBindings/Mac/Clock SignalTests/68000OldVsNew.mm @@ -262,17 +262,28 @@ template struct Tester { // Use a fixed seed to guarantee continuity across repeated runs. srand(68000); + std::set test_set = { + InstructionSet::M68k::Operation::ABCD, + InstructionSet::M68k::Operation::SBCD, + InstructionSet::M68k::Operation::MOVEb, + InstructionSet::M68k::Operation::MOVEw, + InstructionSet::M68k::Operation::MOVEl, + InstructionSet::M68k::Operation::PEA, + InstructionSet::M68k::Operation::MOVEtoSR, + InstructionSet::M68k::Operation::MOVEtoCCR, + InstructionSet::M68k::Operation::JSR, + InstructionSet::M68k::Operation::DIVU, + InstructionSet::M68k::Operation::RTE, + InstructionSet::M68k::Operation::RTR, + InstructionSet::M68k::Operation::TAS, + }; + std::set failing_operations; for(int c = 0; c < 65536; c++) { printf("%04x\n", c); - // Test only defined opcodes. + // Test only defined opcodes that aren't STOP (which will never teminate). const auto instruction = decoder.decode(uint16_t(c)); -// if( -// instruction.operation != InstructionSet::M68k::Operation::RTE -// ) { -// continue; -// } if( instruction.operation == InstructionSet::M68k::Operation::Undefined || instruction.operation == InstructionSet::M68k::Operation::STOP @@ -280,6 +291,11 @@ template struct Tester { continue; } + // If a whitelist is in place, adhere to it. + if(!test_set.empty() && test_set.find(instruction.operation) == test_set.end()) { + continue; + } + // Test each 1000 times. for(int test = 0; test < 1000; test++) { // Establish with certainty the initial memory state. @@ -321,7 +337,7 @@ template struct Tester { // // 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) { +// if(oldState.program_counter != 0x1404 || newState.registers.program_counter != 0x1404) { const auto &oldTransactions = oldTester->bus_handler.transactions; const auto &newTransactions = newTester->bus_handler.transactions; @@ -355,7 +371,7 @@ template struct Tester { ++newIt; ++oldIt; } - } +// } // Compare registers. bool mismatch = false;