From b50cb7048275f5b9255dea7f3ac1362aaa09fe83 Mon Sep 17 00:00:00 2001 From: Siddarth-Suresh <65844402+Siddarth-Suresh@users.noreply.github.com> Date: Sun, 27 Apr 2025 21:09:27 -0400 Subject: Bug fixes --- inc/stage.h | 4 +++- src/ex.cc | 24 ++++++++++++++---------- src/id.cc | 7 ++++++- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/inc/stage.h b/inc/stage.h index 4e0c252..a5d7fe6 100644 --- a/inc/stage.h +++ b/inc/stage.h @@ -136,6 +136,8 @@ class Stage if (v < 0 || v >= GPR_NUM) { throw std::out_of_range("Invalid GPR index"); } + cout << "dereference_register: " << v << endl; + cout << "gprs[v]: " << gprs[v] << endl; return gprs[v]; } else if constexpr (std::is_same_v>) { @@ -188,4 +190,4 @@ class Stage Response status; }; -#endif /* STAGE_H_INCLUDED */ +#endif /* STAGE_H_INCLUDED */ \ No newline at end of file diff --git a/src/ex.cc b/src/ex.cc index 03a4e59..6dfe44f 100644 --- a/src/ex.cc +++ b/src/ex.cc @@ -183,14 +183,10 @@ void EX::advance_helper() break; case ADDV: - if(v_len ==0){ - - } else { - for(int i=0;iset_condition(OF, ADDITION_OF_GUARD(v1[i],v2[i])); - this->set_condition(UF, ADDITION_UF_GUARD(v1[i],v2[i])); - v1[i] = v1[i] + v2[i]; - } + for(int i=0;iset_condition(OF, ADDITION_OF_GUARD(v1[i],v2[i])); + this->set_condition(UF, ADDITION_UF_GUARD(v1[i],v2[i])); + v1[i] = v1[i] + v2[i]; } break; case SUBV: @@ -234,8 +230,16 @@ void EX::advance_helper() case NOP: break; - } - + } + if(this->is_vector_type(m)) { + if(this->curr_instr->mnemonic != LOADV && this->curr_instr->mnemonic != STOREV){ + this->curr_instr->operands.vector.slot_one = v1; + } else { + this->curr_instr->operands.load_store_vector.base_addr = v_base_addr; + } + } else{ + this->curr_instr->operands.integer.slot_one = s1; + } this->status = OK; } diff --git a/src/id.cc b/src/id.cc index 7db67c4..4358150 100644 --- a/src/id.cc +++ b/src/id.cc @@ -253,6 +253,7 @@ void ID::decode_I_type(signed int &s1) s1 = GET_MID_BITS(s1, s0b, s1b); break; default: + this->curr_instr->operands.integer.slot_three = s3; s2 = GET_MID_BITS(s1, s0b, s1b); s1 = GET_LS_BITS(s1, s0b); } @@ -312,6 +313,10 @@ void ID::decode_J_type(signed int &s1) [[fallthrough]]; default: this->status = this->read_guard(s1); - this->curr_instr->operands.integer.slot_one = s1; + if(this->status == OK){ + this->curr_instr->operands.integer.slot_one = s1; + this->curr_instr->operands.integer.slot_two = s2; + this->curr_instr->operands.integer.slot_three = s3; + } } } -- cgit v1.2.3