summaryrefslogtreecommitdiff
path: root/src/storage
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-03-09 16:26:18 -0400
committerbd <bdunahu@operationnull.com>2025-03-09 16:26:18 -0400
commit75417c54b52df5b98601e3a22b47de1641eab914 (patch)
treeef79dc4b956c25f13d363473b4378f2b9eec7de5 /src/storage
parent2fadd8f68dc8d3a439c69db2a37e4339fdfdbf47 (diff)
parente4ad6c6694aa1fe9762714507c9ff3488ec21c90 (diff)
Merge remote-tracking branch 'origin/master' into bdunahu
Diffstat (limited to 'src/storage')
-rw-r--r--src/storage/cache.cc2
-rw-r--r--src/storage/dram.cc18
2 files changed, 18 insertions, 2 deletions
diff --git a/src/storage/cache.cc b/src/storage/cache.cc
index bf1126a..cf954b0 100644
--- a/src/storage/cache.cc
+++ b/src/storage/cache.cc
@@ -33,4 +33,4 @@ Response Cache::write(Accessor accessor, signed int data, int address)
return r;
}
-Response Cache::read(Accessor accessor, int address) { return WAIT; }
+Response Cache::read(Accessor accessor, int address, std::array<signed int, LINE_SIZE>& data) { return WAIT; }
diff --git a/src/storage/dram.cc b/src/storage/dram.cc
index 7db5676..0db4c35 100644
--- a/src/storage/dram.cc
+++ b/src/storage/dram.cc
@@ -38,4 +38,20 @@ Response Dram::write(Accessor accessor, signed int data, int address)
return r;
}
-Response Dram::read(Accessor accessor, int address) { return WAIT; }
+void Dram::do_read(std::array<signed int, LINE_SIZE>& data_line, int address){
+ int line = address / LINE_SIZE;
+ data_line = this->data->at(line);
+}
+
+Response Dram::read(Accessor accessor, int address, std::array<signed int, LINE_SIZE>& data) {
+ Response r = WAIT;
+ if (this->requester == IDLE)
+ this->requester = accessor;
+ if (this->requester == accessor) {
+ if (this->wait_time == 0) {
+ this->do_read(data, address);
+ r = OK;
+ }
+ }
+ return r;
+ }