From a599aa782028dfc9e8b1fd63c2971e53a13f77e6 Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Tue, 1 Nov 2022 09:18:50 -0700 Subject: Implemented the remaining instructions required for echo_optimal. --- isa/decode.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/isa/decode.cpp b/isa/decode.cpp index c52780c..77bbe8b 100644 --- a/isa/decode.cpp +++ b/isa/decode.cpp @@ -130,9 +130,20 @@ instruction_context decode(std::uint_fast32_t flags, unsigned int pc, unsigned i break; case 5: // RTF restore flags + inst.read_ctlreg = FLAGS; + inst.need_read_acc = true; + inst.need_write_link = true; + inst.write_ctlreg = FLAGS; inst.ef = [](auto &ctx) { - std::cerr << "unimplemented RTF\n"; - assert(false); + if ((ctx.ctlval.value() & FLAG_INT_ENABLE) && (ctx.acc.value() & FLAG_INT_ENABLE)) { + ctx.ctlval = ctx.acc.value() | FLAG_INT_ENABLE_DELAY; + } else if (ctx.acc.value() & FLAG_INT_ENABLE) { + ctx.ctlval = (ctx.acc.value() | FLAG_INT_ENABLE_DELAY) & ~FLAG_INT_ENABLE; + } else { + ctx.ctlval = ctx.acc.value(); + } + ctx.link = ctx.ctlval.value() & (1 << 11); + ctx.ctlval.value() &= ~(1 << 11); }; break; case 6: @@ -258,6 +269,35 @@ instruction_context decode(std::uint_fast32_t flags, unsigned int pc, unsigned i }; } break; + case 020: + case 021: + case 022: + case 023: + case 024: + case 025: + case 026: + case 027: + // MEMORY MANAGEMENT + { + auto field = (bits >> 3) & 07; + switch (bits & 07) { + case 01: + // CDF change data field + inst.read_ctlreg = FLAGS; + inst.write_ctlreg = FLAGS; + inst.ef = [field](auto &ctx) { + ctx.ctlval.value() &= ~FLAG_DF; + ctx.ctlval.value() |= field << FLAG_DF_SHIFT; + }; + break; + default: + inst.ef = [bits, field](auto &ctx) { + std::cerr << "unimplemented IOT MEMORY suboperation " << (bits & 07) << " upon field " << field << "\n"; + assert(false); + }; + } + } + break; default: inst.ef = [bits](auto &ctx) { std::cerr << "unimplemented IOT device " << ((bits >> 6) & 07) << ((bits >> 3) & 07) << " suboperation " << (bits & 07) << "\n"; -- cgit v1.2.3