summaryrefslogtreecommitdiff
path: root/src/sim/if.cc
diff options
context:
space:
mode:
authorSiddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com>2025-03-26 22:05:46 -0400
committerGitHub <noreply@github.com>2025-03-26 22:05:46 -0400
commit7abc8926670c1701db8011cacc9c5e2e2ca95be8 (patch)
treefd3263d2754d662fdad6d69851f14a84f44db4d1 /src/sim/if.cc
parent9eeea1ab8bf4eb17e5da46d57a6c1d455a0a262e (diff)
parent8d37d15ebd1221e3b1698abb3b051d9d0c044c93 (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.cc22
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;
+}