diff options
author | Siddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com> | 2025-03-25 12:43:05 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-25 12:43:05 -0400 |
commit | 9eeea1ab8bf4eb17e5da46d57a6c1d455a0a262e (patch) | |
tree | 77f1cccbf29b05493ca5d0e24cbebc606cd90008 /src/sim/controller.cc | |
parent | 7ad79d8430ee22b0180e7077fe727153333e47f6 (diff) | |
parent | 9a0b9ed3d77bde99b1f1ba341850117c188f0156 (diff) |
Merge pull request #35 from bdunahu/bdunahu
Add skeleton classes for 5 major pipeline stages
Agree with different classes for each stage
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; } |