summaryrefslogtreecommitdiff
path: root/isa/isa.h
diff options
context:
space:
mode:
authorJulian Blake Kongslie2022-10-31 19:55:32 -0700
committerJulian Blake Kongslie2022-10-31 19:55:32 -0700
commit6b45e0f81267be6140f0f178579494ca6d24443b (patch)
treec0ed8beeb65259e3069dd04ddff54b4b16593310 /isa/isa.h
parentLevel-trigger on TTO_FLAG instead of edge-trigger. (diff)
downloadbiggolf-6b45e0f81267be6140f0f178579494ca6d24443b.tar.xz
Restructure a lot of the control registers
Diffstat (limited to 'isa/isa.h')
-rw-r--r--isa/isa.h20
1 files changed, 18 insertions, 2 deletions
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<std::string, ctlreg> ctlreg_map = {
26#undef REG 26#undef REG
27}; 27};
28 28
29// FLAGS and FLAGS_SAVED
30static constexpr unsigned int FLAG_DF_SHIFT = 0;
31static constexpr std::uint_fast32_t FLAG_DF = 07 << FLAG_DF_SHIFT;
32static constexpr unsigned int FLAG_IF_SHIFT = 3;
33static constexpr std::uint_fast32_t FLAG_IF = 07 << FLAG_IF_SHIFT; // In FLAGS this is IFB, not IF
34static constexpr std::uint_fast32_t FLAG_USER_MODE = 1 << 6;
35static constexpr std::uint_fast32_t FLAG_INT_ENABLE = 1 << 7;
36static constexpr std::uint_fast32_t FLAG_INT_INHIBIT = 1 << 8;
37static constexpr std::uint_fast32_t FLAG_INT_REQUEST = 1 << 9;
38static constexpr std::uint_fast32_t FLAG_GREATER_THAN = 1 << 10;
39static constexpr std::uint_fast32_t FLAG_INT_ENABLE_DELAY = 1 << 12;
40
29// TT_BITS 41// TT_BITS
30static constexpr std::uint_fast32_t TTI_FLAG = 1 << 0; 42static constexpr std::uint_fast32_t TTI_FLAG = 1 << 0;
31static constexpr std::uint_fast32_t TTO_TX = 1 << 1; 43static constexpr std::uint_fast32_t TTO_TX = 1 << 1;
32static constexpr std::uint_fast32_t TTO_FLAG = 1 << 2; 44static constexpr std::uint_fast32_t TTO_FLAG = 1 << 2;
33static constexpr unsigned int TTI_DATA_SHIFT = 8; 45static constexpr unsigned int TTI_DATA_SHIFT = 8;
34static constexpr unsigned int TTO_DATA_SHIFT = 16;
35static constexpr std::uint_fast32_t TTI_DATA = 0xff << TTI_DATA_SHIFT; 46static constexpr std::uint_fast32_t TTI_DATA = 0xff << TTI_DATA_SHIFT;
47static constexpr unsigned int TTO_DATA_SHIFT = 16;
36static constexpr std::uint_fast32_t TTO_DATA = 0xff << TTO_DATA_SHIFT; 48static constexpr std::uint_fast32_t TTO_DATA = 0xff << TTO_DATA_SHIFT;
37 49
50// TT_FLAGS
51static constexpr std::uint_fast32_t TTF_INT_ENABLE = 1 << 0;
52static constexpr std::uint_fast32_t TTF_STATUS_ENABLE = 1 << 1;
53
38struct instruction_context { 54struct instruction_context {
39 // Known statically at decode time 55 // Known statically at decode time
40 bool need_indirect_load = false; // final_address = mem[init_address] 56 bool need_indirect_load = false; // final_address = mem[init_address]
@@ -65,4 +81,4 @@ struct instruction_context {
65 std::optional<unsigned int> mq; 81 std::optional<unsigned int> mq;
66}; 82};
67 83
68instruction_context decode(unsigned int df, unsigned int pc, unsigned int bits, bool interrupt); 84instruction_context decode(std::uint_fast32_t flags, unsigned int pc, unsigned int bits, bool interrupt);