diff options
author | Siddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com> | 2025-03-30 19:34:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-30 19:34:17 -0400 |
commit | 12a9e93f913c0057f2ef32f5894931c8b4bd3a85 (patch) | |
tree | 88669ed2be55b4f455ef4ac56263a01dd5f70a40 /src/sim/id.cc | |
parent | eedf9686eb60f2008e7766cc9a5d3e037b9dae64 (diff) | |
parent | 36dabe6183af98b2e3f6d0316436dc3affc3d986 (diff) |
Merge pull request #41 from bdunahu/bdunahu
Add mock stage, proper decode tests
changes look good
Diffstat (limited to 'src/sim/id.cc')
-rw-r--r-- | src/sim/id.cc | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/src/sim/id.cc b/src/sim/id.cc index 969cb9d..36addbb 100644 --- a/src/sim/id.cc +++ b/src/sim/id.cc @@ -8,26 +8,6 @@ ID::ID(Stage *stage) : Stage(stage) { this->id = DCDE; } -InstrDTO *ID::advance(Response p) -{ - InstrDTO *r = nullptr; - Response n; - - this->advance_helper(); - if (this->status == OK && p == OK) { - // mutual consent - this->curr_instr->set_time_of(this->id, this->clock_cycle); - r = new InstrDTO(*this->curr_instr); - delete curr_instr; - curr_instr = nullptr; - } - - n = (p != OK || this->status != OK) ? BLOCKED : OK; - // the power of consent - this->curr_instr = this->next->advance(n); - return r; -} - void ID::get_instr_fields( signed int &s1, signed int &s2, signed int &s3, Mnemonic &m) { @@ -67,7 +47,7 @@ Response ID::read_guard(signed int &v) { Response r; if (this->is_checked_out(v)) - r = BLOCKED; + r = STALLED; else { r = OK; v = this->dereference_register(v); @@ -116,8 +96,9 @@ void ID::decode_R_type(signed int &s1, signed int &s2, signed int &s3) r2 = this->read_guard(s2); this->write_guard(s3); - this->status = (r1 == BLOCKED || r2 == BLOCKED) ? BLOCKED : OK; + this->status = (r1 == OK && r2 == OK) ? OK : STALLED; } + void ID::decode_I_type(signed int &s1, signed int &s2, signed int &s3) { unsigned int s0b, s1b, s2b; |