summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/stage.h2
-rw-r--r--src/sim/id.cc3
-rw-r--r--src/sim/if.cc2
-rw-r--r--tests/id.cc4
4 files changed, 7 insertions, 4 deletions
diff --git a/inc/stage.h b/inc/stage.h
index 19e3896..b68293b 100644
--- a/inc/stage.h
+++ b/inc/stage.h
@@ -83,7 +83,7 @@ class Stage
/**
* A pointer to the current instruction this stage is processing.
*/
- std::unique_ptr<InstrDTO> curr_instr;
+ InstrDTO *curr_instr;
/**
* The current status of this stage.
*/
diff --git a/src/sim/id.cc b/src/sim/id.cc
index e18ef14..da7b55c 100644
--- a/src/sim/id.cc
+++ b/src/sim/id.cc
@@ -22,7 +22,8 @@ Response ID::advance(InstrDTO &next_instr, Response p)
n = (p != OK || this->status != OK) ? BLOCKED : OK;
// the power of consent
- n = this->next->advance(curr_instr, n);
+ n = this->next->advance(*curr_instr, n);
+ return this->status;
}
void ID::get_instr_fields(
diff --git a/src/sim/if.cc b/src/sim/if.cc
index 7d3291b..3d53ad3 100644
--- a/src/sim/if.cc
+++ b/src/sim/if.cc
@@ -28,7 +28,7 @@ void IF::advance_helper()
r = this->storage->read_word(this->id, this->pc, bits);
if (r == OK) {
this->status = r;
- this->curr_instr = std::make_unique<InstrDTO>();
+ this->curr_instr = new InstrDTO();
this->curr_instr->set_instr_bits(bits);
} else
this->status = STALLED;
diff --git a/tests/id.cc b/tests/id.cc
index d9c1701..f460505 100644
--- a/tests/id.cc
+++ b/tests/id.cc
@@ -14,7 +14,7 @@ class IDFixture
{
Dram *dr;
- dr = new Dram(3);
+ this->dr = new Dram(3);
this->c = new Cache(dr, 1);
IF *f = new IF(nullptr);
this->d = new ID(f);
@@ -65,6 +65,8 @@ class IDFixture
t = (t << TYPE_SIZE) + type;
return t;
}
+
+ Dram *dr;
Cache *c;
ID *d;
Controller *ct;