From 6ffe43a8ccee6f3e2d6fda5062901f16c54ddaad Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Mon, 31 Oct 2022 19:26:35 -0700 Subject: Level-trigger on TTO_FLAG instead of edge-trigger. --- io/model.cpp | 3 +-- isa/decode.cpp | 6 +++--- isa/isa.h | 1 - 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/io/model.cpp b/io/model.cpp index 3bea59e..fcabbd2 100644 --- a/io/model.cpp +++ b/io/model.cpp @@ -29,7 +29,7 @@ bool iomodel::interact(std::array &ctlregs) { interrupt = true; } if (ctlregs[TT_INT_ENABLE]) { - if ((ctlregs[TT_BITS] & (TTO_FLAG|TTO_FLAG_OLD)) == TTO_FLAG) + if (ctlregs[TT_BITS] & TTO_FLAG) interrupt = true; } ctlregs[INT_PENDING] = interrupt; @@ -40,7 +40,6 @@ bool iomodel::interact(std::array &ctlregs) { ctlregs[DATA_INSTRUCTION_FIELD_BUFFER] = 0; ctlregs[HALTED] = 0; ctlregs[INT_ENABLE] = 0; - ctlregs[TT_BITS] |= (ctlregs[TT_BITS] & TTO_FLAG) ? TTO_FLAG_OLD : 0; } else { ctlregs[INT_ENABLE] = (ctlregs[INT_ENABLE] >> 1) * 3; } diff --git a/isa/decode.cpp b/isa/decode.cpp index c11679c..1496364 100644 --- a/isa/decode.cpp +++ b/isa/decode.cpp @@ -185,7 +185,7 @@ instruction_context decode(unsigned int dfifb, unsigned int pc, unsigned int bit inst.read_ctlreg = TT_BITS; inst.write_ctlreg = TT_BITS; inst.ef = [](auto &ctx) { - ctx.ctlval.value() |= TTO_FLAG | TTO_FLAG_OLD; + ctx.ctlval.value() |= TTO_FLAG; }; break; case 1: @@ -202,7 +202,7 @@ instruction_context decode(unsigned int dfifb, unsigned int pc, unsigned int bit inst.read_ctlreg = TT_BITS; inst.write_ctlreg = TT_BITS; inst.ef = [](auto &ctx) { - ctx.ctlval.value() &= ~TTO_FLAG & ~TTO_FLAG_OLD; + ctx.ctlval.value() &= ~TTO_FLAG; }; break; case 4: @@ -235,7 +235,7 @@ instruction_context decode(unsigned int dfifb, unsigned int pc, unsigned int bit inst.ef = [](auto &ctx) { auto &x = ctx.ctlval.value(); auto chr = ctx.acc.value(); - x &= ~TTO_FLAG & ~TTO_FLAG_OLD & ~TTO_DATA; + x &= ~TTO_FLAG & ~TTO_DATA; x |= (chr << TTO_DATA_SHIFT) & TTO_DATA; x |= TTO_TX; }; diff --git a/isa/isa.h b/isa/isa.h index 6484cd8..69f8b2a 100644 --- a/isa/isa.h +++ b/isa/isa.h @@ -30,7 +30,6 @@ const std::map ctlreg_map = { static constexpr std::uint_fast32_t TTI_FLAG = 1 << 0; static constexpr std::uint_fast32_t TTO_TX = 1 << 1; static constexpr std::uint_fast32_t TTO_FLAG = 1 << 2; -static constexpr std::uint_fast32_t TTO_FLAG_OLD = 1 << 3; static constexpr unsigned int TTI_DATA_SHIFT = 8; static constexpr unsigned int TTO_DATA_SHIFT = 16; static constexpr std::uint_fast32_t TTI_DATA = 0xff << TTI_DATA_SHIFT; -- cgit v1.2.3