From 6b45e0f81267be6140f0f178579494ca6d24443b Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Mon, 31 Oct 2022 19:55:32 -0700 Subject: Restructure a lot of the control registers --- isa/isa.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'isa/isa.h') diff --git a/isa/isa.h b/isa/isa.h index 69f8b2a..71f852e 100644 --- a/isa/isa.h +++ b/isa/isa.h @@ -26,15 +26,31 @@ const std::map ctlreg_map = { #undef REG }; +// FLAGS and FLAGS_SAVED +static constexpr unsigned int FLAG_DF_SHIFT = 0; +static constexpr std::uint_fast32_t FLAG_DF = 07 << FLAG_DF_SHIFT; +static constexpr unsigned int FLAG_IF_SHIFT = 3; +static constexpr std::uint_fast32_t FLAG_IF = 07 << FLAG_IF_SHIFT; // In FLAGS this is IFB, not IF +static constexpr std::uint_fast32_t FLAG_USER_MODE = 1 << 6; +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; + // TT_BITS 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 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; +static constexpr unsigned int TTO_DATA_SHIFT = 16; static constexpr std::uint_fast32_t TTO_DATA = 0xff << TTO_DATA_SHIFT; +// TT_FLAGS +static constexpr std::uint_fast32_t TTF_INT_ENABLE = 1 << 0; +static constexpr std::uint_fast32_t TTF_STATUS_ENABLE = 1 << 1; + struct instruction_context { // Known statically at decode time bool need_indirect_load = false; // final_address = mem[init_address] @@ -65,4 +81,4 @@ struct instruction_context { std::optional mq; }; -instruction_context decode(unsigned int df, unsigned int pc, unsigned int bits, bool interrupt); +instruction_context decode(std::uint_fast32_t flags, unsigned int pc, unsigned int bits, bool interrupt); -- cgit v1.2.3