#include #include "isa/checker.h" #include "isa/isa.h" void checker::execute() { assert(!halted); auto int_enable_delay = ctlregs[INT_ENABLE] >> 1; if (ctlregs[INT_ENABLE] & 1) { // check for interrupt } ctlregs[INT_ENABLE] = (int_enable_delay << 1) | int_enable_delay; auto inst = decode(ctlregs[DATA_INSTRUCTION_FIELD_BUFFER], pc, mem.fetch(pc)); auto next_pc = inst.next_pc; if (inst.need_indirect_load) { auto addr = mem.fetch(inst.init_address.value()); if (inst.need_autoinc_store) mem.store(*inst.init_address, (addr + 1) & 07777); inst.final_address = 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.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.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; halted = inst.halt; }