-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstructions.py
More file actions
77 lines (75 loc) · 2.2 KB
/
instructions.py
File metadata and controls
77 lines (75 loc) · 2.2 KB
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
class Instructions(object):
instructions = {
'nop': {
'opcode': '000000',
'word_partition': [(0, 32)]
},
'jmp': {
'opcode': '000001',
'word_partition': [(0, 6), (1, 26)]
},
'mov': {
'opcode': '000010',
'word_partition': [(0, 6), (1, 5), (2, 21)]
},
'add': {
'opcode': '000011',
'word_partition': [(0, 6), (1, 5), (2, 5), (3, 5), (4, 11)]
},
'lsl': {
'opcode': '000100',
'word_partition': [(0, 6), (1, 5), (2, 5), (3, 16)]
},
'line': {
'opcode': '000101',
'word_partition': [(0, 6), (1, 10), (2, 5), (3, 11)]
},
'bezquad': {
'opcode': '000110',
'word_partition': [(0, 6), (1, 10), (2, 5), (3, 5), (4, 6)]
},
'bezcube': {
'opcode': '000111',
'word_partition': [(0, 6), (1, 10), (2, 5), (3, 5), (4, 5), (5, 1)]
},
'ldr': {
'opcode': '001000',
'word_partition': [(0, 6), (1, 5), (2, 21)]
},
'str': {
'opcode': '001001',
'word_partition': [(0, 6), (1, 5), (2, 21)]
},
'ldrp': {
'opcode': '001010',
'word_partition': [(0, 6), (1, 26)]
},
'strp': {
'opcode': '001011',
'word_partition': [(0, 6), (1, 26)]
},
'beq': {
'opcode': '001100',
'word_partition': [(0, 6), (1, 5), (2, 5), (3, 16)]
},
'movu': {
'opcode': '001101',
'word_partition': [(0, 6), (1, 5), (2, 21)]
},
'movl': {
'opcode': '001110',
'word_partition': [(0, 6), (1, 5), (2, 21)]
},
'updp': {
'opcode': '001111',
'word_partition': [(0, 6), (1, 26)]
}
}
@staticmethod
def get_opcode(instruction):
value = Instructions.instructions[instruction]
return value['opcode']
@staticmethod
def get_word_partitioning(instruction):
value = Instructions.instructions[instruction]
return value['word_partition']