summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSiddarth-Suresh <65844402+Siddarth-Suresh@users.noreply.github.com>2025-04-26 23:57:02 -0400
committerSiddarth-Suresh <65844402+Siddarth-Suresh@users.noreply.github.com>2025-04-26 23:57:02 -0400
commitbd4714ae53898337a02cfcec17628eeff9d77a9c (patch)
tree04e01e43dab9768c78134190b99a3c9fc4f837cf /src
parent41f612789f652654b5f2fa8c3fee4e348e2081b1 (diff)
Fix for load and store vector
Diffstat (limited to 'src')
-rw-r--r--src/id.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/id.cc b/src/id.cc
index b976ef0..d51c70c 100644
--- a/src/id.cc
+++ b/src/id.cc
@@ -194,26 +194,33 @@ void ID::decode_I_type(signed int &s1)
s0b = REG_SIZE;
s1b = s0b + REG_SIZE;
s2b = WORD_SPEC - LINE_SPEC - OPCODE_SIZE;
+ // s3 is immediate
s3 = GET_BITS_SIGN_EXTEND(s1, s1b, s2b);
switch (this->curr_instr->mnemonic) {
case STORE:
+ this->curr_instr->operands.integer.slot_three = s3;
s2 = GET_MID_BITS(s1, s0b, s1b);
s1 = GET_LS_BITS(s1, s0b);
// both operands are read values
+ // s1 is base address
r1 = this->read_guard(s1);
this->curr_instr->operands.integer.slot_one = s1;
+ // s2 is value to be stored
r2 = this->read_guard(s2);
this->curr_instr->operands.integer.slot_two = s2;
this->status = (r1 == OK && r2 == OK) ? OK : STALLED;
return;
case STOREV:
+ this->curr_instr->slot_C = s3;
s2 = GET_MID_BITS(s1, s0b, s1b);
s1 = GET_LS_BITS(s1, s0b);
- // both operands are read values
- r1 = this->read_vec_guard(s1,this->curr_instr->operands.vector.slot_one);
+ // base address
+ r1 = this->read_guard(s1);
+ this->curr_instr->slot_B = s1;
+ // vector value to be stored
r2 = this->read_vec_guard(s2,this->curr_instr->operands.vector.slot_two);
r3 = this->set_vlen();
@@ -229,6 +236,7 @@ void ID::decode_I_type(signed int &s1)
this->status = (r1 == OK && r3 == OK) ? OK : STALLED;
return;
case LOAD:
+ this->curr_instr->operands.integer.slot_three = s3;
s2 = GET_LS_BITS(s1, s0b);
s1 = GET_MID_BITS(s1, s0b, s1b);
break;