diff options
| author | Julian Blake Kongslie | 2022-11-05 16:59:17 -0700 |
|---|---|---|
| committer | Julian Blake Kongslie | 2022-11-05 16:59:31 -0700 |
| commit | 68bdebd8cae39c30acc384664faa136aeaa9bb84 (patch) | |
| tree | 4b0c489accd2eb10af6bc359c9ee0d4b22af64ff /isa/isa.h | |
| parent | Support for more line formats in evt reader (diff) | |
| download | biggolf-68bdebd8cae39c30acc384664faa136aeaa9bb84.tar.xz | |
Add initial uarch model
Diffstat (limited to 'isa/isa.h')
| -rw-r--r-- | isa/isa.h | 10 |
1 files changed, 10 insertions, 0 deletions
| @@ -51,6 +51,11 @@ static constexpr std::uint_fast32_t TTO_DATA = 0xff << TTO_DATA_SHIFT; | |||
| 51 | static constexpr std::uint_fast32_t TTF_INT_ENABLE = 1 << 0; | 51 | static constexpr std::uint_fast32_t TTF_INT_ENABLE = 1 << 0; |
| 52 | static constexpr std::uint_fast32_t TTF_STATUS_ENABLE = 1 << 1; | 52 | static constexpr std::uint_fast32_t TTF_STATUS_ENABLE = 1 << 1; |
| 53 | 53 | ||
| 54 | static std::string opr_disasm_group1[0377]; | ||
| 55 | static std::string opr_disasm_group2_pos[0366]; | ||
| 56 | static std::string opr_disasm_group2_neg[0366]; | ||
| 57 | static std::string opr_disasm_extended_arith[0376]; | ||
| 58 | |||
| 54 | struct instruction_context { | 59 | struct 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 | ||
| 93 | void init_disasm_tables(); | ||
| 84 | instruction_context decode(std::uint_fast32_t flags, unsigned int pc, unsigned int bits, bool interrupt); | 94 | instruction_context decode(std::uint_fast32_t flags, unsigned int pc, unsigned int bits, bool interrupt); |
