summaryrefslogtreecommitdiff
path: root/inc/dram.h
blob: ec35e3fa4a16503dd692a558ae873f7a81e70d9c (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
#ifndef DRAM_H
#define DRAM_H
#include <storage.h>

class Dram : public Storage
{
  public:
	/**
	 * Constructor.
	 * @param The number of `lines` contained in memory. The total number of
	 * words is this number multiplied by LINE_SIZE.
	 * @param The number of clock cycles each access takes.
	 * @return A new memory object.
	 */
	Dram(int lines, int delay);
	~Dram();

	Response write(Accessor accessor, signed int data, int address) override;
	Response read(Accessor accessor, int address, std::array<signed int, LINE_SIZE>& data) override;

	private:
	void do_read(std::array<signed int, LINE_SIZE>& data_line, int address){
		int line = address / LINE_SIZE;
		data_line = this->data->at(line);
	}
};

#endif /* DRAM_H_INCLUDED */