diff options
author | bd <bdunahu@operationnull.com> | 2025-03-28 19:55:04 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-03-28 19:55:04 -0400 |
commit | 7b3abbd51c91b51725a12d17fad6ecbfcdb19975 (patch) | |
tree | 4fdd60cc2de9f0a68814bf47d42d675593a965a0 /inc/instr.h | |
parent | 9cd1f287f0c86b36788cd8ede812b847c584f711 (diff) |
Move get_instr_fields, add all instruction mnemonics
Diffstat (limited to 'inc/instr.h')
-rw-r--r-- | inc/instr.h | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/inc/instr.h b/inc/instr.h index ce08685..98ecf1d 100644 --- a/inc/instr.h +++ b/inc/instr.h @@ -1,13 +1,56 @@ #ifndef INSTR_H #define INSTR_H - #include <functional> +#include <iostream> #include <map> +enum Mnemonic { + ADD, + SUB, + MUL, + QUOT, + REM, + SFTR, + SFTL, + AND, + OR, + NOT, + XOR, + ADDV, + SUBV, + MULV, + DIVV, + CMP, + CEV, + LOAD, + LOADV, + ADDI, + SUBI, + SFTRI, + SFTLI, + ANDI, + ORI, + XORI, + STORE, + STOREV, + JMP, + JRL, + JAL, + BEQ, + BGT, + BUF, + BOF, + PUSH, + POP, +}; + +std::ostream &operator<<(std::ostream &os, Mnemonic a); + namespace instr { // clang-format off -extern const std::map<int,std::map<int,std::function<void(signed int &s1, signed int &s2, signed int &s3)>>> instr_map; + extern const std::map<unsigned int, Mnemonic> mnemonic_map; + extern const std::map<Mnemonic, std::function<void(signed int &s1, signed int &s2, signed int &s3)>> instr_map; // clang-format on } // namespace instr |