summaryrefslogtreecommitdiff
path: root/src/sim/mm.cc
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-04-11 23:09:49 -0400
committerbd <bdunahu@operationnull.com>2025-04-11 23:09:49 -0400
commitdf580c5352528a4837b996a838f486d3838050a4 (patch)
tree72671b34d6baf1ea2ec4cd02f73fe51338ce0b6d /src/sim/mm.cc
parent3eeb345d673bee6d62b04fc8a8a95ab822dc1e45 (diff)
Move storage to a separate git repository.
Diffstat (limited to 'src/sim/mm.cc')
-rw-r--r--src/sim/mm.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/sim/mm.cc b/src/sim/mm.cc
index 07a362b..a9a60c2 100644
--- a/src/sim/mm.cc
+++ b/src/sim/mm.cc
@@ -9,11 +9,12 @@ MM::MM(Stage *stage) : Stage(stage) { this->id = MEM; }
void MM::advance_helper()
{
signed int data;
+ int i;
switch (this->curr_instr->get_mnemonic()) {
case LOAD:
- this->status = this->storage->read_word(
- this->id, this->curr_instr->get_s1(), data);
+ i = this->storage->read_word(this, this->curr_instr->get_s1(), data);
+ this->status = i ? OK : STALLED;
if (this->status == OK) {
this->curr_instr->set_s1(data);
} else
@@ -22,8 +23,9 @@ void MM::advance_helper()
case STORE:
// TODO signed issues, we aren't wrapping addresses
- this->status = this->storage->write_word(
- this->id, this->curr_instr->get_s2(), this->curr_instr->get_s1());
+ i = this->storage->write_word(
+ this, this->curr_instr->get_s2(), this->curr_instr->get_s1());
+ this->status = i ? OK : STALLED;
if (this->status != OK) {
this->status = STALLED;
}