summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sim/ex.cc22
-rw-r--r--src/sim/stage.cc5
2 files changed, 12 insertions, 15 deletions
diff --git a/src/sim/ex.cc b/src/sim/ex.cc
index f22adc0..3d95917 100644
--- a/src/sim/ex.cc
+++ b/src/sim/ex.cc
@@ -342,17 +342,13 @@ void EX::advance_helper()
signed int s1, s2, s3;
Mnemonic m;
- // it may be good to ensure we are not doing
- // work that has already been done
- if (this->curr_instr) {
- m = this->curr_instr->get_mnemonic();
- s1 = this->curr_instr->get_s1();
- s2 = this->curr_instr->get_s2();
- s3 = this->curr_instr->get_s3();
-
- this->instr_map[m](s1, s2, s3);
-
- this->curr_instr->set_s1(s1);
- this->status = OK;
- }
+ m = this->curr_instr->get_mnemonic();
+ s1 = this->curr_instr->get_s1();
+ s2 = this->curr_instr->get_s2();
+ s3 = this->curr_instr->get_s3();
+
+ this->instr_map[m](s1, s2, s3);
+
+ this->curr_instr->set_s1(s1);
+ this->status = OK;
}
diff --git a/src/sim/stage.cc b/src/sim/stage.cc
index be69d77..0f13d65 100644
--- a/src/sim/stage.cc
+++ b/src/sim/stage.cc
@@ -34,8 +34,9 @@ InstrDTO *Stage::advance(Response p)
InstrDTO *r = nullptr;
Response n;
- this->advance_helper();
- if (this->status == OK && this->curr_instr != nullptr && p == OK) {
+ if (this->curr_instr && this->status != OK)
+ this->advance_helper();
+ if (this->status == OK && p == OK && this->curr_instr) {
// mutual consent
this->curr_instr->set_time_of(this->id, this->clock_cycle);
r = new InstrDTO(*this->curr_instr);