blob: b76c53ed4835da6a1f0191be6a19c66d62333285 (
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
|
#ifndef INSTRUCTION_H_
#define INSTRUCTION_H_
#include <vector>
#include "evaluator.h"
#include "register_address.h"
class emulator;
class instruction {
public:
instruction(
const char * name,
evaluator * evaluator,
std::vector<register_address> dst,
unsigned int src_reg_count);
virtual void execute(emulator & emulator);
virtual void add_src_reg(std::vector<register_address> src_reg);
protected:
const char * m_name;
evaluator * m_evaluator;
std::vector<register_address> m_dst;
std::vector<std::vector<register_address> > m_src_regs;
unsigned int m_src_reg_count;
};
class add_instruction : public instruction {
public:
add_instruction(
std::vector<register_address> dst,
std::vector<register_address> src0,
std::vector<register_address> src1);
add_instruction(std::vector<register_address> dst);
void execute(emulator & emulator);
private:
std::vector<register_address> m_src0;
std::vector<register_address> m_src1;
};
class mov_instruction : public instruction {
public:
mov_instruction(std::vector<register_address> dst);
void execute(emulator & emulator);
};
class mul_instruction : public instruction {
public:
mul_instruction(std::vector<register_address> dst);
void execute(emulator & emulator);
};
/**
* dst = src0 * src1 + src2
*/
class mad_instruction : public instruction {
public:
mad_instruction(std::vector<register_address> dst);
void execute(emulator & emulator);
};
class abs_instruction : public instruction {
public:
abs_instruction(std::vector<register_address> dst);
};
class sub_instruction : public instruction {
public:
sub_instruction(std::vector<register_address> dst);
};
class sat_instruction : public instruction {
public:
sat_instruction(std::vector<register_address> dst);
};
class rcp_instruction : public instruction {
public:
rcp_instruction(std::vector<register_address> dst);
};
class min_instruction : public instruction {
public:
min_instruction(std::vector<register_address> dst);
};
class max_instruction : public instruction {
public:
max_instruction(std::vector<register_address> dst);
};
class dp_instruction : public instruction {
public:
dp_instruction(
unsigned int components,
std::vector<register_address> dst);
void execute(emulator & emulator);
private:
unsigned int m_components;
};
#endif //INSTRUCTION_H_
|