-
Notifications
You must be signed in to change notification settings - Fork 1
/
Component.hpp
72 lines (54 loc) · 1.41 KB
/
Component.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
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
#ifndef VM_Component
#define VM_Component
#include "HwError.hpp"
namespace Component
{
typedef enum
{
Component_ID_BaseComponent = 0,
Component_ID_ALU,
Component_ID_FPU,
Component_ID_IntRegisterFile,
Component_ID_FloatRegisterFile,
Component_ID_RawMem,
Component_ID_Bus,
Component_ID_InstructionDecoder,
Component_ID_InstructionExecuter,
Component_ID_ConstantGenerator,
Component_ID_StageIF,
Component_ID_StageID,
Component_ID_StageEX,
Component_ID_StageMEM,
Component_ID_StageWB,
Component_ID_Printer,
Component_ID_Power,
Component_ID_MemoryUnit,
Component_ID_Keyboard,
Component_ID_VirtualMachine,
} Component_ID;
class Component_t
{
private:
HwError lastHwError = HwError_NoError;
protected:
void SetLastHwError( HwError newError )
{
lastHwError = newError;
}
public:
virtual Component_ID GetID()
{
return Component_ID_BaseComponent;
}
virtual HwError Setup()
{
SetLastHwError( HwError_NoError );
return HwError_NoError;
}
HwError LastHwError()
{
return lastHwError;
}
};
};
#endif