diff options
author | Siddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com> | 2025-04-12 13:04:10 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-12 13:04:10 -0400 |
commit | 561f7a6e6c24b05383b6db86b48125ee80a8355f (patch) | |
tree | 6acbfd27652c2b83686df93c21918a877a0451e8 /src/sim/mm.cc | |
parent | c9e35a8f3aa2047701e87a50f12b4bed23d5e7db (diff) | |
parent | 3ae113c7d6f1b6f46d8960b284837a44fbeb2e77 (diff) |
Merge pull request #50 from bdunahu/bdunahu
Move storage to a separate git repository.
Diffstat (limited to 'src/sim/mm.cc')
-rw-r--r-- | src/sim/mm.cc | 10 |
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; } |