diff options
author | Siddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com> | 2025-03-26 22:05:46 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-26 22:05:46 -0400 |
commit | 7abc8926670c1701db8011cacc9c5e2e2ca95be8 (patch) | |
tree | fd3263d2754d662fdad6d69851f14a84f44db4d1 /src/sim/if.cc | |
parent | 9eeea1ab8bf4eb17e5da46d57a6c1d455a0a262e (diff) | |
parent | 8d37d15ebd1221e3b1698abb3b051d9d0c044c93 (diff) |
Merge pull request #36 from bdunahu/bdunahu
Add fetch stage implementation, tests, program loading, DTO object
Base classes plus base tests for Instruction Fetch stage with a default program
Diffstat (limited to 'src/sim/if.cc')
-rw-r--r-- | src/sim/if.cc | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/sim/if.cc b/src/sim/if.cc index 1026072..deed8e1 100644 --- a/src/sim/if.cc +++ b/src/sim/if.cc @@ -1,15 +1,19 @@ #include "if.h" -#include "logger.h" +#include "accessor.h" +#include "instrDTO.h" #include "response.h" -static Logger *global_log = Logger::getInstance(); - -Response IF::advance() +Response IF::advance(InstrDTO &i) { - global_log->log(INFO, "hello from fetch!"); - return OK; -} - - + Response r; + signed int bits; + r = this->storage->read_word(this->id, this->pc, bits); + if (r == OK) { + ++this->pc; + i.set_if_cycle(this->clock_cycle); + i.set_instr_bits(bits); + } + return r; +} |