diff options
author | bd <bdunahu@operationnull.com> | 2025-03-24 14:41:13 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-03-24 14:41:13 -0400 |
commit | 9a0b9ed3d77bde99b1f1ba341850117c188f0156 (patch) | |
tree | e8546d59859b3723744e901b51e5448f2b190d7f /src/sim/controller.cc | |
parent | 877aa98855fad77ef93a8c9f5a5e8191fbb9e699 (diff) |
Add skeleton classes for 5 major pipeline stages
Diffstat (limited to 'src/sim/controller.cc')
-rw-r--r-- | src/sim/controller.cc | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/sim/controller.cc b/src/sim/controller.cc index 8d48dc9..93fd0e0 100644 --- a/src/sim/controller.cc +++ b/src/sim/controller.cc @@ -1,7 +1,14 @@ #include "controller.h" +#include "ex.h" +#include "id.h" +#include "if.h" +#include "mm.h" +#include "response.h" #include "storage.h" +#include "wb.h" Controller::Controller(Storage *storage, bool is_pipelined) + : Stage(nullptr) { this->clock_cycle = 0; this->storage = storage; @@ -9,12 +16,14 @@ Controller::Controller(Storage *storage, bool is_pipelined) this->pc = 0x0; this->gprs = {0}; - // setup the other pipeline stages - this->next = nullptr; + IF *f = new IF(nullptr); + ID *d = new ID(f); + EX *e = new EX(d); + MM *m = new MM(e); + WB *w = new WB(m); + this->next = w; } -Controller::~Controller() { ; } - void Controller::run_for(int number) { int i; @@ -25,14 +34,13 @@ void Controller::run_for(int number) int Controller::get_clock_cycle() { return this->clock_cycle; } -std::array<int, GPR_NUM> Controller::get_gprs() { - return this->gprs; -} +std::array<int, GPR_NUM> Controller::get_gprs() { return this->gprs; } int Controller::get_pc() { return this->pc; } -void Controller::advance() { - ; - // this->next->advance() +Response Controller::advance() +{ + this->next->advance(); ++this->clock_cycle; + return OK; } |