From 302bbdc7ac18cd355f9f081cae202f5434427262 Mon Sep 17 00:00:00 2001 From: bd Date: Tue, 22 Apr 2025 23:39:14 -0400 Subject: Use a struct for InstrDTO --- src/wb.cc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/wb.cc') diff --git a/src/wb.cc b/src/wb.cc index 55591b6..08d512b 100644 --- a/src/wb.cc +++ b/src/wb.cc @@ -24,9 +24,9 @@ void WB::advance_helper() { - if (this->curr_instr->get_mnemonic() != NOP && - this->curr_instr->get_type() != INV) { - if (this->curr_instr->get_checked_out() > 0) + if (this->curr_instr->mnemonic != NOP && + this->curr_instr->type != INV) { + if (this->curr_instr->checked_out > 0) this->write_handler(); else if (this->should_jump()) this->jump_handler(); @@ -42,25 +42,25 @@ void WB::write_handler() throw std::runtime_error("instruction tried to pop a register out of " "an empty queue during writeback."); - if (this->curr_instr->get_mnemonic() == POP) { + if (this->curr_instr->mnemonic == POP) { // POP performs a second register write reg = this->checked_out.front(); this->checked_out.pop_front(); - this->store_register(reg, this->curr_instr->get_s3()); + this->store_register(reg, this->curr_instr->operands.integer.slot_three); } this->checked_out.pop_front(); - reg = this->curr_instr->get_checked_out(); - this->store_register(reg, this->curr_instr->get_s1()); + reg = this->curr_instr->checked_out; + this->store_register(reg, this->curr_instr->operands.integer.slot_one); } void WB::jump_handler() { - if (this->curr_instr->get_s1() > 0) { - if (this->curr_instr->get_mnemonic() == JAL) - this->gprs[1] = this->curr_instr->get_pc() + 1;; - this->pc = this->curr_instr->get_s1(); + 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(); } @@ -70,6 +70,6 @@ bool WB::should_jump() { Type t; - t = this->curr_instr->get_type(); + t = this->curr_instr->type; return t == J; } -- cgit v1.2.3