blob: 008128350bdf00611970e22b7e3496ed5f79ecae (
plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>mycpu: mycpu/ccpu.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.3 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<h1>mycpu/ccpu.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
<a name="l00009"></a>00009 <span class="preprocessor">#ifndef CCPU_H</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span><span class="preprocessor">#define CCPU_H 1</span>
<a name="l00011"></a>00011 <span class="preprocessor"></span>
<a name="l00012"></a>00012 <span class="preprocessor">#include <iostream></span>
<a name="l00013"></a>00013 <span class="preprocessor">#include <set></span>
<a name="l00014"></a>00014 <span class="preprocessor">#include "cdat.h"</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include "cmem.h"</span>
<a name="l00016"></a>00016 <span class="preprocessor">#include "cprogram.h"</span>
<a name="l00017"></a>00017 <span class="preprocessor">#include "cdisplay.h"</span>
<a name="l00018"></a>00018
<a name="l00025"></a><a class="code" href="classCCPU.html">00025</a> <span class="keyword">class </span><a class="code" href="classCCPU.html">CCPU</a>
<a name="l00026"></a>00026 {
<a name="l00027"></a>00027 <span class="keyword">public</span>:
<a name="l00037"></a>00037 <a class="code" href="classCCPU.html#12b0f403ddbfae0ff52cbf079b96395b" title="Default ctor.">CCPU</a>(<span class="keyword">const</span> <span class="keywordtype">unsigned</span> cnt);
<a name="l00038"></a>00038
<a name="l00048"></a>00048 <a class="code" href="classCCPU.html#7523a3b0b832774c3df57bd019273a68" title="Default dtor.">~CCPU</a>();
<a name="l00049"></a>00049
<a name="l00059"></a><a class="code" href="classCCPU.html#b25ee10ea09dfe12d9e77e5eb2126d32">00059</a> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <a class="code" href="classCCPU.html#b25ee10ea09dfe12d9e77e5eb2126d32" title="get number of registers">getRegisterCount</a>()<span class="keyword"> const</span>
<a name="l00060"></a>00060 <span class="keyword"> </span>{
<a name="l00061"></a>00061 <span class="keywordflow">return</span> m_regcnt;
<a name="l00062"></a>00062 }
<a name="l00063"></a>00063
<a name="l00073"></a><a class="code" href="classCCPU.html#efe3e22919627e5daf525d11b13d5c44">00073</a> <a class="code" href="classCDat.html">CDat</a> *<a class="code" href="classCCPU.html#efe3e22919627e5daf525d11b13d5c44" title="get pointer to registers array">getRegisters</a>()<span class="keyword"> const</span>
<a name="l00074"></a>00074 <span class="keyword"> </span>{
<a name="l00075"></a>00075 <span class="keywordflow">return</span> m_registers;
<a name="l00076"></a>00076 }
<a name="l00077"></a>00077
<a name="l00087"></a><a class="code" href="classCCPU.html#bb2644a658cbfbcdd7c579a2840cee67">00087</a> <span class="keywordtype">void</span> <a class="code" href="classCCPU.html#bb2644a658cbfbcdd7c579a2840cee67" title="set memory of cpu">setMemory</a>(<a class="code" href="classCMem.html">CMem</a> *memory)
<a name="l00088"></a>00088 {
<a name="l00089"></a>00089 m_memory = memory;
<a name="l00090"></a>00090 }
<a name="l00091"></a>00091
<a name="l00101"></a><a class="code" href="classCCPU.html#47e3302a8d9582b29a4d722735d8aa60">00101</a> <a class="code" href="classCMem.html">CMem</a> *<a class="code" href="classCCPU.html#47e3302a8d9582b29a4d722735d8aa60" title="get pointer to memory">getMemory</a>()<span class="keyword"> const</span>
<a name="l00102"></a>00102 <span class="keyword"> </span>{
<a name="l00103"></a>00103 <span class="keywordflow">return</span> m_memory;
<a name="l00104"></a>00104 }
<a name="l00105"></a>00105
<a name="l00115"></a><a class="code" href="classCCPU.html#3790f6567091892f8867329424d03f71">00115</a> <span class="keywordtype">void</span> <a class="code" href="classCCPU.html#3790f6567091892f8867329424d03f71" title="set program to execute">setProgram</a>(<span class="keyword">const</span> <a class="code" href="classCProgram.html">CProgram</a> *program)
<a name="l00116"></a>00116 {
<a name="l00117"></a>00117 m_program = program;
<a name="l00118"></a>00118 }
<a name="l00119"></a>00119
<a name="l00129"></a><a class="code" href="classCCPU.html#f7c34c0ba7230ecc980a5ff7730cdbae">00129</a> <span class="keyword">const</span> <a class="code" href="classCProgram.html">CProgram</a> *<a class="code" href="classCCPU.html#f7c34c0ba7230ecc980a5ff7730cdbae" title="get pointer to program">getProgram</a>()
<a name="l00130"></a>00130 {
<a name="l00131"></a>00131 <span class="keywordflow">return</span> m_program;
<a name="l00132"></a>00132 }
<a name="l00133"></a>00133
<a name="l00143"></a><a class="code" href="classCCPU.html#aab308415ce3083eaa66b9aa1dcbb0c6">00143</a> <span class="keyword">const</span> std::set<CDisplay *>& <a class="code" href="classCCPU.html#aab308415ce3083eaa66b9aa1dcbb0c6" title="get set of pointers to displays">getDisplays</a>()
<a name="l00144"></a>00144 {
<a name="l00145"></a>00145 <span class="keywordflow">return</span> m_displays;
<a name="l00146"></a>00146 }
<a name="l00147"></a>00147
<a name="l00157"></a><a class="code" href="classCCPU.html#33c8a01cbafddb40cf9283109b3a0b08">00157</a> <span class="keywordtype">void</span> <a class="code" href="classCCPU.html#33c8a01cbafddb40cf9283109b3a0b08" title="set zero flag">setFlagZero</a>(<span class="keyword">const</span> <span class="keywordtype">bool</span> value)
<a name="l00158"></a>00158 {
<a name="l00159"></a>00159 m_flagzero = value;
<a name="l00160"></a>00160 }
<a name="l00161"></a>00161
<a name="l00171"></a><a class="code" href="classCCPU.html#9398f58c5a715653c3502040029501a1">00171</a> <span class="keyword">const</span> <span class="keywordtype">bool</span> <a class="code" href="classCCPU.html#9398f58c5a715653c3502040029501a1" title="get value of zero flag">getFlagZero</a>()
<a name="l00172"></a>00172 {
<a name="l00173"></a>00173 <span class="keywordflow">return</span> m_flagzero;
<a name="l00174"></a>00174 }
<a name="l00175"></a>00175
<a name="l00185"></a><a class="code" href="classCCPU.html#d8226c190477e2fbce0ddf7d814a272e">00185</a> <span class="keywordtype">void</span> <a class="code" href="classCCPU.html#d8226c190477e2fbce0ddf7d814a272e" title="set sign flag">setFlagSign</a>(<span class="keyword">const</span> <span class="keywordtype">bool</span> value)
<a name="l00186"></a>00186 {
<a name="l00187"></a>00187 m_flagsign = value;
<a name="l00188"></a>00188 }
<a name="l00189"></a>00189
<a name="l00199"></a><a class="code" href="classCCPU.html#c3d7d2bf5f93aa2d7b6f5959b8448ea2">00199</a> <span class="keyword">const</span> <span class="keywordtype">bool</span> <a class="code" href="classCCPU.html#c3d7d2bf5f93aa2d7b6f5959b8448ea2" title="get value of sign flag">getFlagSign</a>()
<a name="l00200"></a>00200 {
<a name="l00201"></a>00201 <span class="keywordflow">return</span> m_flagsign;
<a name="l00202"></a>00202 }
<a name="l00203"></a>00203
<a name="l00213"></a>00213 <span class="keywordtype">void</span> <a class="code" href="classCCPU.html#045df5c772702bdc1454fb90d512fb68" title="execute current program">run</a>();
<a name="l00214"></a>00214
<a name="l00215"></a>00215 <span class="preprocessor">#if DEBUG</span>
<a name="l00216"></a>00216 <span class="preprocessor"></span>
<a name="l00225"></a>00225 <span class="keywordtype">void</span> dumpRegisters(std::ostream& out);
<a name="l00226"></a>00226 <span class="preprocessor">#endif</span>
<a name="l00227"></a>00227 <span class="preprocessor"></span>
<a name="l00228"></a>00228 <span class="keyword">private</span>:
<a name="l00229"></a>00229 <span class="comment">/* members */</span>
<a name="l00230"></a>00230 <a class="code" href="classCDat.html">CDat</a> *m_registers;
<a name="l00231"></a>00231 <span class="keywordtype">unsigned</span> m_regcnt;
<a name="l00232"></a>00232 <a class="code" href="classCMem.html">CMem</a> *m_memory;
<a name="l00233"></a>00233 <span class="keyword">const</span> <a class="code" href="classCProgram.html">CProgram</a> *m_program;
<a name="l00234"></a>00234 std::set<CDisplay *> m_displays;
<a name="l00235"></a>00235 <span class="keywordtype">bool</span> m_flagzero;
<a name="l00236"></a>00236 <span class="keywordtype">bool</span> m_flagsign;
<a name="l00237"></a>00237 };
<a name="l00238"></a>00238
<a name="l00239"></a>00239 <span class="preprocessor">#endif</span>
<a name="l00240"></a>00240 <span class="preprocessor"></span>
<a name="l00241"></a>00241 <span class="comment">/* vim: set et sw=2 ts=2: */</span>
</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Thu May 14 18:19:16 2009 for mycpu by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address>
</body>
</html>
|