-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCPU16.h
More file actions
61 lines (46 loc) · 1.03 KB
/
CPU16.h
File metadata and controls
61 lines (46 loc) · 1.03 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef CPU16_H
#define CPU16_H
#include "Memory.h"
#include "Register.h"
#include "ALU.h"
#include "CU.h"
#include <vector>
using namespace std;
class CPU16 {
private:
ALU alu;
CU cu;
PC pc;
IR ir;
AC ac;
Memory* memory;
bool running;
bool verbose; // 실행 과정 출력 여부
public:
CPU16(Memory* mem);
~CPU16();
// 프로그램 실행
void run(unsigned int startAddr, unsigned int endAddr);
// (Fetch-Decode-Execute)
bool step();
// 레지스터 상태
void printRegisters();
// PC 설정
void setPC(unsigned int addr);
// 실행 범위 설정
void setExecutionRange(unsigned int start, unsigned int end);
// verbose 모드 설정
void setVerbose(bool v) { verbose = v; }
// 단일 스텝
void prepareRun(unsigned int startAddr, unsigned int endAddr);
bool stepOnce();
bool isRunning() { return running; }
private:
unsigned int execStartAddr;
unsigned int execEndAddr;
// Fetch
void fetch();
// Decode & Execute
void execute();
};
#endif