-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcpu_opcode.template.h
50 lines (44 loc) · 980 Bytes
/
cpu_opcode.template.h
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
// generated file
#pragma once
#include "utils.h"
typedef enum op {
/*% profiles.each do |p| -%*/
// Addressing:/*%= p.mode %*/
/*%= p.enum %*/ = 0x/*%= p.op %*/,
/*% end -%*/
} op_t;
typedef enum op_mode {
/*% profiles.group_by{|p| p.mode}.each_key do |k| -%*/
OP_MODE_/*%= k %*/,
/*% end -%*/
} op_mode_t;
static inline bool op_is_official(op_t op)
{
switch (op) {
/*% profiles.select{|p| p.official }.each do |p| -%*/
case /*%= p.enum %*/: /* Fallthrough */
/*% end -%*/
return true;
default:
return false;
}
}
static inline int op_length(op_t op)
{
switch (op) {
/*% profiles.group_by{|p| p.length}.each do |k, v| -%*/
/*% v.each do |p| -%*/
case /*%= p.enum %*/: /* Fallthrough */
/*% end -%*/
return /*%= k %*/;
/*% end -%*/
}
}
typedef struct op_profile {
uint8_t op;
char name[4];
op_mode_t mode;
uint8_t length;
bool official;
} op_profile_t;
extern op_profile_t op_profiles[256];