summaryrefslogtreecommitdiff
path: root/src/storage
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/storage
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/storage')
-rw-r--r--src/storage/dram.cc10
1 files changed, 10 insertions, 0 deletions
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,