#include #include "isa/checker.h" #include "isa/isa.h" void checker::execute() { bool interrupt = system.interact(ctlregs); if (ctlregs[HALTED]) return; inst = decode(ctlregs[DATA_INSTRUCTION_FIELD_BUFFER], pc, mem.fetch(pc), interrupt); auto next_pc = inst.next_pc; if (inst.need_indirect_load) { auto addr = mem.fetch(inst.init_address.value()); if (inst.need_autoinc_store) { addr = (addr + 1) & 07777; mem.store(*inst.init_address, addr); } auto df = ctlregs[DATA_INSTRUCTION_FIELD_BUFFER] >> 3; inst.final_address = (df << 12) | addr; } else { assert(!inst.need_autoinc_store); } if (inst.need_exec_load) inst.data = mem.fetch(inst.final_address.value()); if (inst.need_read_acc) inst.acc = acc; if (inst.need_read_link) inst.link = link; if (inst.need_read_mq) inst.mq = mq; if (inst.read_ctlreg.has_value()) inst.ctlval = ctlregs[*inst.read_ctlreg]; inst.execute(); if (inst.need_write_acc) acc = inst.acc.value(); if (inst.need_write_link) link = inst.link.value(); if (inst.need_write_mq) mq = inst.mq.value(); if (inst.write_ctlreg.has_value()) ctlregs[*inst.write_ctlreg] = inst.ctlval.value(); if (inst.need_exec_store) mem.store(inst.final_address.value(), inst.data.value()); assert(inst.next_pc == next_pc || inst.possibly_redirects); pc = inst.next_pc; }