From 41f612789f652654b5f2fa8c3fee4e348e2081b1 Mon Sep 17 00:00:00 2001 From: Siddarth-Suresh <65844402+Siddarth-Suresh@users.noreply.github.com> Date: Sat, 26 Apr 2025 20:21:02 -0400 Subject: Initial vector extension changes --- src/stage.cc | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) (limited to 'src/stage.cc') diff --git a/src/stage.cc b/src/stage.cc index 55756b6..47e7e32 100644 --- a/src/stage.cc +++ b/src/stage.cc @@ -16,6 +16,7 @@ // along with this program. If not, see . #include "stage.h" +#include "pipe_spec.h" #include #include @@ -29,7 +30,7 @@ Stage::Stage(Stage *next) Stage::~Stage() { delete this->next; }; std::array Stage::gprs; -std::array Stage::vrs; +std::array, V_NUM> Stage::vrs; std::deque Stage::checked_out; unsigned int Stage::pc; Storage *Stage::storage; @@ -65,6 +66,14 @@ InstrDTO *Stage::advance(Response p) return r; } +bool Stage::is_vector_type(Mnemonic m){ + return (m == ADDV || m == SUBV || m == MULV || m == DIVV || m == CEV || m == LOADV || m == STOREV); +} + +bool Stage::is_logical(Mnemonic m){ + return (m == ANDI || m == ORI || m == XORI || m == AND || m == OR || m == XOR || m== NOT); +} + std::vector Stage::stage_info() { std::vector info; @@ -86,32 +95,6 @@ void Stage::set_condition(CC c, bool v) this->gprs[3] = this->gprs[3] & ~(1 << c); } -signed int Stage::dereference_register(signed int v) -{ - signed int r; - - if (v < 0 || v >= GPR_NUM + V_NUM) { - throw std::out_of_range( - "instruction tried to access register which does not exist"); - } - - r = (v >= GPR_NUM) ? this->vrs[v % GPR_NUM] : this->gprs[v]; - return r; -} - -void Stage::store_register(signed int v, signed int d) -{ - if (v < 0 || v >= GPR_NUM + V_NUM) { - throw std::out_of_range( - "instruction tried to access register which does not exist"); - } - - if (v >= GPR_NUM) - this->vrs[v % GPR_NUM] = d; - else - this->gprs[v] = d; -} - bool Stage::is_checked_out(signed int r) { return std::find(this->checked_out.begin(), this->checked_out.end(), r) != -- cgit v1.2.3