diff options
author | bd <bdunahu@operationnull.com> | 2025-04-22 23:39:14 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-04-22 23:39:14 -0400 |
commit | 302bbdc7ac18cd355f9f081cae202f5434427262 (patch) | |
tree | a80693956999a39deece3130bbdee9a553babbb1 /src/wb.cc | |
parent | 74b24d15eb1fe48a8e221a0bc061107d6b85d659 (diff) |
Use a struct for InstrDTO
Diffstat (limited to 'src/wb.cc')
-rw-r--r-- | src/wb.cc | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -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; } |