SP verification
This commit is contained in:
parent
881447b7c7
commit
42c57f1c3a
3 changed files with 16 additions and 2 deletions
4
cpu.cpp
4
cpu.cpp
|
@ -1671,7 +1671,7 @@ void cpu::trap(uint16_t vector, const int new_ipl, const bool is_interrupt)
|
|||
|
||||
it_is_a_trap = true;
|
||||
|
||||
for(;;) {
|
||||
do {
|
||||
try {
|
||||
processing_trap_depth++;
|
||||
|
||||
|
@ -1722,7 +1722,6 @@ void cpu::trap(uint16_t vector, const int new_ipl, const bool is_interrupt)
|
|||
|
||||
// if we reach this point then the trap was processed without causing
|
||||
// another trap
|
||||
break;
|
||||
}
|
||||
catch(const int exception) {
|
||||
DOLOG(debug, true, "trap during execution of trap (%d)", exception);
|
||||
|
@ -1730,6 +1729,7 @@ void cpu::trap(uint16_t vector, const int new_ipl, const bool is_interrupt)
|
|||
setPSW(before_psw, false);
|
||||
}
|
||||
}
|
||||
while(0);
|
||||
}
|
||||
|
||||
cpu::operand_parameters cpu::addressing_to_string(const uint8_t mode_register, const uint16_t pc, const word_mode_t word_mode) const
|
||||
|
|
1
cpu.h
1
cpu.h
|
@ -150,6 +150,7 @@ public:
|
|||
void lowlevel_register_sp_set(const uint8_t set, const uint16_t value);
|
||||
uint16_t lowlevel_register_get(const uint8_t set, const uint8_t reg);
|
||||
void lowlevel_psw_set(const uint16_t value) { psw = value; }
|
||||
uint16_t lowlevel_register_sp_get(const uint8_t nr) const { return sp[nr]; }
|
||||
|
||||
void setStackPointer(const int which, const uint16_t value) { assert(which >= 0 && which < 4); sp[which] = value; }
|
||||
void setPC(const uint16_t value) { pc = value; }
|
||||
|
|
13
main.cpp
13
main.cpp
|
@ -174,6 +174,19 @@ int run_cpu_validation(const std::string & filename)
|
|||
}
|
||||
|
||||
// TODO check SP[]
|
||||
{
|
||||
json_t *a_sp = json_object_get(registers_after, "sp");
|
||||
size_t array_size = json_array_size(a_sp);
|
||||
assert(array_size == 4);
|
||||
for(size_t i=0; i<array_size; i++) {
|
||||
json_t *temp = json_array_get(a_sp, i);
|
||||
uint16_t sp = c->lowlevel_register_sp_get(i);
|
||||
if (json_integer_value(temp) != sp) {
|
||||
DOLOG(warning, true, "SP[%d] register mismatch (is: %06o (%d), should be: %06o (%d))", i, sp, sp, json_integer_value(temp), json_integer_value(temp));
|
||||
err = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
json_t *a_psw = json_object_get(registers_after, "psw");
|
||||
|
|
Loading…
Add table
Reference in a new issue