summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-04-01 23:22:12 -0400
committerbd <bdunahu@operationnull.com>2025-04-01 23:22:12 -0400
commit9e30d0054e7b3eb10e4e464b12ae3cc1eecc9585 (patch)
tree5f49ef6a4e6f7529ac0d92fa7c5f3326d4140066 /src
parent05a873027d01cdf6318d67b77a4eaad120b05527 (diff)
Fix bug with decode pushing checked_out when delayed with RAW
Diffstat (limited to 'src')
-rw-r--r--src/sim/controller.cc4
-rw-r--r--src/sim/id.cc8
-rw-r--r--src/sim/stage.cc6
3 files changed, 13 insertions, 5 deletions
diff --git a/src/sim/controller.cc b/src/sim/controller.cc
index cf8d02d..65e5676 100644
--- a/src/sim/controller.cc
+++ b/src/sim/controller.cc
@@ -19,7 +19,7 @@ void Controller::run_for(int number)
{
int i;
for (i = 0; i < number; ++i) {
- this->advance(OK);
+ this->advance(WAIT);
}
}
@@ -38,7 +38,7 @@ InstrDTO *Controller::advance(Response p)
InstrDTO *r;
r = this->next->advance(p);
++this->clock_cycle;
-
+
return r;
}
diff --git a/src/sim/id.cc b/src/sim/id.cc
index 0df26f4..0c0be91 100644
--- a/src/sim/id.cc
+++ b/src/sim/id.cc
@@ -102,9 +102,10 @@ void ID::decode_R_type(signed int &s1, signed int &s2, signed int &s3)
r1 = this->read_guard(s1);
r2 = this->read_guard(s2);
- this->write_guard(s3);
-
this->status = (r1 == OK && r2 == OK) ? OK : STALLED;
+
+ if (this->status == OK)
+ this->write_guard(s3);
}
void ID::decode_I_type(
@@ -123,7 +124,8 @@ void ID::decode_I_type(
r1 = this->read_guard(s1);
if (m != STORE && m != STOREV) {
this->status = r1;
- this->write_guard(s2);
+ if (r1 == OK)
+ this->write_guard(s2);
} else
this->status = (this->read_guard(s2) == OK && r1 == OK) ? OK : STALLED;
}
diff --git a/src/sim/stage.cc b/src/sim/stage.cc
index 24bdf75..2857e1f 100644
--- a/src/sim/stage.cc
+++ b/src/sim/stage.cc
@@ -28,6 +28,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 << 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;
if (this->curr_instr && this->status != OK) {
this->advance_helper();
}