diff options
author | bd <bdunahu@operationnull.com> | 2025-04-16 22:22:09 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-04-16 22:22:09 -0400 |
commit | 23d3ebb2702e6b08c7f6b997067e1bc76483b813 (patch) | |
tree | da31aa76d8ea073d92757466985ecdf9ff57a2d9 /src/sim | |
parent | b778ccc3e7c2f2ac3c4892a87f5269f342fd895f (diff) |
Partial fixes for changes in DRAM/Cache, including uncovered bug
Diffstat (limited to 'src/sim')
-rw-r--r-- | src/sim/dum.cc | 1 | ||||
-rw-r--r-- | src/sim/ex.cc | 17 | ||||
-rw-r--r-- | src/sim/stage.cc | 26 |
3 files changed, 17 insertions, 27 deletions
diff --git a/src/sim/dum.cc b/src/sim/dum.cc index 76d4acd..f712fce 100644 --- a/src/sim/dum.cc +++ b/src/sim/dum.cc @@ -3,7 +3,6 @@ #include "instrDTO.h" #include "response.h" #include "stage.h" -#include "utils.h" DUM::DUM(Stage *stage) : Stage(stage) { this->id = IDLE; } diff --git a/src/sim/ex.cc b/src/sim/ex.cc index 50f00a8..d20d15f 100644 --- a/src/sim/ex.cc +++ b/src/sim/ex.cc @@ -1,10 +1,9 @@ #include "ex.h" #include "accessor.h" -#include "pipe_spec.h" #include "instrDTO.h" +#include "pipe_spec.h" #include "response.h" #include "stage.h" -#include "utils.h" #include <unordered_map> // clang-format off @@ -313,32 +312,28 @@ EX::EX(Stage *stage) : Stage(stage) INIT_INSTRUCTION( BEQ, { - (this->get_condition(EQ)) ? s1 = wrap_address(pc + s2) - : s1 = -1; + (this->get_condition(EQ)) ? s1 = pc + s2 : s1 = -1; (void)s3; }), INIT_INSTRUCTION( BGT, { - (this->get_condition(GT)) ? s1 = wrap_address(pc + s2) - : s1 = -1; + (this->get_condition(GT)) ? s1 = pc + s2 : s1 = -1; (void)s3; }), INIT_INSTRUCTION( BUF, { - (this->get_condition(UF)) ? s1 = wrap_address(pc + s2) - : s1 = -1; + (this->get_condition(UF)) ? s1 = pc + s2 : s1 = -1; (void)s3; }), INIT_INSTRUCTION( BOF, { - (this->get_condition(OF)) ? s1 = wrap_address(pc + s2) - : s1 = -1; + (this->get_condition(OF)) ? s1 = pc + s2 : s1 = -1; (void)s3; }), @@ -387,7 +382,7 @@ void EX::advance_helper() s3 = this->curr_instr->get_s3(); pc = this->curr_instr->get_pc(); - this->instr_map[m](s1, s2, s3, pc ); + this->instr_map[m](s1, s2, s3, pc); this->curr_instr->set_s1(s1); this->status = OK; diff --git a/src/sim/stage.cc b/src/sim/stage.cc index 8a570f0..b7926fd 100644 --- a/src/sim/stage.cc +++ b/src/sim/stage.cc @@ -1,5 +1,4 @@ #include "stage.h" -#include "utils.h" #include <array> #include <deque> @@ -28,12 +27,12 @@ InstrDTO *Stage::advance(Response p) InstrDTO *s = nullptr; Response n; - // std::cout << "advance: " << this->id << ": " << this->curr_instr << "?: " << p << ": " << this->checked_out.size() << ": "; - // if (curr_instr) + // std::cout << "advance: " << this->id << ": " << this->curr_instr << "?: " + // << p << ": " << this->checked_out.size() << ": "; if (curr_instr) // std::cout << curr_instr->get_mnemonic(); // for (long unsigned int i = 0; i < this->checked_out.size(); ++i) // std::cout << this->checked_out[i] << " "; - // std::cout << std::endl; + // std::cout << std::endl; if (this->curr_instr && this->status != OK) { this->advance_helper(); } @@ -53,9 +52,10 @@ InstrDTO *Stage::advance(Response p) return r; } -std::vector<int> Stage::stage_info() { +std::vector<int> Stage::stage_info() +{ std::vector<int> info; - if(this->curr_instr){ + if (this->curr_instr) { info.push_back(this->curr_instr->get_mnemonic()); info.push_back(this->curr_instr->get_pc()); info.push_back(this->curr_instr->get_s1()); @@ -63,7 +63,7 @@ std::vector<int> Stage::stage_info() { info.push_back(this->curr_instr->get_s3()); } return info; - } +} void Stage::set_condition(CC c, bool v) { @@ -78,10 +78,8 @@ signed int Stage::dereference_register(signed int v) signed int r; if (v < 0 || v >= GPR_NUM + V_NUM) { - throw std::out_of_range(string_format( - "instruction tried to access register %d, which does " - "not exist", - v)); + throw std::out_of_range( + "instruction tried to access register which does not exist"); } r = (v >= GPR_NUM) ? this->vrs[v % GPR_NUM] : this->gprs[v]; @@ -91,10 +89,8 @@ signed int Stage::dereference_register(signed int v) void Stage::store_register(signed int v, signed int d) { if (v < 0 || v >= GPR_NUM + V_NUM) { - throw std::out_of_range(string_format( - "instruction tried to access register %d, which does " - "not exist", - v)); + throw std::out_of_range( + "instruction tried to access register which does not exist"); } if (v >= GPR_NUM) |