From a59407a215d6112c2e20b1a746b33742209e5f87 Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Sun, 16 Oct 2022 16:24:49 -0700 Subject: Support for log-based event model --- isa/checker.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'isa/checker.cpp') diff --git a/isa/checker.cpp b/isa/checker.cpp index 1919bd1..7bca5c9 100644 --- a/isa/checker.cpp +++ b/isa/checker.cpp @@ -4,16 +4,17 @@ #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; + bool interrupt = system.interact(ctlregs); + + if (ctlregs[HALTED]) + return; + inst = decode(ctlregs[DATA_INSTRUCTION_FIELD_BUFFER], pc, - mem.fetch(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) @@ -22,8 +23,10 @@ void checker::execute() { } 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) @@ -32,7 +35,9 @@ void checker::execute() { 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) @@ -41,9 +46,10 @@ void checker::execute() { 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; - halted = inst.halt; } -- cgit v1.2.3