summaryrefslogtreecommitdiff
path: root/src/storage/dram.cc
blob: 845db21d0c7934b7bb768de4031186090324aef9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#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, LINE_SIZE>>;
	this->data->resize(lines);
	this->delay = delay;
	this->lower = nullptr;
}

Dram::~Dram() { delete this->data; }

Response *Dram::write(Accessor accessor, signed int data, int address)
{
	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; }