mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 23:52:26 +00:00
Add an optional testing whitelist.
This commit is contained in:
parent
64053d697f
commit
be84ce657b
@ -262,17 +262,28 @@ template <typename M68000> struct Tester {
|
|||||||
// Use a fixed seed to guarantee continuity across repeated runs.
|
// Use a fixed seed to guarantee continuity across repeated runs.
|
||||||
srand(68000);
|
srand(68000);
|
||||||
|
|
||||||
|
std::set<InstructionSet::M68k::Operation> 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<InstructionSet::M68k::Operation> failing_operations;
|
std::set<InstructionSet::M68k::Operation> failing_operations;
|
||||||
for(int c = 0; c < 65536; c++) {
|
for(int c = 0; c < 65536; c++) {
|
||||||
printf("%04x\n", 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));
|
const auto instruction = decoder.decode(uint16_t(c));
|
||||||
// if(
|
|
||||||
// instruction.operation != InstructionSet::M68k::Operation::RTE
|
|
||||||
// ) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
if(
|
if(
|
||||||
instruction.operation == InstructionSet::M68k::Operation::Undefined ||
|
instruction.operation == InstructionSet::M68k::Operation::Undefined ||
|
||||||
instruction.operation == InstructionSet::M68k::Operation::STOP
|
instruction.operation == InstructionSet::M68k::Operation::STOP
|
||||||
@ -280,6 +291,11 @@ template <typename M68000> struct Tester {
|
|||||||
continue;
|
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.
|
// Test each 1000 times.
|
||||||
for(int test = 0; test < 1000; test++) {
|
for(int test = 0; test < 1000; test++) {
|
||||||
// Establish with certainty the initial memory state.
|
// Establish with certainty the initial memory state.
|
||||||
@ -321,7 +337,7 @@ template <typename M68000> struct Tester {
|
|||||||
//
|
//
|
||||||
// Net effect will be 50% fewer transaction comparisons for instructions that
|
// Net effect will be 50% fewer transaction comparisons for instructions that
|
||||||
// can trigger an address error.
|
// 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 &oldTransactions = oldTester->bus_handler.transactions;
|
||||||
const auto &newTransactions = newTester->bus_handler.transactions;
|
const auto &newTransactions = newTester->bus_handler.transactions;
|
||||||
|
|
||||||
@ -355,7 +371,7 @@ template <typename M68000> struct Tester {
|
|||||||
++newIt;
|
++newIt;
|
||||||
++oldIt;
|
++oldIt;
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Compare registers.
|
// Compare registers.
|
||||||
bool mismatch = false;
|
bool mismatch = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user