diff options
author | bd <bdunahu@operationnull.com> | 2025-03-09 16:26:18 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-03-09 16:26:18 -0400 |
commit | 339ad951993aef22ef87f4dcdc9cb106a3c97572 (patch) | |
tree | ef79dc4b956c25f13d363473b4378f2b9eec7de5 /src/storage | |
parent | fcf0358b0597b733f36b0c862bf18a98efdea224 (diff) | |
parent | 859d10eef015dde4a3428ffb555bc02b8b08341a (diff) |
Merge remote-tracking branch 'origin/master' into bdunahu
Diffstat (limited to 'src/storage')
-rw-r--r-- | src/storage/cache.cc | 2 | ||||
-rw-r--r-- | src/storage/dram.cc | 18 |
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; + } |