diff options
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; } |