From ec5b362c3cda195178697192ba5a31643e5c358d Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Mon, 31 Oct 2022 21:23:09 -0700 Subject: Fix FLAGS bit handling by IO model --- io/model.cpp | 8 ++++---- isa/isa.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/io/model.cpp b/io/model.cpp index fb9f62b..79bc511 100644 --- a/io/model.cpp +++ b/io/model.cpp @@ -33,16 +33,16 @@ bool iomodel::interact(std::array &ctlregs) { if (interrupt) ctlregs[FLAGS] |= FLAG_INT_REQUEST; else - ctlregs[FLAGS] &= !FLAG_INT_REQUEST; + ctlregs[FLAGS] &= ~FLAG_INT_REQUEST; interrupt = interrupt && (ctlregs[FLAGS] & FLAG_INT_ENABLE); + if (ctlregs[FLAGS] & FLAG_INT_ENABLE_DELAY) + ctlregs[FLAGS] |= FLAG_INT_ENABLE; + if (interrupt) { ctlregs[FLAGS_SAVED] = ctlregs[FLAGS]; ctlregs[FLAGS] = 0; ctlregs[HALTED] = 0; - } else { - if (ctlregs[FLAGS] & FLAG_INT_ENABLE_DELAY) - ctlregs[FLAGS] |= FLAG_INT_ENABLE; } return interrupt; diff --git a/isa/isa.h b/isa/isa.h index 71f852e..8156c08 100644 --- a/isa/isa.h +++ b/isa/isa.h @@ -36,7 +36,7 @@ static constexpr std::uint_fast32_t FLAG_INT_ENABLE = 1 << 7; static constexpr std::uint_fast32_t FLAG_INT_INHIBIT = 1 << 8; static constexpr std::uint_fast32_t FLAG_INT_REQUEST = 1 << 9; static constexpr std::uint_fast32_t FLAG_GREATER_THAN = 1 << 10; -static constexpr std::uint_fast32_t FLAG_INT_ENABLE_DELAY = 1 << 12; +static constexpr std::uint_fast32_t FLAG_INT_ENABLE_DELAY = 1 << 12; // n.b. this is not a "visible" flag // TT_BITS static constexpr std::uint_fast32_t TTI_FLAG = 1 << 0; -- cgit v1.2.3