summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-04-23 00:47:24 -0400
committerbd <bdunahu@operationnull.com>2025-04-23 00:47:24 -0400
commit8e33ba4499bced747f66ed436211876d220342d6 (patch)
tree62b4a9ecd51fdc69b5f617163319c4e3eb93f8ea
parent051041c9cbe0752a50ac1a464df1c554b10cde0c (diff)
Rename Response.WAIT to READY, delete BLOCKED
-rw-r--r--inc/response.h3
-rw-r--r--inc/stage.h2
-rw-r--r--src/controller.cc2
-rw-r--r--src/if.cc2
-rw-r--r--src/response.cc2
-rw-r--r--src/stage.cc8
-rw-r--r--tests/controller.cc2
-rw-r--r--tests/dum.h2
-rw-r--r--tests/ex.cc4
-rw-r--r--tests/id.cc4
-rw-r--r--tests/if.cc8
11 files changed, 19 insertions, 20 deletions
diff --git a/inc/response.h b/inc/response.h
index 501923a..c1f38e7 100644
--- a/inc/response.h
+++ b/inc/response.h
@@ -21,8 +21,7 @@
enum Response {
OK,
- WAIT,
- BLOCKED,
+ READY,
STALLED,
};
diff --git a/inc/stage.h b/inc/stage.h
index 745e0ff..7dcb7b4 100644
--- a/inc/stage.h
+++ b/inc/stage.h
@@ -50,7 +50,7 @@ class Stage
* ready to accept a new instruction object next cycle.
* @return a DTO object containing the next instruction to be processed.
*
- * Must set the status to WAIT when the current instruction is evicted..
+ * Must set the status to READY when the current instruction is evicted..
*/
virtual InstrDTO *advance(Response p);
diff --git a/src/controller.cc b/src/controller.cc
index 1c379ec..8df4b97 100644
--- a/src/controller.cc
+++ b/src/controller.cc
@@ -38,7 +38,7 @@ void Controller::run_for(int number)
int i;
for (i = 0; i < number; ++i) {
try {
- this->advance(WAIT);
+ this->advance(READY);
} catch (HaltException &e) {
break;
}
diff --git a/src/if.cc b/src/if.cc
index 62a105c..5f07ee2 100644
--- a/src/if.cc
+++ b/src/if.cc
@@ -25,7 +25,7 @@ InstrDTO *IF::advance(Response p)
InstrDTO *r = nullptr;
this->advance_helper();
- if (this->curr_instr != nullptr && p == WAIT) {
+ if (this->curr_instr != nullptr && p == READY) {
// don't increment PC if the PC was just set by wb
if (this->curr_instr->is_squashed != 1)
++this->pc;
diff --git a/src/response.cc b/src/response.cc
index d56419a..7624b82 100644
--- a/src/response.cc
+++ b/src/response.cc
@@ -20,6 +20,6 @@
std::ostream &operator<<(std::ostream &os, Response r)
{
- const std::string nameR[] = {"OK", "WAIT", "BLOCKED", "STALLED"};
+ const std::string nameR[] = {"OK", "READY", "STALLED"};
return os << nameR[r];
}
diff --git a/src/stage.cc b/src/stage.cc
index e5a4333..55756b6 100644
--- a/src/stage.cc
+++ b/src/stage.cc
@@ -23,7 +23,7 @@ Stage::Stage(Stage *next)
{
this->next = next;
this->curr_instr = nullptr;
- this->status = WAIT;
+ this->status = READY;
}
Stage::~Stage() { delete this->next; };
@@ -50,15 +50,15 @@ InstrDTO *Stage::advance(Response p)
if (this->curr_instr && this->status != OK) {
this->advance_helper();
}
- if (this->status == OK && p == WAIT && this->curr_instr) {
+ if (this->status == OK && p == READY && this->curr_instr) {
// mutual consent
r = new InstrDTO(*this->curr_instr);
delete curr_instr;
curr_instr = nullptr;
- this->status = WAIT;
+ this->status = READY;
}
- n = (p != WAIT || this->status != WAIT) ? STALLED : WAIT;
+ n = (p != READY || this->status != READY) ? STALLED : READY;
s = this->next->advance(n);
if (s)
this->curr_instr = s;
diff --git a/tests/controller.cc b/tests/controller.cc
index 1d1ddb6..9bc71f6 100644
--- a/tests/controller.cc
+++ b/tests/controller.cc
@@ -37,7 +37,7 @@ class ControllerPipeFixture
InstrDTO *i = nullptr;
int j;
for (j = 0; j < this->stage_num + 1; ++j) {
- i = this->ct->advance(WAIT);
+ i = this->ct->advance(READY);
REQUIRE(i == nullptr);
}
}
diff --git a/tests/dum.h b/tests/dum.h
index 5bfc646..e60ffad 100644
--- a/tests/dum.h
+++ b/tests/dum.h
@@ -17,7 +17,7 @@ class DUM : public Stage
{
InstrDTO *r = nullptr;
- if (this->curr_instr && p == WAIT) {
+ if (this->curr_instr && p == READY) {
r = new InstrDTO(*this->curr_instr);
delete this->curr_instr;
curr_instr = nullptr;
diff --git a/tests/ex.cc b/tests/ex.cc
index 1fc333e..5972182 100644
--- a/tests/ex.cc
+++ b/tests/ex.cc
@@ -33,9 +33,9 @@ class EXFixture
i->mnemonic = m;
this->dum->set_curr_instr(i);
- i = this->ct->advance(WAIT);
+ i = this->ct->advance(READY);
REQUIRE(i == nullptr);
- i = this->ct->advance(WAIT);
+ i = this->ct->advance(READY);
REQUIRE(i != nullptr);
return i;
diff --git a/tests/id.cc b/tests/id.cc
index e82adc3..a81e967 100644
--- a/tests/id.cc
+++ b/tests/id.cc
@@ -29,9 +29,9 @@ class IDFixture
i->slot_A = raw;
this->dum->set_curr_instr(i);
- i = this->ct->advance(WAIT);
+ i = this->ct->advance(READY);
REQUIRE(i == nullptr);
- i = this->ct->advance(WAIT);
+ i = this->ct->advance(READY);
REQUIRE(i != nullptr);
return i;
diff --git a/tests/if.cc b/tests/if.cc
index 59a7890..e2a7dbe 100644
--- a/tests/if.cc
+++ b/tests/if.cc
@@ -36,7 +36,7 @@ class IFFixture
int i;
for (i = 0; i < this->m_delay + 1; ++i) {
- r = this->ct->advance(WAIT);
+ r = this->ct->advance(READY);
// check response
CHECK(r == nullptr);
}
@@ -52,11 +52,11 @@ class IFFixture
int i;
for (i = 0; i < this->c_delay; ++i) {
- r = this->ct->advance(WAIT);
+ r = this->ct->advance(READY);
// check response
REQUIRE(r == nullptr);
}
- r = this->ct->advance(WAIT);
+ r = this->ct->advance(READY);
// check response
REQUIRE(r != nullptr);
return r;
@@ -122,7 +122,7 @@ TEST_CASE_METHOD(IFFixture, "fetch waits with old instruction", "[if_pipe]")
REQUIRE(i != nullptr);
}
- i = this->ct->advance(WAIT);
+ i = this->ct->advance(READY);
REQUIRE(i != nullptr);
REQUIRE(i->slot_A == this->p[0]);