summaryrefslogtreecommitdiff
path: root/src/storage/dram.cc
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-03-06 00:34:35 -0500
committerbd <bdunahu@operationnull.com>2025-03-06 00:34:35 -0500
commit3322aa0845f7fe9cc98aa4e429bd5ecf72a5c27e (patch)
tree75f627ee8e75c0763ab8b048496464c60e486490 /src/storage/dram.cc
parent20fe698a4074df4abe02f14a1a14481770e90abc (diff)
dram write (no delay, no accessor tracking
Diffstat (limited to 'src/storage/dram.cc')
-rw-r--r--src/storage/dram.cc12
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; }