summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/ex.cc2
-rw-r--r--src/sim/if.cc4
-rw-r--r--src/sim/mm.cc10
3 files changed, 10 insertions, 6 deletions
diff --git a/src/sim/ex.cc b/src/sim/ex.cc
index b6f8a1d..50f00a8 100644
--- a/src/sim/ex.cc
+++ b/src/sim/ex.cc
@@ -1,6 +1,6 @@
#include "ex.h"
#include "accessor.h"
-#include "definitions.h"
+#include "pipe_spec.h"
#include "instrDTO.h"
#include "response.h"
#include "stage.h"
diff --git a/src/sim/if.cc b/src/sim/if.cc
index 85fb27f..4ab7f3e 100644
--- a/src/sim/if.cc
+++ b/src/sim/if.cc
@@ -26,10 +26,12 @@ InstrDTO *IF::advance(Response p)
void IF::advance_helper()
{
Response r;
+ int i;
signed int bits;
if (this->curr_instr == nullptr) {
- r = this->storage->read_word(this->id, this->pc, bits);
+ i = this->storage->read_word(this, this->pc, bits);
+ r = i ? OK : STALLED;
if (r == OK) {
this->curr_instr = new InstrDTO();
this->curr_instr->set_instr_bits(bits);
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;
}