summaryrefslogtreecommitdiff
path: root/src/wb.cc
diff options
context:
space:
mode:
authorSiddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com>2025-05-11 11:51:15 -0400
committerGitHub <noreply@github.com>2025-05-11 11:51:15 -0400
commita35eb451889f0efa99ff7fe1c0a3a76afd5e7ad5 (patch)
tree44205b454c11a2d98711cd3226b4828e12a8479a /src/wb.cc
parentc7132dbc9c38ff766053bd9a0b72c68b23cd08d2 (diff)
parent6f4e9e0b914c3e68691a5d884cbad0b5813fcf18 (diff)
Merge pull request #78 from bdunahu/bdunahu
cleanup/fix existing vector extension
Diffstat (limited to 'src/wb.cc')
-rw-r--r--src/wb.cc38
1 files changed, 28 insertions, 10 deletions
diff --git a/src/wb.cc b/src/wb.cc
index 0dae5f2..bfdbc3a 100644
--- a/src/wb.cc
+++ b/src/wb.cc
@@ -16,6 +16,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "wb.h"
+#include "instr.h"
#include "instrDTO.h"
#include "response.h"
#include "stage.h"
@@ -51,15 +52,21 @@ void WB::write_handler()
this->checked_out.pop_front();
reg = this->curr_instr->checked_out;
-
- if(this->is_vector_type(this->curr_instr->mnemonic)) {
- if(this->curr_instr->mnemonic != STOREV && this->curr_instr->mnemonic != LOADV) {
- this->store_register<std::array<signed int, V_R_LIMIT>>(reg, this->curr_instr->operands.vector.slot_one);
- } else {
- this->store_register<std::array<signed int, V_R_LIMIT>>(reg, this->curr_instr->operands.load_store_vector.vector_register);
- }
- } else{
- this->store_register<signed int>(reg, this->curr_instr->operands.integer.slot_one);
+
+ switch (this->curr_instr->type) {
+ case SI_INT:
+ this->store_register<signed int>(
+ reg, this->curr_instr->operands.integer.slot_one);
+ break;
+ case R_VECT:
+ this->store_register<std::array<signed int, V_R_LIMIT>>(
+ reg, this->copy_extra_vector_elements());
+ break;
+ case I_VECT:
+ this->store_register<std::array<signed int, V_R_LIMIT>>(
+ reg, this->curr_instr->operands.i_vector.slot_three);
+ // todo, use copy_extra_vector_elements
+ break;
}
}
@@ -68,7 +75,6 @@ void WB::jump_handler()
if (this->curr_instr->operands.integer.slot_one > 0) {
if (this->curr_instr->mnemonic == JAL)
this->gprs[1] = this->curr_instr->slot_B + 1;
- ;
this->pc = this->curr_instr->operands.integer.slot_one;
this->checked_out = {};
this->next->squash();
@@ -85,3 +91,15 @@ bool WB::should_jump()
else
return false;
}
+
+std::array<signed int, V_R_LIMIT> WB::copy_extra_vector_elements()
+{
+ int i;
+ std::array<signed int, V_R_LIMIT> v;
+
+ v = this->curr_instr->operands.vector.slot_one;
+ for (i = V_R_LIMIT - 1; i >= this->curr_instr->slot_B; --i) {
+ v[i] = this->curr_instr->operands.vector.slot_three[i];
+ }
+ return v;
+}