-
Notifications
You must be signed in to change notification settings - Fork 5
/
instructionSet.txt
65 lines (47 loc) · 1.52 KB
/
instructionSet.txt
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
# Instruction Set
"add" : Add
# add r0 r1 r2
# where r0=r1+r2
"addi" : Add Immediate
# add r0 r1 c4
# where r0 = r1 + 4
"imul" : Multiply Integers
# div r0 r1 r2
# where r0 = r1*r2
"idiv" : Divide Integers
# add r0 r1 r2
# where r0 = r1/r2
"cmp" : Compare
# cmp r0 r1 r2
# where r0 = r1 - r2
"ldr" : Load Register
# ldr r0 r1
# where r0 <- M[r1]
"ldc" : Load Constant
# ldc r0 c4
# where r0 <- 4
"be" : Branch if equal to zero
# blth r0 label
"j" : Jump to label;
# j label
"bne" : Branch if not equal to zero
# blth r0 label
"bgth" : Branch if greater than zero
# blth r0 label
"bgthe" : Branch if greater than or equal zero
# blth r0 label
"bgthe" : Branch if less than or equal zero
# blth r0 label
"blth" : Branch if less than zero
# blth r0 label
"sub" : Subtract
# sub r0 r1 r2
# where r0=r1-r2
"subi" : Subtract Immediate
# sub r0 r1 c4
# where r0 = r1 - 4
"sto" : Store
# sto r0 r1
# where M[r0] <- r1
"sys" : Dump Register/Memory
# sys (r|m fromIndex toIndex)