diff options
| author | Julian Blake Kongslie | 2022-10-31 21:23:09 -0700 |
|---|---|---|
| committer | Julian Blake Kongslie | 2022-10-31 21:23:09 -0700 |
| commit | ec5b362c3cda195178697192ba5a31643e5c358d (patch) | |
| tree | 949e8d4368892a4799a36a01d92293b346a9655a | |
| parent | Fix trivial typo (diff) | |
| download | biggolf-ec5b362c3cda195178697192ba5a31643e5c358d.tar.xz | |
Fix FLAGS bit handling by IO model
| -rw-r--r-- | io/model.cpp | 8 | ||||
| -rw-r--r-- | 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<std::uint_fast32_t, NUM_CTLREGS> &ctlregs) { | |||
| 33 | if (interrupt) | 33 | if (interrupt) |
| 34 | ctlregs[FLAGS] |= FLAG_INT_REQUEST; | 34 | ctlregs[FLAGS] |= FLAG_INT_REQUEST; |
| 35 | else | 35 | else |
| 36 | ctlregs[FLAGS] &= !FLAG_INT_REQUEST; | 36 | ctlregs[FLAGS] &= ~FLAG_INT_REQUEST; |
| 37 | interrupt = interrupt && (ctlregs[FLAGS] & FLAG_INT_ENABLE); | 37 | interrupt = interrupt && (ctlregs[FLAGS] & FLAG_INT_ENABLE); |
| 38 | 38 | ||
| 39 | if (ctlregs[FLAGS] & FLAG_INT_ENABLE_DELAY) | ||
| 40 | ctlregs[FLAGS] |= FLAG_INT_ENABLE; | ||
| 41 | |||
| 39 | if (interrupt) { | 42 | if (interrupt) { |
| 40 | ctlregs[FLAGS_SAVED] = ctlregs[FLAGS]; | 43 | ctlregs[FLAGS_SAVED] = ctlregs[FLAGS]; |
| 41 | ctlregs[FLAGS] = 0; | 44 | ctlregs[FLAGS] = 0; |
| 42 | ctlregs[HALTED] = 0; | 45 | ctlregs[HALTED] = 0; |
| 43 | } else { | ||
| 44 | if (ctlregs[FLAGS] & FLAG_INT_ENABLE_DELAY) | ||
| 45 | ctlregs[FLAGS] |= FLAG_INT_ENABLE; | ||
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | return interrupt; | 48 | return interrupt; |
| @@ -36,7 +36,7 @@ static constexpr std::uint_fast32_t FLAG_INT_ENABLE = 1 << 7; | |||
| 36 | static constexpr std::uint_fast32_t FLAG_INT_INHIBIT = 1 << 8; | 36 | static constexpr std::uint_fast32_t FLAG_INT_INHIBIT = 1 << 8; |
| 37 | static constexpr std::uint_fast32_t FLAG_INT_REQUEST = 1 << 9; | 37 | static constexpr std::uint_fast32_t FLAG_INT_REQUEST = 1 << 9; |
| 38 | static constexpr std::uint_fast32_t FLAG_GREATER_THAN = 1 << 10; | 38 | static constexpr std::uint_fast32_t FLAG_GREATER_THAN = 1 << 10; |
| 39 | static constexpr std::uint_fast32_t FLAG_INT_ENABLE_DELAY = 1 << 12; | 39 | static constexpr std::uint_fast32_t FLAG_INT_ENABLE_DELAY = 1 << 12; // n.b. this is not a "visible" flag |
| 40 | 40 | ||
| 41 | // TT_BITS | 41 | // TT_BITS |
| 42 | static constexpr std::uint_fast32_t TTI_FLAG = 1 << 0; | 42 | static constexpr std::uint_fast32_t TTI_FLAG = 1 << 0; |
