summaryrefslogtreecommitdiff
path: root/inc/instr.h
diff options
context:
space:
mode:
authorSiddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com>2025-03-29 22:14:42 -0400
committerGitHub <noreply@github.com>2025-03-29 22:14:42 -0400
commitd20623d031cf909d8892c2db38cf2e2e02bc6a9b (patch)
tree56ef4ae4325a5b803c484a3e5c8d87b89572cedf /inc/instr.h
parentcaeff52f029920e027d18bc01149425560801f82 (diff)
parent1250c3765f59801d060152d5f6eed0a9faa11b50 (diff)
Merge pull request #37 from bdunahu/bdunahu
Instr, InstrDTO gets/sets, other structures required for decode -- tests as we move forward -- base classes -- decode stage implemented
Diffstat (limited to 'inc/instr.h')
-rw-r--r--inc/instr.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/inc/instr.h b/inc/instr.h
new file mode 100644
index 0000000..08b4fd0
--- /dev/null
+++ b/inc/instr.h
@@ -0,0 +1,56 @@
+#ifndef INSTR_H
+#define INSTR_H
+#include <functional>
+#include <iostream>
+#include <unordered_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,
+ NOP,
+};
+
+namespace instr
+{
+// clang-format off
+ extern const std::unordered_map<unsigned int, Mnemonic> mnemonic_map;
+ extern const std::unordered_map<Mnemonic, std::function<void(signed int &s1, signed int &s2, signed int &s3)>> instr_map;
+// clang-format on
+} // namespace instr
+
+#endif /* INSTR_H_INCLUDED */