1
- pub mod operation;
1
+ use crate :: instruction:: address:: { AccessMode , Address } ;
2
+ use crate :: num:: { MaskedU32 , MaskedU8 } ;
3
+
2
4
pub mod address;
3
5
pub mod vector;
4
- pub mod flag ;
6
+ pub mod branch ;
5
7
pub mod encoding;
6
-
7
- use crate :: instruction:: address:: Address ;
8
- use crate :: instruction:: flag:: Flag ;
9
- use crate :: num:: { MaskedU8 } ;
8
+ mod register;
9
+ mod arithmetic;
10
10
11
11
pub type SegmentCode = MaskedU8 < 0x3 > ;
12
- pub type RegisterCode = MaskedU8 < 0xF > ;
13
- pub type BranchHintCode = MaskedU8 < 0x3 > ;
14
- pub type OperandCode = MaskedU8 < 0x3 > ;
15
-
16
- #[ derive( Debug , Clone , Copy , PartialEq ) ]
17
- pub enum Format {
18
- WaitForInterrupt ,
19
- LoadImmediate ,
20
- LoadVectorComponents ,
21
- ExtractVectorComponents ,
22
- MapVector ,
23
- Branch ,
24
- DualSource ( operation:: DualSource ) ,
25
- Destination ( operation:: Destination ) ,
26
- DestinationSource ( operation:: DestinationSource ) ,
27
- DestinationDualSource ( operation:: DestinationDualSource ) ,
28
- DestinationTripleSource ( operation:: DestinationTripleSource ) ,
29
- DualDestinationDualSource ( operation:: DualDestinationDualSource ) ,
30
- Memory ( operation:: Memory ) ,
31
- SourceMemory ( operation:: SourceMemory ) ,
32
- DestinationMemory ( operation:: DestinationMemory )
33
- }
12
+ pub type LargeImmediate = MaskedU32 < 0x1FFFFF > ;
13
+ pub type ScaleCode = MaskedU8 < 0x03 > ;
34
14
35
15
#[ derive( Debug , Clone , Copy , PartialEq ) ]
36
16
pub enum Instruction {
37
- WaitForInterrupt ,
38
- LoadImmediate {
39
- destination : RegisterCode ,
17
+ None ,
18
+ Wait ,
19
+
20
+ End ,
21
+ EndInterrupt ,
22
+ Interrupt ,
23
+
24
+ Stack { source : register:: Code } ,
25
+ Unstack { destination : register:: Code } ,
26
+
27
+ LoadImmediate {
28
+ destination : register:: Code ,
40
29
segment : SegmentCode ,
41
- immediate : u16
42
- } ,
43
- LoadVectorComponents {
44
- destination : RegisterCode ,
45
- /// Having [None] means that the component corresponding to the index should be 0.
46
- components : [ Option < RegisterCode > ; vector:: SIZE ]
30
+ immediate : LargeImmediate
47
31
} ,
48
- ExtractVectorComponents {
49
- source : RegisterCode ,
50
- /// Having [None] means that the component corresponding to the index should not be extracted into a register.
51
- destinations : [ Option < RegisterCode > ; vector:: SIZE ]
32
+ BuildVector {
33
+ destination : register:: Code ,
34
+ components : [ register:: Code ; vector:: SIZE ]
52
35
} ,
53
- /// Only supports 2 operands due to the size constrain of an instruction.
54
- MapVector {
55
- temporary : bool ,
56
- operand : OperandCode ,
57
- mappings : [ vector:: ComponentCode ; vector:: SIZE ]
36
+ UnBuildVector {
37
+ source : register:: Code ,
38
+ destinations : [ register:: Code ; vector:: SIZE ]
58
39
} ,
59
- Branch {
60
- condition : Flag ,
61
- hint : Option < bool > ,
62
- address : Address
63
- } ,
64
- DualSource {
65
- operation : operation:: DualSource ,
66
- sources : [ RegisterCode ; 2 ]
67
- } ,
68
- Destination {
69
- operation : operation:: Destination ,
70
- destination : RegisterCode
40
+
41
+ CopyRegister {
42
+ destination : register:: Code ,
43
+ destination_file : register:: FileName ,
44
+ source : register:: Code ,
45
+ source_file : register:: FileName
71
46
} ,
72
- DestinationSource {
73
- operation : operation:: DestinationSource ,
74
- destination : RegisterCode ,
75
- source : RegisterCode
47
+
48
+ Arithmetic {
49
+ operation : arithmetic:: Operation ,
50
+ vector : bool ,
51
+ atomic : bool ,
52
+ destination : register:: Code ,
53
+ sources : [ register:: Code ; 2 ]
76
54
} ,
77
- DestinationDualSource {
78
- operation : operation :: DestinationDualSource ,
79
- destination : RegisterCode ,
80
- sources : [ RegisterCode ; 2 ]
55
+ Address {
56
+ operation : address :: Operation ,
57
+ data : address :: Meta ,
58
+ offset : address :: LargeOffset
81
59
} ,
82
- DestinationTripleSource {
83
- operation : operation:: DestinationTripleSource ,
84
- destination : RegisterCode ,
85
- sources : [ RegisterCode ; 3 ]
60
+ AddressWithBase {
61
+ operation : address:: OperationWithBase ,
62
+ data : address:: Meta ,
63
+ base : register:: Code ,
64
+ offset : address:: SmallOffset
86
65
} ,
87
- DualDestinationDualSource {
88
- operation : operation:: DualDestinationDualSource ,
89
- destinations : [ RegisterCode ; 2 ] ,
90
- sources : [ RegisterCode ; 2 ]
91
- } ,
92
- Memory {
93
- operation : operation:: Memory ,
94
- address : Address
66
+ Branch {
67
+ operation : branch:: Operation ,
68
+ data : branch:: Meta ,
69
+ offset : branch:: LargeOffset
95
70
} ,
96
- SourceMemory {
97
- operation : operation:: SourceMemory ,
98
- destination : RegisterCode ,
99
- source : Address
71
+ BranchWithBase {
72
+ operation : branch:: OperationWithBase ,
73
+ data : branch:: Meta ,
74
+ base : register:: Code ,
75
+ offset : branch:: SmallOffset
100
76
} ,
101
- DestinationMemory {
102
- operation : operation:: DestinationMemory ,
103
- destination : Address ,
104
- source : RegisterCode
105
- }
77
+
78
+ Timer ,
79
+
80
+ Lock ,
81
+ UnLock ,
82
+
83
+ Free2 ,
84
+ Free3 ,
85
+ Free4
106
86
}
0 commit comments