diff options
Diffstat (limited to 'src/storage/dram.cc')
-rw-r--r-- | src/storage/dram.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/storage/dram.cc b/src/storage/dram.cc index 89c7316..845db21 100644 --- a/src/storage/dram.cc +++ b/src/storage/dram.cc @@ -1,10 +1,11 @@ #include "dram.h" +#include "definitions.h" #include "response.h" #include <algorithm> Dram::Dram(int lines, int delay) { - this->data = new std::vector<std::array<signed int, 4>>; + this->data = new std::vector<std::array<signed int, LINE_SIZE>>; this->data->resize(lines); this->delay = delay; this->lower = nullptr; @@ -14,7 +15,14 @@ Dram::~Dram() { delete this->data; } Response *Dram::write(Accessor accessor, signed int data, int address) { - return new Response(); + struct Response *r = new Response(); + int line = address / LINE_SIZE; + int word = address % LINE_SIZE; + + this->data->at(line).at(word) = data; + + r->status = OK; + return r; } Response *Dram::read(Accessor accessor, int address) { return nullptr; } |