diff options
author | bd <bdunahu@operationnull.com> | 2025-03-26 12:21:52 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-03-26 12:21:52 -0400 |
commit | b417eefe0b451ac01cef794f97e548f987bf173d (patch) | |
tree | bf2ff9e8033a89814f675d13ba6ce40281484491 | |
parent | 9476d1355493cdab93064ec123ac13bfb78e8ed3 (diff) |
Add fetch stage implementation, tests, program loading, DTO object
-rw-r--r-- | inc/dram.h | 5 | ||||
-rw-r--r-- | src/storage/dram.cc | 10 |
2 files changed, 15 insertions, 0 deletions
@@ -29,6 +29,11 @@ class Dram : public Storage Response read_word(Accessor accessor, int address, signed int &data) override; + /** + * TODO This will accept a file at a later date. + */ + void load(std::vector<signed int> program); + private: /** * Helper for all access methods. diff --git a/src/storage/dram.cc b/src/storage/dram.cc index 371503d..f90f8db 100644 --- a/src/storage/dram.cc +++ b/src/storage/dram.cc @@ -56,6 +56,16 @@ Response Dram::read_word(Accessor accessor, int address, signed int &data) }); } +// TODO load a file instead and test this method +void Dram::load(std::vector<signed int> program) { + unsigned long i; + for (i = 0; i < program.size(); ++i) { + int line, word; + get_memory_index(i, line, word); + this->data->at(line).at(word) = program[i]; + } +} + Response Dram::process( Accessor accessor, int address, |