/
instructionset_2U.py
77 lines (63 loc) · 3.46 KB
/
instructionset_2U.py
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
inst_dic = {
# system control
"halt": {"code": 0, "operandCount": 0},
"nop": {"code": 1, "operandCount": 0},
"speed": {"code": 2, "operandCount": 1},
"initsp": {"code": 3, "operandCount": 0},
# data movement
"copyla": {"code": 4, "operandCount": 1},
"copylr": {"code": 5, "operandCount": 2},
"copyli": {"code": 6, "operandCount": 2}, # new 2U instructions
"copyar": {"code": 7, "operandCount": 1},
"copyai": {"code": 8, "operandCount": 1}, # new 2U instructions
"copyra": {"code": 9, "operandCount": 1},
"copyrr": {"code": 10, "operandCount": 2},
"copyri": {"code": 11, "operandCount": 2}, # new 2U instructions
"copyia": {"code": 12, "operandCount": 1}, # new 2U instructions
"copyir": {"code": 13, "operandCount": 2}, # new 2U instructions
"copyii": {"code": 14, "operandCount": 2}, # new 2U instructions
"swapra": {"code": 15, "operandCount": 1}, # new 2U instructions
"swaprr": {"code": 16, "operandCount": 2}, # new 2U instructions
# Arithmetic
"addla": {"code": 17, "operandCount": 1},
"addra": {"code": 18, "operandCount": 1},
"subla": {"code": 19, "operandCount": 1},
"subra": {"code": 20, "operandCount": 1},
"mul": {"code": 21, "operandCount": 2}, # new 2U instructions
"div": {"code": 22, "operandCount": 2}, # new 2U instructions
# Logical
"andla": {"code": 23, "operandCount": 1},
"andra": {"code": 24, "operandCount": 1},
"orla": {"code": 25, "operandCount": 1},
"orra": {"code": 26, "operandCount": 1},
"xorla": {"code": 27, "operandCount": 1},
"xorra": {"code": 28, "operandCount": 1},
# Increment, decrement
"decr": {"code": 29, "operandCount": 1},
"incr": {"code": 30, "operandCount": 1},
"decrjz": {"code": 31, "operandCount": 1},
"incrjz": {"code": 32, "operandCount": 1},
# shift
"shiftrl": {"code": 33, "operandCount": 1},
"shiftrr": {"code": 34, "operandCount": 1},
# bit manipulation
"bclr": {"code": 35, "operandCount": 2},
"bset": {"code": 36, "operandCount": 2},
"bchg": {"code": 37, "operandCount": 2}, # new 2U instructions
"btstsc": {"code": 38, "operandCount": 2},
"btstss": {"code": 39, "operandCount": 2},
# Program comtrol
"jump": {"code": 40, "operandCount": 1},
"jumpi": {"code": 41, "operandCount": 1}, # new 2U instructions
"call": {"code": 42, "operandCount": 1},
"calli": {"code": 43, "operandCount": 1}, # new 2U instructions
"return": {"code": 44, "operandCount": 0},
"retla": {"code": 45, "operandCount": 1},
"addrpc": {"code": 46, "operandCount": 1},
# misc
"randa": {"code": 47, "operandCount": 0},
# Serial communication
"comout": {"code": 192, "operandCount": 0}, # new 2U instructions
"comin": {"code": 193, "operandCount": 0}, # new 2U instructions
"comrdy": {"code": 194, "operandCount": 0}, # new 2U instructions
}