summaryrefslogtreecommitdiff
path: root/src/sim/if.cc
diff options
context:
space:
mode:
authorbd <bdunaisky@umass.edu>2025-04-02 04:05:18 +0000
committerGitHub <noreply@github.com>2025-04-02 04:05:18 +0000
commit9fb95d655393777dde5929182f94de36f903821d (patch)
tree4462f35895737460a01fab891a15f87aba2efb70 /src/sim/if.cc
parent24f0bd8af57381ab3112b5774d4ad23ac80f0718 (diff)
parent3eeb345d673bee6d62b04fc8a8a95ab822dc1e45 (diff)
Merge pull request #46 from bdunahu/bdunahu
Ensure all stages only do work if they are not 'OK'
Diffstat (limited to 'src/sim/if.cc')
-rw-r--r--src/sim/if.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/sim/if.cc b/src/sim/if.cc
index fa8f6c2..85fb27f 100644
--- a/src/sim/if.cc
+++ b/src/sim/if.cc
@@ -11,14 +11,13 @@ InstrDTO *IF::advance(Response p)
InstrDTO *r = nullptr;
this->advance_helper();
- if (this->curr_instr != nullptr && p == OK) {
+ if (this->curr_instr != nullptr && p == WAIT) {
// mutual consent
++this->pc;
this->curr_instr->set_time_of(this->id, this->clock_cycle);
r = new InstrDTO(*this->curr_instr);
delete curr_instr;
curr_instr = nullptr;
- this->status = STALLED;
}
return r;
@@ -32,9 +31,9 @@ void IF::advance_helper()
if (this->curr_instr == nullptr) {
r = this->storage->read_word(this->id, this->pc, bits);
if (r == OK) {
- this->status = r;
this->curr_instr = new InstrDTO();
this->curr_instr->set_instr_bits(bits);
+ this->curr_instr->set_pc(this->pc);
}
}
}