diff options
author | Siddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com> | 2025-04-27 09:12:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-27 09:12:50 -0400 |
commit | 5653b2a033e7a4173d2f178b5ce52384666d3d7b (patch) | |
tree | 5c8fc7282ad1ce0c215786a70b35296645df2a1b /src/sim/controller.cc | |
parent | 3d0133c2f793e82d7519d8e2c5023114cd0f0eab (diff) | |
parent | a4dd1f00a5d0108058fb3bfbd5f399a507792859 (diff) |
Merge pull request #68 from bdunahu/bdunahu
[WIP] Pipeline cleanup and revisited GUI storage display
Diffstat (limited to 'src/sim/controller.cc')
-rw-r--r-- | src/sim/controller.cc | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/src/sim/controller.cc b/src/sim/controller.cc deleted file mode 100644 index 59fbbb7..0000000 --- a/src/sim/controller.cc +++ /dev/null @@ -1,71 +0,0 @@ -// Simulator for the RISC-V[ECTOR] mini-ISA -// Copyright (C) 2025 Siddarth Suresh -// Copyright (C) 2025 bdunahu - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see <https://www.gnu.org/licenses/>. - -#include "controller.h" -#include "ex.h" -#include "response.h" -#include "storage.h" - -Controller::Controller(Stage *stage, Storage *storage, bool is_pipelined) - : Stage(stage) -{ - this->clock_cycle = 1; - this->storage = storage; - this->is_pipelined = is_pipelined; - this->is_empty = true; - this->pc = 0x0; - this->checked_out = {}; - this->gprs = {0}; - this->gprs.at(2) = MEM_WORDS; // set the stack pointer - // grant side-door access - this->id = SIDE; -} - -void Controller::run_for(int number) -{ - int i; - for (i = 0; i < number; ++i) { - try { - this->advance(WAIT); - } catch (HaltException &e) { - break; - } - } -} - -int Controller::get_clock_cycle() { return this->clock_cycle; } - -std::array<int, GPR_NUM> Controller::get_gprs() { return this->gprs; } - -int Controller::get_pc() { return this->pc; } - -InstrDTO *Controller::advance(Response p) -{ - InstrDTO *r; - r = this->next->advance(p); - ++this->clock_cycle; - - if (r) - this->is_empty = true; - - return r; -} - -void Controller::advance_helper() -{ - // TODO: check halt condition and call UI to refresh -} |