summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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;
+ }