diff options
author | Siddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com> | 2025-03-30 19:34:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-30 19:34:17 -0400 |
commit | 12a9e93f913c0057f2ef32f5894931c8b4bd3a85 (patch) | |
tree | 88669ed2be55b4f455ef4ac56263a01dd5f70a40 /src/sim/instr.cc | |
parent | eedf9686eb60f2008e7766cc9a5d3e037b9dae64 (diff) | |
parent | 36dabe6183af98b2e3f6d0316436dc3affc3d986 (diff) |
Merge pull request #41 from bdunahu/bdunahu
Add mock stage, proper decode tests
changes look good
Diffstat (limited to 'src/sim/instr.cc')
-rw-r--r-- | src/sim/instr.cc | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/src/sim/instr.cc b/src/sim/instr.cc index 08edf5e..e614de5 100644 --- a/src/sim/instr.cc +++ b/src/sim/instr.cc @@ -3,36 +3,8 @@ #include <map> #include <unordered_map> -// clang-format off -#define INIT_INSTRUCTION(mnemonic, body) \ - {mnemonic, [](signed int &s1, signed int &s2, signed int &s3) { \ - body; \ - }} -// clang-format on - namespace instr { -// clang-format off -const std::unordered_map<Mnemonic, std::function<void(signed int &s1, signed int &s2, signed int &s3)>> - // clang-format on - instr_map = { - - /* R type instructions */ - // TODO these need to be WRAPPED with a function that sets overflow. - // future note to self, if these are more than 2 lines each, you're - // doing it wrong - INIT_INSTRUCTION(ADD, s3 = s1 + s2;), - INIT_INSTRUCTION(SUB, s3 = s1 - s2;), - - /* I type instructions */ - - /* J type instructions */ - - /* NOP */ - INIT_INSTRUCTION(NOP, (void)s3; (void)s2; (void)s1;), - -}; - const std::unordered_map<unsigned int, Mnemonic> mnemonic_map = { {0b0000100, ADD}, {0b0001000, SUB}, {0b0001100, MUL}, {0b0010000, QUOT}, {0b0010100, REM}, {0b0011000, SFTR}, @@ -48,6 +20,5 @@ const std::unordered_map<unsigned int, Mnemonic> mnemonic_map = { {0b0001010, JRL}, {0b0001110, JAL}, {0b0010010, BEQ}, {0b0010110, BGT}, {0b0011010, BUF}, {0b0011110, BOF}, {0b0100010, PUSH}, {0b0100110, POP}, - }; } // namespace instr |