summaryrefslogtreecommitdiff
path: root/src/sim/wb.cc
diff options
context:
space:
mode:
authorSiddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com>2025-04-17 10:50:58 -0400
committerGitHub <noreply@github.com>2025-04-17 10:50:58 -0400
commit62b9e280d5d0222710e491dcd28fe26bea915dcd (patch)
treee1f68ac7a6e4dc481c19346e38ad20d113f13825 /src/sim/wb.cc
parentb778ccc3e7c2f2ac3c4892a87f5269f342fd895f (diff)
parent430986b4b1ee1013db070991ce289176f48fa8e8 (diff)
Merge pull request #52 from bdunahu/bdunahu
[WIP] Partial fixes for changes in DRAM/Cache, including uncovered bug
Diffstat (limited to 'src/sim/wb.cc')
-rw-r--r--src/sim/wb.cc16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/sim/wb.cc b/src/sim/wb.cc
index 01768e8..4e6b2b0 100644
--- a/src/sim/wb.cc
+++ b/src/sim/wb.cc
@@ -3,6 +3,8 @@
#include "instrDTO.h"
#include "response.h"
#include "stage.h"
+#include <array>
+#include <algorithm>
WB::WB(Stage *stage) : Stage(stage) { this->id = WRITE; }
@@ -10,7 +12,7 @@ void WB::advance_helper()
{
if (this->curr_instr->get_mnemonic() != NOP &&
this->curr_instr->get_type() != INV) {
- if (this->should_write())
+ if (this->curr_instr->get_checked_out() > 0)
this->write_handler();
else if (this->should_jump())
this->jump_handler();
@@ -26,8 +28,8 @@ void WB::write_handler()
throw std::runtime_error("instruction tried to pop a register out of "
"an empty queue during writeback.");
- reg = this->checked_out.front();
this->checked_out.pop_front();
+ reg = this->curr_instr->get_checked_out();
this->store_register(reg, this->curr_instr->get_s1());
}
@@ -49,13 +51,3 @@ bool WB::should_jump()
t = this->curr_instr->get_type();
return t == J;
}
-
-bool WB::should_write()
-{
- Mnemonic m;
- Type t;
-
- m = this->curr_instr->get_mnemonic();
- t = this->curr_instr->get_type();
- return (t == R || t == I) && (m != STORE && m != STOREV);
-}