spartan3e: bootrom_v1.bit
[calu.git] / 3b_sim / ccpu.hpp
1 #ifndef __CPU__H__
2 #define __CPU__H__
3
4 #include "cdat.hpp"
5 #include "cmem.hpp"
6 #include "cpmem.hpp"
7
8 #include "ccolor.h"
9
10 class Iinstr;
11
12 #include <boost/regex.hpp>
13 #include "Iinstr.hpp"
14
15
16 class CCpu {
17         private:
18
19                 bool m_Z, m_S, m_C, m_O;
20
21                 CDat m_pc, m_pc_next, m_perf;
22                 CMem<CDat> m_reg, m_ram;
23                 CPMem<Iinstr*> m_prog;
24
25                 CDat m_stack;
26
27         public:
28                 void registerExtension() {};
29                 void tick();
30
31                 CDat getRegister(const int) const;
32                 void setRegister(const int, CDat);
33
34                 CDat getRAM(const int) const;
35                 void setRAM(const int, CDat);
36
37                 Iinstr* getProg(const int) const;
38                 void setProg(const int, Iinstr*);
39
40                 CDat getPerf() const;
41                 void setPerf(CDat);
42                 void incPerf();
43                 void incPerfBy(short);
44
45                 CDat getCurPC() const;
46                 CDat getNextPC() const;
47                 void setNextPC(CDat);
48
49                 CDat getFlags() const;
50                 void setFlags(CDat);
51                 /* will only change zero and sign */
52                 void updateFlags(CDat);
53                 /* will change all flags */
54                 void updateFlags(CDatd, CDat, CDat);
55                 /* will change all flags */
56                 void updateFlags(bool z, bool o, bool c, bool s);
57                 /* will change carry */
58                 void updateCarry(bool c);
59
60                 bool getCarry();
61
62                 bool conditionMet(short);
63
64                 int getStack() const;
65                 void setStack(const int);
66
67                 string colorifyInstr(string instr);
68
69                 CCpu(int,int,int);
70
71 };
72
73
74 #endif