-
Notifications
You must be signed in to change notification settings - Fork 0
/
CPU.hpp
47 lines (34 loc) · 929 Bytes
/
CPU.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
#include "BUS.hpp"
#include "TYPE.hpp"
#define REGISTER_SIZE 1
class CPU
{
private:
WORD REGISTERS[REGISTER_SIZE];
DATA PC; // Program Counter
OPRATE IR; // Instruction Register
BUS * memBUS;
PORT * memPORT;
OPRAND MAR; // Memory Address Register
WORD MBR; // Memory Buffer Register
WORD NULLWORD;
OPRATE operate[OPRATE_SIZE];
OPRATE getOPRate(WORD value);
OPRAND getOPRand(WORD value);
enum OparateTable { LDI, LOAD, STORE, JUMP };
bit4 TIMING;
bool timing_reset = false;
void setBUS(BUS *bus, ADDR _addr, WORD _word, MODE _mode);
WORD readBus(BUS *bus);
void decode();
void Ins_LDI(); // Load Immediate to Register from Operand
void Ins_LOAD(); // Load to Register from Memory
void Ins_STORE(); // Store from Register to Memory
void Ins_JUMP(); // Jump to Memory
public:
void reset();
void clock();
void connect_memory_BUS(BUS *bus, PORT *port);
void debug_print();
};