-
Notifications
You must be signed in to change notification settings - Fork 0
/
memory.hpp
47 lines (42 loc) · 918 Bytes
/
memory.hpp
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#define MEM_SIZE 0xffff
#include "types.hpp"
#include <vector>
namespace MEMORY {
class Latch {
private:
BIT status;
public:
void set(BIT d);
BIT get();
Latch();
Latch(BIT d);
};
class Register {
protected:
WORD status;
public:
void set(WORD d);
WORD get();
Register();
Register(WORD d);
};
class Counter : public Register {
public:
void tick();
};
class ROM {
protected:
Register registers[MEM_SIZE];
public:
WORD get(WORD addr);
ROM();
ROM(std::vector<Register> regs);
};
class RAM : public ROM {
public:
void set(WORD addr, WORD d);
RAM();
RAM(std::vector<Register> regs);
};
}