@@ -27,21 +27,21 @@ impl Instruction {
27
27
( destination, segment, immediate)
28
28
}
29
29
30
- fn decode_load_vector ( operands : EncodedOperands ) -> ( RegisterCode , [ Option < vector :: ComponentCode > ; vector:: SIZE ] ) {
30
+ fn decode_vector_components ( operands : EncodedOperands ) -> ( RegisterCode , [ Option < RegisterCode > ; vector:: SIZE ] ) {
31
31
let operands = operands. get ( ) ;
32
- let destination = RegisterCode :: new ( ( operands & LOAD_VECTOR_DESTINATION ) as u8 ) ;
32
+ let primary = RegisterCode :: new ( ( operands & LOAD_VECTOR_DESTINATION ) as u8 ) ;
33
33
34
34
let enable_0 = ( ( operands & LOAD_VECTOR_COMPONENT_ENABLE_0 . 1 ) >> LOAD_VECTOR_COMPONENT_ENABLE_0 . 0 ) > 0 ;
35
35
let enable_1 = ( ( operands & LOAD_VECTOR_COMPONENT_ENABLE_1 . 1 ) >> LOAD_VECTOR_COMPONENT_ENABLE_1 . 0 ) > 0 ;
36
36
let enable_2 = ( ( operands & LOAD_VECTOR_COMPONENT_ENABLE_2 . 1 ) >> LOAD_VECTOR_COMPONENT_ENABLE_2 . 0 ) > 0 ;
37
37
let enable_3 = ( ( operands & LOAD_VECTOR_COMPONENT_ENABLE_3 . 1 ) >> LOAD_VECTOR_COMPONENT_ENABLE_3 . 0 ) > 0 ;
38
38
39
- let component_0 = vector :: ComponentCode :: new ( ( ( operands & LOAD_VECTOR_COMPONENT_0 . 1 ) >> LOAD_VECTOR_COMPONENT_0 . 0 ) as u8 ) ;
40
- let component_1 = vector :: ComponentCode :: new ( ( ( operands & LOAD_VECTOR_COMPONENT_1 . 1 ) >> LOAD_VECTOR_COMPONENT_1 . 0 ) as u8 ) ;
41
- let component_2 = vector :: ComponentCode :: new ( ( ( operands & LOAD_VECTOR_COMPONENT_2 . 1 ) >> LOAD_VECTOR_COMPONENT_2 . 0 ) as u8 ) ;
42
- let component_3 = vector :: ComponentCode :: new ( ( ( operands & LOAD_VECTOR_COMPONENT_3 . 1 ) >> LOAD_VECTOR_COMPONENT_3 . 0 ) as u8 ) ;
39
+ let component_0 = RegisterCode :: new ( ( ( operands & LOAD_VECTOR_COMPONENT_0 . 1 ) >> LOAD_VECTOR_COMPONENT_0 . 0 ) as u8 ) ;
40
+ let component_1 = RegisterCode :: new ( ( ( operands & LOAD_VECTOR_COMPONENT_1 . 1 ) >> LOAD_VECTOR_COMPONENT_1 . 0 ) as u8 ) ;
41
+ let component_2 = RegisterCode :: new ( ( ( operands & LOAD_VECTOR_COMPONENT_2 . 1 ) >> LOAD_VECTOR_COMPONENT_2 . 0 ) as u8 ) ;
42
+ let component_3 = RegisterCode :: new ( ( ( operands & LOAD_VECTOR_COMPONENT_3 . 1 ) >> LOAD_VECTOR_COMPONENT_3 . 0 ) as u8 ) ;
43
43
44
- ( destination , [
44
+ ( primary , [
45
45
enable_0. then_some ( component_0) ,
46
46
enable_1. then_some ( component_1) ,
47
47
enable_2. then_some ( component_2) ,
@@ -66,10 +66,13 @@ impl Instruction {
66
66
Self :: LoadImmediate { destination, segment, immediate }
67
67
} ,
68
68
Format :: LoadVectorComponents => {
69
- let ( destination, components) = Self :: decode_load_vector ( operands) ;
69
+ let ( destination, components) = Self :: decode_vector_components ( operands) ;
70
70
Self :: LoadVectorComponents { destination, components}
71
71
} ,
72
- Format :: ExtractVectorComponents => todo ! ( ) ,
72
+ Format :: ExtractVectorComponents => {
73
+ let ( source, destinations) = Self :: decode_vector_components ( operands) ;
74
+ Self :: ExtractVectorComponents { source, destinations }
75
+ } ,
73
76
Format :: FlagVectorComponents => todo ! ( ) ,
74
77
Format :: MapVector => todo ! ( ) ,
75
78
Format :: Branch => todo ! ( ) ,
0 commit comments