-
Notifications
You must be signed in to change notification settings - Fork 0
/
dataStructure.h
67 lines (60 loc) · 1.39 KB
/
dataStructure.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#define NOT_USED_DEFAULT_VALUE 5
#define LABAL_MAX_LENGTH 30
/* symbol struct */
typedef struct symbol {
char name[LABAL_MAX_LENGTH];
int icRefrence;
int commandType;
int isExternal;
int dcRefrence;
} Symbol;
/* symbol node */
typedef struct symbolNode {
Symbol value;
struct symbolNode* next;
} SymbolNode;
SymbolNode *symbolTable;
/* action definition */
typedef struct action {
char *name;
int binaryIndex;
int sourceOper[4];
int destOper[4];
unsigned int numOfOperands;
} Action;
typedef union word {
/*Binary command |notUsed|Group|opCode|SRC|DEST|ERA|*/
struct {
unsigned int ERA:2;
unsigned int dest:2;
unsigned int src:2;
unsigned int opCode:4;
unsigned int group:2;
unsigned int notUsed:3;
} command;
/*Register values |NOTUSED|DEST|SRC|ERA|*/
struct {
unsigned int ERA:2;
int src:6;
int dest:6;
unsigned int notUsed:1;
} registerValue;
/*Value |VALUE|ERA|*/
struct {
unsigned int ERA:2;
signed int value:13;
} regularValue;
/*Base8*/
struct{
unsigned int block1:3;
unsigned int block2:3;
unsigned int block3:3;
unsigned int block4:3;
unsigned int block5:3;
} Base8;
} WordDef;
/* word for code collections */
typedef struct{
WordDef *word;
int wordType;
} Word;