diff options
author | Siddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com> | 2025-03-30 14:02:23 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-30 14:02:23 -0400 |
commit | eedf9686eb60f2008e7766cc9a5d3e037b9dae64 (patch) | |
tree | 0cfa9009fe483b72940727f3b5a4236f779fe6e7 /src/sim/id.cc | |
parent | d20623d031cf909d8892c2db38cf2e2e02bc6a9b (diff) | |
parent | 8e56373a5436852fe9c7934e03d7b57493625003 (diff) |
Merge pull request #40 from bdunahu/bdunahu
Minor simplification to API between pipeline components
-- Fixed memory leaks
Diffstat (limited to 'src/sim/id.cc')
-rw-r--r-- | src/sim/id.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/sim/id.cc b/src/sim/id.cc index e18ef14..969cb9d 100644 --- a/src/sim/id.cc +++ b/src/sim/id.cc @@ -8,21 +8,24 @@ ID::ID(Stage *stage) : Stage(stage) { this->id = DCDE; } -Response ID::advance(InstrDTO &next_instr, Response p) +InstrDTO *ID::advance(Response p) { + InstrDTO *r = nullptr; Response n; this->advance_helper(); if (this->status == OK && p == OK) { - // mutual consent + // mutual consent this->curr_instr->set_time_of(this->id, this->clock_cycle); - next_instr = *this->curr_instr; + r = new InstrDTO(*this->curr_instr); + delete curr_instr; curr_instr = nullptr; } n = (p != OK || this->status != OK) ? BLOCKED : OK; // the power of consent - n = this->next->advance(curr_instr, n); + this->curr_instr = this->next->advance(n); + return r; } void ID::get_instr_fields( |