From a29d974ac8cec5803dd9c9ea66f3ac5d06a1fe2b Mon Sep 17 00:00:00 2001 From: bd Date: Sat, 10 May 2025 15:00:40 -0400 Subject: Fix other instances of the same bug --- src/id.cc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/id.cc b/src/id.cc index ebf6db6..430bf09 100644 --- a/src/id.cc +++ b/src/id.cc @@ -235,8 +235,8 @@ void ID::decode_I_type(signed int &s1) r1 = this->read_guard(s1); this->curr_instr->operands.integer.slot_one = s1; if (r1 == OK) { - this->write_guard(s2); - this->curr_instr->operands.integer.slot_two = s2; + this->curr_instr->operands.integer.slot_two = + this->write_guard(s2); } this->status = r1; } @@ -264,8 +264,9 @@ void ID::decode_J_type(signed int &s1) r2 = (this->is_checked_out(s3)) ? STALLED : OK; // we read the stack pointer if (r1 == OK && r2 == OK) { - this->write_guard(s3); // we write the stack pointer - this->curr_instr->operands.integer.slot_three = s3; + // we write the stack pointer + this->curr_instr->operands.integer.slot_three = + this->write_guard(s3); } this->status = (r1 == OK && r2 == OK) ? OK : STALLED; break; @@ -277,10 +278,11 @@ void ID::decode_J_type(signed int &s1) r1 = (this->is_checked_out(s3)) ? STALLED : OK; // we read the stack pointer if (r1 == OK) { - this->write_guard(s2); - this->curr_instr->operands.integer.slot_two = s2; - this->write_guard(s3); // we write the stack pointer - this->curr_instr->operands.integer.slot_three = s3; + this->curr_instr->operands.integer.slot_two = + this->write_guard(s2); + // we write the stack pointer + this->curr_instr->operands.integer.slot_three = + this->write_guard(s3); } this->status = r1; break; -- cgit v1.2.3