From b81c86b438123457be86af2e7c24375856afa742 Mon Sep 17 00:00:00 2001 From: bd Date: Wed, 26 Mar 2025 12:21:52 -0400 Subject: Add fetch stage implementation, tests, program loading, DTO object --- src/sim/if.cc | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/sim/if.cc') 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; +} -- cgit v1.2.3