-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocessor.hpp
More file actions
34 lines (29 loc) · 785 Bytes
/
processor.hpp
File metadata and controls
34 lines (29 loc) · 785 Bytes
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
#include "ram.hpp"
//#include "rom.hpp"
#include "components.hpp"
#include <functional>
#include <unordered_map>
using namespace std;
typedef struct state_transition
{
int state_count;
static unordered_map<string, state_transition*> state_map; // this map contains all created states and helps avoid memory leaks
std::function <state_transition* (void)> &transition;
} state_transition;
state_transition * new_state(int state_num);
class Processor {
private:
bit clock;
// need control
program_counter pc;
Ram memory;
state_transition *state;
INPUT_SIGNALS signals;
ROM_SIGNALS control_signals;
public:
int tick();
int reset_state();
int init_state_graph();
Processor() : clock(0), pc(0), memory(0) {};
~Processor();
};