summaryrefslogtreecommitdiff
path: root/isa/isa.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--isa/isa.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/isa/isa.h b/isa/isa.h
index 8156c08..4083e16 100644
--- a/isa/isa.h
+++ b/isa/isa.h
@@ -51,6 +51,11 @@ static constexpr std::uint_fast32_t TTO_DATA = 0xff << TTO_DATA_SHIFT;
51static constexpr std::uint_fast32_t TTF_INT_ENABLE = 1 << 0; 51static constexpr std::uint_fast32_t TTF_INT_ENABLE = 1 << 0;
52static constexpr std::uint_fast32_t TTF_STATUS_ENABLE = 1 << 1; 52static constexpr std::uint_fast32_t TTF_STATUS_ENABLE = 1 << 1;
53 53
54static std::string opr_disasm_group1[0377];
55static std::string opr_disasm_group2_pos[0366];
56static std::string opr_disasm_group2_neg[0366];
57static std::string opr_disasm_extended_arith[0376];
58
54struct instruction_context { 59struct instruction_context {
55 // Known statically at decode time 60 // Known statically at decode time
56 bool need_indirect_load = false; // final_address = mem[init_address] 61 bool need_indirect_load = false; // final_address = mem[init_address]
@@ -67,10 +72,14 @@ struct instruction_context {
67 bool need_exec_store = false; // mem[final_address] = data 72 bool need_exec_store = false; // mem[final_address] = data
68 bool possibly_redirects = false; // %pc = next_pc 73 bool possibly_redirects = false; // %pc = next_pc
69 74
75 const char *df = nullptr;
76 std::string disasm() const;
77
70 std::function<void(instruction_context &ctx)> ef; 78 std::function<void(instruction_context &ctx)> ef;
71 void execute() { ef(*this); } 79 void execute() { ef(*this); }
72 80
73 // May change over the lifetime of the instruction execution 81 // May change over the lifetime of the instruction execution
82 unsigned int bits;
74 unsigned int next_pc; // includes IF 83 unsigned int next_pc; // includes IF
75 std::optional<unsigned int> init_address; // includes DF 84 std::optional<unsigned int> init_address; // includes DF
76 std::optional<unsigned int> final_address; // includes DF 85 std::optional<unsigned int> final_address; // includes DF
@@ -81,4 +90,5 @@ struct instruction_context {
81 std::optional<unsigned int> mq; 90 std::optional<unsigned int> mq;
82}; 91};
83 92
93void init_disasm_tables();
84instruction_context decode(std::uint_fast32_t flags, unsigned int pc, unsigned int bits, bool interrupt); 94instruction_context decode(std::uint_fast32_t flags, unsigned int pc, unsigned int bits, bool interrupt);