json validation test: treat invalid instructions as an error
This commit is contained in:
parent
6bd04ac84b
commit
c749ea98ee
3 changed files with 17 additions and 10 deletions
14
cpu.cpp
14
cpu.cpp
|
@ -2467,7 +2467,7 @@ std::map<std::string, std::vector<std::string> > cpu::disassemble(const uint16_t
|
|||
return out;
|
||||
}
|
||||
|
||||
void cpu::step()
|
||||
bool cpu::step()
|
||||
{
|
||||
it_is_a_trap = false;
|
||||
|
||||
|
@ -2491,24 +2491,28 @@ void cpu::step()
|
|||
add_register(7, 2);
|
||||
|
||||
if (double_operand_instructions(instr))
|
||||
return;
|
||||
return true;
|
||||
|
||||
if (conditional_branch_instructions(instr))
|
||||
return;
|
||||
return true;
|
||||
|
||||
if (condition_code_operations(instr))
|
||||
return;
|
||||
return true;
|
||||
|
||||
if (misc_operations(instr))
|
||||
return;
|
||||
return true;
|
||||
|
||||
DOLOG(warning, false, "UNHANDLED instruction %06o @ %06o", instr, instruction_start);
|
||||
|
||||
trap(010); // floating point nog niet geimplementeerd
|
||||
|
||||
return false;
|
||||
}
|
||||
catch(const int exception_nr) {
|
||||
TRACE("bus-trap during execution of command (%d)", exception_nr);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
JsonDocument cpu::serialize()
|
||||
|
|
2
cpu.h
2
cpu.h
|
@ -141,7 +141,7 @@ public:
|
|||
|
||||
void reset();
|
||||
|
||||
void step();
|
||||
bool step();
|
||||
|
||||
void pushStack(const uint16_t v);
|
||||
uint16_t popStack();
|
||||
|
|
11
main.cpp
11
main.cpp
|
@ -136,14 +136,17 @@ int run_cpu_validation(console *const cnsl, const std::string & filename)
|
|||
b->write_physical(element.first, element.second);
|
||||
}
|
||||
|
||||
int cur_n_errors = 0;
|
||||
|
||||
// DO!
|
||||
c->emulation_start();
|
||||
disassemble(c, nullptr, c->getPC(), false);
|
||||
c->step();
|
||||
|
||||
if (c->step() == false) {
|
||||
cnsl->put_string_lf("Treated as an invalid instruction");
|
||||
cur_n_errors++;
|
||||
}
|
||||
// VERIFY
|
||||
int cur_n_errors = 0;
|
||||
{
|
||||
else {
|
||||
auto after = test["after"];
|
||||
|
||||
cur_n_errors += !compare_values(cnsl, c->getPC(), get_register_value(after, "PC" ), "PC" );
|
||||
|
|
Loading…
Add table
Reference in a new issue